TemplateTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 60
rs 10
c 1
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructCorrectInterface() 0 6 1
A testMagicGetExists() 0 8 1
A testMagicGetDoesNotExist() 0 6 1
A testMagicIssetExists() 0 8 1
A testMagicIssetDoesNotExist() 0 6 1
1
<?php
2
3
namespace OpCacheGUITest\Unit\Presentation;
4
5
use OpCacheGUI\I18n\Translator;
6
use OpCacheGUITest\Mocks\Presentation\TemplateMock;
7
use PHPUnit\Framework\TestCase;
8
9
class TemplateTest extends TestCase
10
{
11
    /**
12
     * @covers OpCacheGUI\Presentation\Template::__construct
13
     */
14
    public function testConstructCorrectInterface()
15
    {
16
        $template = new TemplateMock(__DIR__, $this->createMock(Translator::class));
17
18
        $this->assertInstanceOf('\\OpCacheGUI\\Presentation\\Renderer', $template);
19
    }
20
21
    /**
22
     * @covers OpCacheGUI\Presentation\Template::__construct
23
     * @covers OpCacheGUI\Presentation\Template::__get
24
     */
25
    public function testMagicGetExists()
26
    {
27
        $template = new TemplateMock(__DIR__, $this->createMock(Translator::class));
28
29
        $template->set('foo', 'bar');
30
31
        $this->assertSame('bar', $template->foo);
32
    }
33
34
    /**
35
     * @covers OpCacheGUI\Presentation\Template::__construct
36
     * @covers OpCacheGUI\Presentation\Template::__get
37
     */
38
    public function testMagicGetDoesNotExist()
39
    {
40
        $template = new TemplateMock(__DIR__, $this->createMock(Translator::class));
41
42
        $this->assertNull($template->foo);
43
    }
44
45
    /**
46
     * @covers OpCacheGUI\Presentation\Template::__construct
47
     * @covers OpCacheGUI\Presentation\Template::__isset
48
     */
49
    public function testMagicIssetExists()
50
    {
51
        $template = new TemplateMock(__DIR__, $this->createMock(Translator::class));
52
53
        $template->set('foo', 'bar');
54
55
        $this->assertTrue(isset($template->foo));
56
    }
57
58
    /**
59
     * @covers OpCacheGUI\Presentation\Template::__construct
60
     * @covers OpCacheGUI\Presentation\Template::__isset
61
     */
62
    public function testMagicIssetDoesNotExist()
63
    {
64
        $template = new TemplateMock(__DIR__, $this->createMock(Translator::class));
65
66
        $this->assertFalse(isset($template->foo));
67
    }
68
}
69