public function testNormalizerWithoutCorrespondingOption() { $test = $this; $this->options->setNormalizer('foo', function (Options $options, $previousValue) use($test) { $test->assertNull($previousValue); return ''; }); $this->assertEquals(array('foo' => ''), $this->options->all()); }
public function testReplaceClearsAndSets() { $this->options->set('one', '1'); $this->options->replace(array( 'two' => '2', 'three' => function (Options $options) { return '2' === $options['two'] ? '3' : 'foo'; } )); $this->assertEquals(array( 'two' => '2', 'three' => '3', ), $this->options->all()); }
/** * @covers Symfony\Component\OptionsResolver\Options::clear * @expectedException Symfony\Component\OptionsResolver\Exception\OptionDefinitionException */ public function testCannotClearAfterOptionWasRead() { $this->options->set('one', 1); $this->options->all(); $this->options->clear(); }