Skip to content

Commit 615bbee

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: (46 commits) fixxed order of usage [2.7] [Form] Replaced calls to array_search() by in_array() where is no need to get the index [Process] Make test AbstractProcessTest::testStartAfterATimeout useful again removed non-sense example Fixes small typo. [Validator] Remove unnecessary include in tests [HttpFoundation] minor: clarify Request::getUrlencodedPrefix() regex fixed typo [Validator] fix DOS-style line endings Drop useless execution bit bumped Symfony version to 2.6.5 [Serializer] update changelog updated VERSION for 2.6.4 updated CHANGELOG for 2.6.4 bumped Symfony version to 2.5.11 [HttpKernel] Added use of provided by #12022 method to instantiate controller class in bundle's controller resolver updated VERSION for 2.5.10 updated CHANGELOG for 2.5.10 [Validator] Add a Russian translation for invalid charset message [2.3] [Validator] spanish translation for invalid charset message ... Conflicts: src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php src/Symfony/Component/HttpKernel/Exception/FatalErrorException.php src/Symfony/Component/HttpKernel/Exception/FlattenException.php src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php src/Symfony/Component/Validator/Resources/translations/validators.de.xlf src/Symfony/Component/Validator/Resources/translations/validators.en.xlf src/Symfony/Component/Validator/Resources/translations/validators.es.xlf src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf
2 parents f9ca599 + ae68b6c commit 615bbee

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

Tests/OptionsResolver2Dot6Test.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,19 @@ public function testFailIfSetAllowedTypesFromLazyOption()
504504
*/
505505
public function testResolveFailsIfInvalidType()
506506
{
507-
$this->resolver->setDefault('foo', 42);
507+
$this->resolver->setDefined('foo');
508+
$this->resolver->setAllowedTypes('foo', 'string');
509+
510+
$this->resolver->resolve(array('foo' => 42));
511+
}
512+
513+
/**
514+
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
515+
* @expectedExceptionMessage The option "foo" with value null is expected to be of type "string", but is of type "NULL".
516+
*/
517+
public function testResolveFailsIfInvalidTypeIsNull()
518+
{
519+
$this->resolver->setDefault('foo', null);
508520
$this->resolver->setAllowedTypes('foo', 'string');
509521

510522
$this->resolver->resolve();
@@ -675,7 +687,19 @@ public function testFailIfSetAllowedValuesFromLazyOption()
675687
*/
676688
public function testResolveFailsIfInvalidValue()
677689
{
678-
$this->resolver->setDefault('foo', 42);
690+
$this->resolver->setDefined('foo');
691+
$this->resolver->setAllowedValues('foo', 'bar');
692+
693+
$this->resolver->resolve(array('foo' => 42));
694+
}
695+
696+
/**
697+
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
698+
* @expectedExceptionMessage The option "foo" with value null is invalid. Accepted values are: "bar".
699+
*/
700+
public function testResolveFailsIfInvalidValueIsNull()
701+
{
702+
$this->resolver->setDefault('foo', null);
679703
$this->resolver->setAllowedValues('foo', 'bar');
680704

681705
$this->resolver->resolve();

0 commit comments

Comments
 (0)