HtmlTest::testRender()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace OpCacheGUITest\Unit\Presentation;
4
5
use OpCacheGUI\I18n\Translator;
6
use OpCacheGUI\Presentation\Html;
7
use OpCacheGUI\Presentation\Renderer;
8
use OpCacheGUI\Presentation\Template;
9
use OpCacheGUI\Presentation\UrlRenderer;
10
use PHPUnit\Framework\TestCase;
11
12
class HtmlTest extends TestCase
13
{
14
    /**
15
     * @covers OpCacheGUI\Presentation\Html::__construct
16
     */
17
    public function testConstructCorrectInterface()
18
    {
19
        $html = new Html(
20
            __DIR__,
21
            'page.phtml',
22
            $this->createMock(Translator::class),
23
            $this->createMock(UrlRenderer::class)
24
        );
25
26
        $this->assertInstanceOf(Renderer::class, $html);
27
    }
28
29
    /**
30
     * @covers OpCacheGUI\Presentation\Html::__construct
31
     */
32
    public function testConstructCorrectInstance()
33
    {
34
        $html = new Html(
35
            __DIR__,
36
            'page.phtml',
37
            $this->createMock(Translator::class),
38
            $this->createMock(UrlRenderer::class)
39
        );
40
41
        $this->assertInstanceOf(Template::class, $html);
42
    }
43
44
    /**
45
     * @covers OpCacheGUI\Presentation\Html::__construct
46
     * @covers OpCacheGUI\Presentation\Html::render
47
     * @covers OpCacheGUI\Presentation\Html::renderTemplate
48
     */
49
    public function testRender()
50
    {
51
        $html = new Html(
52
            __DIR__ . '/../../Data/templates/',
53
            'skeleton.phtml',
54
            $this->createMock(Translator::class),
55
            $this->createMock(UrlRenderer::class)
56
        );
57
58
        $this->assertSame('<skeleton>content</skeleton>', $html->render('example.phtml'));
59
    }
60
}
61