Exemplo n.º 1
0
 /**
  * @expectedException        \InvalidArgumentException
  * @expectedExceptionMessage The "-l" option does not exist.
  */
 public function testGetOptionForInvalidShortcut()
 {
     $this->initializeOptions();
     $definition = new InputDefinition(array($this->foo));
     $definition->getOptionForShortcut('l');
 }
Exemplo n.º 2
0
 public function testGetOptionForShortcut()
 {
     $this->initializeOptions();
     $definition = new InputDefinition(array($this->foo));
     $this->assertEquals($this->foo, $definition->getOptionForShortcut('f'), '->getOptionForShortcut() returns a InputOption by its shortcut');
     try {
         $definition->getOptionForShortcut('l');
         $this->fail('->getOption() throws an exception if the shortcut does not exist');
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\Exception', $e, '->getOption() throws an exception if the shortcut does not exist');
         $this->assertEquals('The "-l" option does not exist.', $e->getMessage());
     }
 }