HtmlElementFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCreateService() 0 22 1
1
<?php
2
/**
3
 * Sake
4
 *
5
 * @link      http://github.com/sandrokeil/HtmlElement for the canonical source repository
6
 * @copyright Copyright (c) 2014-2017 Sandro Keil
7
 * @license   http://github.com/sandrokeil/HtmlElement/blob/master/LICENSE.txt New BSD License
8
 */
9
10
namespace SakeTest\HtmlElement\Service;
11
12
use PHPUnit\Framework\TestCase;
13
use Sake\HtmlElement\Service\HtmlElementFactory;
14
use Sake\HtmlElement\View\Helper\HtmlElement;
15
16
/**
17
 * Class HtmlElementFactory
18
 *
19
 * Tests integrity of \SakeTest\HtmlElement\Service\HtmlElementFactory
20
 */
21
class HtmlElementFactoryTest extends TestCase
22
{
23
    /**
24
     * Tests createService() returns a valid and configured service instance.
25
     *
26
     * @covers \Sake\HtmlElement\Service\HtmlElementFactory
27
     * @group factory
28
     */
29
    public function testCreateService()
30
    {
31
        $config = [
32
            'sake_htmlelement' => [
33
                'view_helper' => [
34
                    'default' => [
35
                        'escapeHtmlAttribute' => true,
36
                        'escapeText' => true,
37
                    ],
38
                ],
39
            ],
40
        ];
41
42
        $container = $this->prophesize(\Interop\Container\ContainerInterface::class);
43
44
        $container->get('config')->willReturn($config)->shouldBeCalled();
45
46
        $factory = new HtmlElementFactory();
47
        $htmlElement = $factory($container->reveal());
48
49
        $this->assertInstanceOf(HtmlElement::class, $htmlElement);
50
    }
51
}
52