NormalizerContextTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testParentNormalizerContext() 0 18 1
1
<?php
2
namespace Thunder\Serializard\Tests;
3
4
use Thunder\Serializard\NormalizerContext\ParentNormalizerContext;
5
6
/**
7
 * @author Tomasz Kowalczyk <[email protected]>
8
 */
9
final class NormalizerContextTest extends AbstractTestCase
10
{
11
    public function testParentNormalizerContext()
12
    {
13
        $ctx = new ParentNormalizerContext();
14
        $this->assertSame(0, $ctx->getLevel());
15
        $this->assertNull($ctx->getParent());
16
        $this->assertNull($ctx->getFormat());
17
        $this->assertNull($ctx->getRoot());
18
19
        $object = new \stdClass();
20
        /** @var ParentNormalizerContext $ctx */
21
        $ctx = $ctx->withRoot($object)->withFormat('json');
22
23
        $ctx = $ctx->withParent($object);
24
        $this->assertSame(1, $ctx->getLevel());
25
        $this->assertSame($object, $ctx->getParent());
26
        $this->assertSame($object, $ctx->getRoot());
27
        $this->assertSame('json', $ctx->getFormat());
28
    }
29
}
30