for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thunder\Serializard\Tests;
use Thunder\Serializard\Normalizer\ReflectionNormalizer;
use Thunder\Serializard\Tests\Fake\Inheritance\FakeClass;
use Thunder\Serializard\Tests\Fake\FakeTag;
use Thunder\Serializard\Tests\Fake\FakeUser;
/**
* @author Tomasz Kowalczyk <[email protected]>
*/
class NormalizerTest extends \PHPUnit_Framework_TestCase
{
public function testReflectionSkip()
$normalizer = new ReflectionNormalizer(array('tag', 'tags'));
$object = new FakeUser(12, 'XXX', new FakeTag(144, 'YYY'));
$this->assertSame(array('id' => 12, 'name' => 'XXX'), $normalizer($object));
}
public function testReflectionInheritance()
$normalizer = new ReflectionNormalizer();
$this->assertSame([
'property' => 'property',
'parentProperty' => 'parent',
'parentParentProperty' => 'parentParent',
], $normalizer(new FakeClass('parentParent', 'parent', 'property')));