Completed
Pull Request — master (#20)
by Wachter
03:17
created

BootstrapTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B testBootstrap() 0 24 3
1
<?php
2
3
/*
4
 * This file is part of php-task library.
5
 *
6
 * (c) php-task
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Task\TaskBundle\Tests\Functional;
13
14
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
15
use Task\Scheduler\TaskSchedulerInterface;
16
use Task\Storage\ArrayStorage\ArrayTaskExecutionRepository;
17
use Task\Storage\ArrayStorage\ArrayTaskRepository;
18
use Task\TaskBundle\Entity\TaskExecutionRepository;
19
use Task\TaskBundle\Entity\TaskRepository;
20
21
/**
22
 * Tests the service definitions.
23
 */
24
class BootstrapTest extends KernelTestCase
25
{
26
    public function testBootstrap()
27
    {
28
        $this->bootKernel();
29
30
        $scheduler = self::$kernel->getContainer()->get('task.scheduler');
31
        $taskRepository = self::$kernel->getContainer()->get('task.storage.task');
32
        $taskExecutionRepository = self::$kernel->getContainer()->get('task.storage.task_execution');
33
34
        $this->assertInstanceOf(TaskSchedulerInterface::class, $scheduler);
35
36
        switch (self::$kernel->getContainer()->getParameter('kernel.storage')) {
37
            case 'array':
38
                $this->assertInstanceOf(ArrayTaskRepository::class, $taskRepository);
39
                $this->assertInstanceOf(ArrayTaskExecutionRepository::class, $taskExecutionRepository);
40
                break;
41
            case 'doctrine':
42
                $this->assertInstanceOf(TaskRepository::class, $taskRepository);
43
                $this->assertInstanceOf(TaskExecutionRepository::class, $taskExecutionRepository);
44
                break;
45
            default:
46
                $this->fail('storage not supported');
47
                break;
48
        }
49
    }
50
}
51