[OptionsResolver] Fix Options::has() when the value is null

This commit is contained in:
Victor Berchet 2012-07-30 09:38:43 +02:00
parent 6b39ebc4f8
commit a47922b4bf
2 changed files with 8 additions and 1 deletions

View File

@ -247,7 +247,7 @@ class Options implements \ArrayAccess, \Iterator, \Countable
*/
public function has($option)
{
return isset($this->options[$option]);
return array_key_exists($option, $this->options);
}
/**

View File

@ -462,4 +462,11 @@ class OptionsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedResult, iterator_to_array($this->options, true));
}
public function testHasWithNullValue()
{
$this->options->set('foo', null);
$this->assertTrue($this->options->has('foo'));
}
}