Skip to content

Commit d7708f8

Browse files
committed
Merge branch '2.7'
* 2.7: (61 commits) fixxed order of usage [2.7] [Form] Replaced calls to array_search() by in_array() where is no need to get the index removed the last deprecation notice [Serializer] Silent deprecation notice removed deprecation notice [PropertyAccess] Show property path in all exception messages added deprecation notice for HttpCache::createEsi() added missing deprecation notice when using the form_enctype function [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 [Serializer] Use Serializer's LogicException when applicable [Serializer] Use autoloader for annotations in tests [Validator] fix DOS-style line endings Drop useless execution bit bumped Symfony version to 2.6.5 [Serializer] update changelog ... Conflicts: CHANGELOG-2.3.md CHANGELOG-2.5.md CHANGELOG-2.6.md src/Symfony/Bridge/Twig/Node/FormEnctypeNode.php src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php
2 parents 60f98ae + 615bbee commit d7708f8

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)