/**
     * Test describe method.
     *
     * @return void
     *
     * @since  2.0
     */
    public function testDescribe()
    {
        $compare = '<comment>Test Console</comment> - version: 1.2.3
------------------------------------------------------------

[<comment>foo</comment> Help]

foo desc

Usage:
  foo command option


Options:

  <info>-q | --quiet     </info>q desc
  <info>-s | --sakura    </info>sakura desc
  <info>-r               </info>rose desc

Commands:

  <info>aaa    </info>No description
  <info>bar    </info>Bar command desc
  <info>yoo    </info>No description

foo help';
        $console = new Console(new MockIO());
        $console->setTitle('Test Console')->setVersion('1.2.3')->setDescription('test desc');
        $command = new FooCommand();
        $command->setApplication($console)->description('foo desc')->usage('foo command option')->help('foo help');
        $command->addCommand('bar', 'Bar command desc');
        $command->addCommand('yoo');
        $command->addOption(array('q', 'quiet'), 'default', 'q desc');
        $command->addOption(array('s', 'sakura'), 'default', 'sakura desc');
        $command->addOption(array('r'), 'default', 'rose desc');
        $result = $this->instance->describe($command);
        $this->assertEquals(str_replace("\r\n", "\n", trim($compare)), str_replace("\r\n", "\n", trim($result)));
    }
예제 #2
0
 /**
  * Test set name.
  *
  * @return void
  *
  * @since  2.0
  */
 public function testSetTitle()
 {
     $this->instance->setTitle('Test Console2');
     $this->assertEquals('Test Console2', $this->instance->getTitle());
 }