コード例 #1
0
ファイル: ApplicationTest.php プロジェクト: viserio/console
 public function testAllowsToDefineDefaultValues()
 {
     $this->application->command('greet [firstname] [lastname]', function ($firstname, $lastname, Outputinterface $output) {
     });
     $this->application->defaults('greet', ['firstname' => 'John', 'lastname' => 'Doe']);
     $definition = $this->application->get('greet')->getDefinition();
     $this->assertEquals('John', $definition->getArgument('firstname')->getDefault());
     $this->assertEquals('Doe', $definition->getArgument('lastname')->getDefault());
 }
コード例 #2
0
 public function testCommand()
 {
     $command = new ClosureCommand('demo', function () {
         $this->comment('hello');
     });
     $this->application->add($command);
     $this->assertSame($command, $this->application->get('demo'));
     $this->assertOutputIs('demo', 'hello' . "\n");
 }