ChainLoaderTest::testAddingNewLoader()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of the Superdesk Web Publisher Templates System.
4
 *
5
 * Copyright 2015 Sourcefabric z.ú. and contributors.
6
 *
7
 * For the full copyright and license information, please see the
8
 * AUTHORS and LICENSE files distributed with this source code.
9
 *
10
 * @copyright 2015 Sourcefabric z.ú
11
 * @license http://www.superdesk.org/license
12
 */
13
14
namespace SWP\Component\TemplatesSystem\Tests\Gimme\Loader;
15
16
use Doctrine\Common\Cache\ArrayCache;
17
use SWP\Component\TemplatesSystem\Gimme\Context\Context;
18
use SWP\Component\TemplatesSystem\Gimme\Factory\MetaFactory;
19
use SWP\Component\TemplatesSystem\Gimme\Loader\ArticleLoader;
20
use SWP\Component\TemplatesSystem\Gimme\Loader\ChainLoader;
21
use Symfony\Component\EventDispatcher\EventDispatcher;
22
23
class ChainLoaderTest extends \PHPUnit\Framework\TestCase
24
{
25
    private $loader;
26
27
    public function setUp()
28
    {
29
        $this->loader = new ChainLoader();
30
    }
31
32
    public function testAddingNewLoader()
33
    {
34
        $articleLoader = new ArticleLoader(
35
            __DIR__.'/../../Twig/Node',
36
            new MetaFactory(new Context(new EventDispatcher(), new ArrayCache()))
37
        );
38
        $this->loader->addLoader($articleLoader);
39
40
        $this->assertTrue($this->loader->isSupported('article'));
41
        unset($this->loader);
42
        unset($articleLoader);
43
    }
44
}
45