Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @test
- */
- public function test_command()
- {
- $kernel = static::createKernel();
- $kernel->boot();
- $application = new Application($kernel);
- $application->add(new MyCommand());
- $command = $application->find('my:command');
- $commandTester = new CommandTester($command);
- $commandTester->execute(
- [
- 'command' => $command->getName(),
- ]
- );
- $statusCode = $commandTester->getStatusCode();
- $this->assertEquals(0, $statusCode);
- }
- /**
- * {@inheritdoc}
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $this->logger->info(sprintf('Starting job "%s"', $this->getName()));
- try {
- $changesDone = $this->importService->importQuestionsAndChoices();
- if ($changesDone) {
- if (!$input->getOption('no-profile-generation')) {
- $this->logger->info('Questions have changed. Re-generating table');
- $this->profileGenerator->generateEntity();
- }
- } else {
- $this->logger->info('No new questions or choices available');
- }
- } catch (Exception $exception) {
- $this->logger->error($exception->getMessage(), ['exception' => $exception]);
- }
- $this->logger->info(sprintf('Ending job "%s"', $this->getName()));
- }
Add Comment
Please, Sign In to add comment