diff --git a/tests/Doctrine/Tests/Models/DDC1872/DDC1872Bar.php b/tests/Doctrine/Tests/Models/DDC1872/DDC1872Bar.php new file mode 100644 index 000000000..ea170aeff --- /dev/null +++ b/tests/Doctrine/Tests/Models/DDC1872/DDC1872Bar.php @@ -0,0 +1,12 @@ +getMetadataFor('Doctrine\Tests\ORM\Mapping\InvalidFetchOption'); } + + public function testAttributeOverridesMappingWithTrait() + { + if (!version_compare(PHP_VERSION, '5.4.0', '>=')) { + $this->markTestSkipped('This test is only for 5.4+.'); + } + + $factory = $this->createClassMetadataFactory(); + + $metadataWithoutOverride = $factory->getMetadataFor('Doctrine\Tests\Models\DDC1872\DDC1872ExampleEntityWithoutOverride'); + $metadataWithOverride = $factory->getMetadataFor('Doctrine\Tests\Models\DDC1872\DDC1872ExampleEntityWithOverride'); + + $this->assertEquals('trait_foo', $metadataWithoutOverride->fieldMappings['foo']['columnName']); + $this->assertEquals('foo_overridden', $metadataWithOverride->fieldMappings['foo']['columnName']); + $this->assertArrayHasKey('example_trait_bar_id', $metadataWithoutOverride->associationMappings['bar']['joinColumnFieldNames']); + $this->assertArrayHasKey('example_entity_overridden_bar_id', $metadataWithOverride->associationMappings['bar']['joinColumnFieldNames']); + } } /** @@ -337,4 +354,4 @@ class InvalidFetchOption * @OneToMany(targetEntity="Doctrine\Tests\Models\CMS\CmsUser", fetch="eager") */ private $collection; -} +} \ No newline at end of file