Passed
Push — master ( efa86f...55c9f6 )
by Petr
10:18
created

ItemTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 18
c 0
b 0
f 0
dl 0
loc 25
rs 10
1
<?php
2
3
namespace BasicTests;
4
5
6
use CommonTestClass;
7
8
9
class ItemTest extends CommonTestClass
10
{
11
    public function testSimple()
12
    {
13
        $data = $this->mockItem();
14
        $this->assertInstanceOf('\kalanis\kw_templates\Template\Item', $data);
15
        $this->assertEquals('testing content', $data->getKey());
16
        $this->assertEquals('default content %s', $data->getDefault());
17
        $this->assertEquals('default content %s', $data->getValue());
18
19
        $data->setValue('different %s %s');
20
        $this->assertNotEquals('default content %s', $data->getValue());
21
        $this->assertEquals('different %s %s', $data->getValue());
22
23
        $data->updateValue('conv', 'val');
24
        $this->assertEquals('different conv val', $data->getValue());
25
26
        $data->setValue(null);
27
        $data->updateValue('conv', 'val');
28
        $this->assertEquals('default content conv', $data->getValue());
29
30
        $data2 = clone $data;
31
        $data2->setData('new test', 'another content %f');
32
        $this->assertEquals('new test', $data2->getKey());
33
        $this->assertNotEquals('new test', $data->getKey());
34
    }
35
}
36