JsonTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructCorrectInterface() 0 6 1
A testConstructCorrectInstance() 0 6 1
A testRender() 0 6 1
1
<?php
2
3
namespace OpCacheGUITest\Unit\Presentation;
4
5
use OpCacheGUI\I18n\Translator;
6
use OpCacheGUI\Presentation\Json;
7
use OpCacheGUI\Presentation\Renderer;
8
use OpCacheGUI\Presentation\Template;
9
use PHPUnit\Framework\TestCase;
10
11
class JsonTest extends TestCase
12
{
13
    /**
14
     * @covers OpCacheGUI\Presentation\Json::__construct
15
     */
16
    public function testConstructCorrectInterface()
17
    {
18
        $json = new Json(__DIR__, $this->createMock(Translator::class));
19
20
        $this->assertInstanceOf(Renderer::class, $json);
21
    }
22
23
    /**
24
     * @covers OpCacheGUI\Presentation\Json::__construct
25
     */
26
    public function testConstructCorrectInstance()
27
    {
28
        $json = new Json(__DIR__, $this->createMock(Translator::class));
29
30
        $this->assertInstanceOf(Template::class, $json);
31
    }
32
33
    /**
34
     * @covers OpCacheGUI\Presentation\Json::__construct
35
     * @covers OpCacheGUI\Presentation\Json::render
36
     */
37
    public function testRender()
38
    {
39
        $json = new Json(__DIR__ . '/../../Data/templates', $this->createMock(Translator::class));
40
41
        $this->assertSame('content', $json->render('example.pjson'));
42
    }
43
}
44