コード例 #1
0
ファイル: InfoCommandTest.php プロジェクト: kangkot/bldr
    /**
     *
     */
    public function testCommand()
    {
        $this->task1->shouldReceive('getDescription')->andReturn('A first description.');
        $this->task1->shouldReceive('getParameterDefinition')->andReturn([['name' => 'option1', 'default' => null, 'description' => '', 'required' => false], ['name' => 'option2', 'default' => 'bldr!', 'description' => 'Option 2 description', 'required' => true], ['name' => 'option3', 'default' => true, 'description' => '', 'required' => false]]);
        $this->task2->shouldReceive('getDescription')->andReturnNull();
        $application = new MockApplication();
        $application->add($this->command);
        $tester = new CommandTester($application->find('task:info'));
        $tester->execute(['task' => 'Name 1']);
        $this->assertEquals(<<<EOO

Task Name: Name 1
Task Description: A first description.

Options:
+---------+----------------------+----------+---------+
| Option  | Description          | Required | Default |
+---------+----------------------+----------+---------+
| option1 | No Description       | No       | null    |
| option2 | Option 2 description | Yes      | "bldr!" |
| option3 | No Description       | No       | true    |
+---------+----------------------+----------+---------+

EOO
, $tester->getDisplay());
        $tester = new CommandTester($application->find('task:info'));
        $tester->execute(['task' => 'Name 2']);
        $this->assertEquals(<<<EOO

Task Name: Name 2

EOO
, $tester->getDisplay());
    }
コード例 #2
0
ファイル: ListCommandTest.php プロジェクト: kangkot/bldr
    public function testCommand()
    {
        $this->task1->shouldReceive('getName')->andReturn('Name 1');
        $this->task1->shouldReceive('getDescription')->andReturn('A first description.');
        $this->task2->shouldReceive('getName')->andReturn('Name 2');
        $this->task2->shouldReceive('getDescription')->andReturn('A second description.');
        $application = new MockApplication();
        $application->add($this->command);
        $tester = new CommandTester($application->find('task:list'));
        $tester->execute([]);
        $this->assertEquals(<<<EOO
+--------+-----------------------+
| Name   | Description           |
+--------+-----------------------+
| Name 1 | A first description.  |
| Name 2 | A second description. |
+--------+-----------------------+

EOO
, $tester->getDisplay());
    }