application = new Application($kernel); $this->directory = realpath(__DIR__ . '/../../'); $this->executor = new TestBashExecutor($this->directory); $this->application->add(new RunIntegrationTestsCommand($this->executor, $this->directory)); } public function testSuccessCommand() { $result = new BashResult(0, 'FooBar'); $this->executor->setResult($result); $command = $this->application->find('kimai:test-integration'); $commandTester = new CommandTester($command); $inputs = array_merge(['command' => $command->getName()], []); $commandTester->execute($inputs); $output = $commandTester->getDisplay(); $this->assertContains('FooBar', $output); $this->assertContains('[OK] All tests were successful', $output); $this->assertStringStartsWith('/bin/phpunit --group integration', $this->executor->getCommand()); $this->assertContains($this->directory, $this->executor->getCommand()); } public function testFailureCommand() { $result = new BashResult(1, 'BarFoo'); $this->executor->setResult($result); $command = $this->application->find('kimai:test-integration'); $commandTester = new CommandTester($command); $inputs = array_merge(['command' => $command->getName()], []); $commandTester->execute($inputs); $output = $commandTester->getDisplay(); $this->assertContains('BarFoo', $output); $this->assertContains('[ERROR] Found problems while running tests', $output); $this->assertStringStartsWith('/bin/phpunit --group integration', $this->executor->getCommand()); $this->assertContains($this->directory, $this->executor->getCommand()); } }