Exemplo n.º 1
0
 /**
  * @expectedException        \InvalidArgumentException
  * @expectedExceptionMessage The "-f" option does not exist.
  */
 public function testSetOptionsClearsOptions()
 {
     $this->initializeOptions();
     $definition = new InputDefinition(array($this->foo));
     $definition->setOptions(array($this->bar));
     $definition->getOptionForShortcut('f');
 }
Exemplo n.º 2
0
 public function testSetOptions()
 {
     $this->initializeOptions();
     $definition = new InputDefinition(array($this->foo));
     $this->assertEquals(array('foo' => $this->foo), $definition->getOptions(), '->setOptions() sets the array of InputOption objects');
     $definition->setOptions(array($this->bar));
     $this->assertEquals(array('bar' => $this->bar), $definition->getOptions(), '->setOptions() clears all InputOption objects');
     try {
         $definition->getOptionForShortcut('f');
         $this->fail('->setOptions() clears all InputOption objects');
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\Exception', $e, '->setOptions() clears all InputOption objects');
         $this->assertEquals('The "-f" option does not exist.', $e->getMessage());
     }
 }