HtmlElementFactoryTest::testCreateService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 0
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