Completed
Push — master ( 92445d...878510 )
by Tomasz
03:21
created

NormalizerTest::testReflectionInheritance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
namespace Thunder\Serializard\Tests;
3
4
use Thunder\Serializard\Normalizer\ReflectionNormalizer;
5
use Thunder\Serializard\Tests\Fake\Inheritance\FakeClass;
6
use Thunder\Serializard\Tests\Fake\FakeTag;
7
use Thunder\Serializard\Tests\Fake\FakeUser;
8
9
/**
10
 * @author Tomasz Kowalczyk <[email protected]>
11
 */
12
class NormalizerTest extends \PHPUnit_Framework_TestCase
13
{
14
    public function testReflectionSkip()
15
    {
16
        $normalizer = new ReflectionNormalizer(array('tag', 'tags'));
17
        $object = new FakeUser(12, 'XXX', new FakeTag(144, 'YYY'));
18
19
        $this->assertSame(array('id' => 12, 'name' => 'XXX'), $normalizer($object));
20
    }
21
22
    public function testReflectionInheritance()
23
    {
24
        $normalizer = new ReflectionNormalizer();
25
26
        $this->assertSame([
27
            'property' => 'property',
28
            'parentProperty' => 'parent',
29
            'parentParentProperty' => 'parentParent',
30
        ], $normalizer(new FakeClass('parentParent', 'parent', 'property')));
31
    }
32
}
33