| @@ 14-52 (lines=39) @@ | ||
| 11 | * @package silverstripe-console |
|
| 12 | * @author Robbie Averill <[email protected]> |
|
| 13 | */ |
|
| 14 | class ChildrenCommandTest extends AbstractCommandTest |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * {@inheritDoc} |
|
| 18 | */ |
|
| 19 | public function getTestCommand() |
|
| 20 | { |
|
| 21 | return 'object:children'; |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Ensure that the Injector's class resolution is returned for a given Object |
|
| 26 | * |
|
| 27 | * @covers ::execute |
|
| 28 | */ |
|
| 29 | public function testExecute() |
|
| 30 | { |
|
| 31 | $tester = new CommandTester($this->command); |
|
| 32 | $tester->execute( |
|
| 33 | [ |
|
| 34 | 'command' => $this->command->getName(), |
|
| 35 | 'object' => "SilverStripe\Dev\BuildTask" |
|
| 36 | ] |
|
| 37 | ); |
|
| 38 | ||
| 39 | $output = $tester->getDisplay(); |
|
| 40 | $this->assertContains("SilverStripe\Dev\Tasks\CleanupTestDatabasesTask", $output); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * Ensure that the InputArgument for the object is added |
|
| 45 | * |
|
| 46 | * @covers ::configure |
|
| 47 | */ |
|
| 48 | public function testConfigure() |
|
| 49 | { |
|
| 50 | $this->assertTrue($this->command->getDefinition()->hasArgument('object')); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| @@ 14-52 (lines=39) @@ | ||
| 11 | * @package silverstripe-console |
|
| 12 | * @author Robbie Averill <[email protected]> |
|
| 13 | */ |
|
| 14 | class LookupCommandTest extends AbstractCommandTest |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * {@inheritDoc} |
|
| 18 | */ |
|
| 19 | public function getTestCommand() |
|
| 20 | { |
|
| 21 | return 'object:lookup'; |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Ensure that the Injector's class resolution is returned for a given Object |
|
| 26 | * |
|
| 27 | * @covers ::execute |
|
| 28 | */ |
|
| 29 | public function testExecute() |
|
| 30 | { |
|
| 31 | $tester = new CommandTester($this->command); |
|
| 32 | $tester->execute( |
|
| 33 | [ |
|
| 34 | 'command' => $this->command->getName(), |
|
| 35 | 'object' => 'Logger' |
|
| 36 | ] |
|
| 37 | ); |
|
| 38 | ||
| 39 | $output = $tester->getDisplay(); |
|
| 40 | $this->assertContains("Monolog\Logger", $output); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * Ensure that the InputArgument for the object is added |
|
| 45 | * |
|
| 46 | * @covers ::configure |
|
| 47 | */ |
|
| 48 | public function testConfigure() |
|
| 49 | { |
|
| 50 | $this->assertTrue($this->command->getDefinition()->hasArgument('object')); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||