kekrozsak/vendor/jms/metadata/schmittjoh-metadata-84088bc/tests/Metadata/Tests/MergeableClassMetadataTest.php
2012-07-23 17:09:03 +02:00

33 lines
1.4 KiB
PHP

<?php
namespace Metadata\Tests;
use Metadata\MergeableClassMetadata;
use Metadata\ClassMetadata;
class MergeableClassMetadataTest extends \PHPUnit_Framework_TestCase
{
public function testMerge()
{
$parentMetadata = new MergeableClassMetadata('Metadata\Tests\Fixtures\TestParent');
$parentMetadata->propertyMetadata['foo'] = 'bar';
$parentMetadata->propertyMetadata['baz'] = 'baz';
$parentMetadata->methodMetadata['foo'] = 'bar';
$parentMetadata->createdAt = 2;
$parentMetadata->fileResources[] = 'foo';
$childMetadata = new MergeableClassMetadata('Metadata\Tests\Fixtures\TestObject');
$childMetadata->propertyMetadata['foo'] = 'baz';
$childMetadata->methodMetadata['foo'] = 'baz';
$childMetadata->createdAt = 1;
$childMetadata->fileResources[] = 'bar';
$parentMetadata->merge($childMetadata);
$this->assertEquals('Metadata\Tests\Fixtures\TestObject', $parentMetadata->name);
$this->assertEquals('Metadata\Tests\Fixtures\TestObject', $parentMetadata->reflection->getName());
$this->assertEquals(array('foo' => 'baz', 'baz' => 'baz',), $parentMetadata->propertyMetadata);
$this->assertEquals(array('foo' => 'baz',), $parentMetadata->methodMetadata);
$this->assertEquals(1, $parentMetadata->createdAt);
$this->assertEquals(array('foo', 'bar'), $parentMetadata->fileResources);
}
}