Skip to content

Commit a666795

Browse files
Olivier Maisonneuvefabpot
authored andcommitted
Unit test for patched method OptionsResolver::validateOptionValues().
1 parent b137fd9 commit a666795

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Tests/OptionsResolverTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,30 @@ public function testResolveSucceedsIfOptionValueAllowed2()
258258
), $this->resolver->resolve($options));
259259
}
260260

261+
public function testResolveSucceedsIfOptionalWithAllowedValuesNotSet()
262+
{
263+
$this->resolver->setRequired(array(
264+
'one',
265+
));
266+
267+
$this->resolver->setOptional(array(
268+
'two',
269+
));
270+
271+
$this->resolver->setAllowedValues(array(
272+
'one' => array('1', 'one'),
273+
'two' => array('2', 'two'),
274+
));
275+
276+
$options = array(
277+
'one' => '1',
278+
);
279+
280+
$this->assertEquals(array(
281+
'one' => '1',
282+
), $this->resolver->resolve($options));
283+
}
284+
261285
/**
262286
* @expectedException Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
263287
*/

0 commit comments

Comments
 (0)