Completed
Pull Request — master (#20)
by Wachter
04:34
created

TaskHandlerFactoryTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 7
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 4
nc 1
nop 0
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
use Task\TaskBundle\Tests\Functional\TestHandler;
18
19
/**
20
 * Functional tests for task-handler definitions.
21
 */
22
class TaskHandlerFactoryTest extends KernelTestCase
23
{
24
    /**
25
     * @var TaskHandlerFactory
26
     */
27
    private $taskHandlerFactory;
28
29
    protected function setUp()
30
    {
31
        parent::setUp();
32
33
        $this->bootKernel();
34
        $this->taskHandlerFactory = self::$kernel->getContainer()->get('task.handler.factory');
35
    }
36
37
    public function testCreate()
38
    {
39
        $this->assertInstanceOf(TestHandler::class, $this->taskHandlerFactory->create(TestHandler::class));
40
    }
41
42
    public function testCreateNotExists()
43
    {
44
        $this->setExpectedException(TaskHandlerNotExistsException::class);
45
46
        $this->taskHandlerFactory->create(\stdClass::class);
47
    }
48
}
49