Completed
Pull Request — master (#20)
by Wachter
05:08
created

TaskHandlerFactoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testCreate() 0 4 1
A testCreateNotExists() 0 6 1
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\Handler;
13
14
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
15
use Task\Handler\TaskHandlerNotExistsException;
16
use Task\TaskBundle\Handler\TaskHandlerFactory;
17
18
/**
19
 * Functional tests for task-handler definitions.
20
 */
21
class TaskHandlerFactoryTest extends KernelTestCase
22
{
23
    /**
24
     * @var TaskHandlerFactory
25
     */
26
    private $taskHandlerFactory;
27
28
    protected function setUp()
29
    {
30
        parent::setUp();
31
32
        $this->bootKernel();
33
        $this->taskHandlerFactory = self::$kernel->getContainer()->get('task.handler.factory');
34
    }
35
36
    public function testCreate()
37
    {
38
        $this->assertInstanceOf(\TestHandler::class, $this->taskHandlerFactory->create(\TestHandler::class));
39
    }
40
41
    public function testCreateNotExists()
42
    {
43
        $this->setExpectedException(TaskHandlerNotExistsException::class);
44
45
        $this->taskHandlerFactory->create(\stdClass::class);
46
    }
47
}
48