Completed
Push — master ( a5a753...454108 )
by Wachter
07:05
created

ScheduleSystemTasksCommandTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 5
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 9 2
A testExecute() 0 14 1
A getCommand() 0 4 1
1
<?php
2
3
namespace Task\TaskBundle\Functional\Command;
4
5
use Symfony\Component\Console\Command\Command;
6
use Task\TaskBundle\Tests\Functional\BaseCommandTestCase;
7
8
class ScheduleSystemTasksCommandTest extends BaseCommandTestCase
9
{
10
    public function setUp()
11
    {
12
        self::bootKernel();
13
        if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') {
14
            return $this->markTestSkipped('This testcase will only be called for doctrine storage.');
15
        }
16
17
        parent::setUp();
18
    }
19
20
    public function testExecute()
21
    {
22
        $this->commandTester->execute(
23
            [
24
                'command' => $this->command->getName(),
25
            ]
26
        );
27
28
        $output = $this->commandTester->getDisplay();
29
        $this->assertContains('System-tasks successfully scheduled', $output);
30
31
        $taskRepository = self::$kernel->getContainer()->get('task.repository.task');
32
        $this->assertNotNull($taskRepository->findBySystemKey('testing'));
33
    }
34
35
    /**
36
     * Returns command.
37
     *
38
     * @return Command
39
     */
40
    protected function getCommand()
41
    {
42
        return self::$kernel->getContainer()->get('task.command.schedule_system_tasks');
43
    }
44
}
45