/** * @test */ public function doctrineEmbeddablesAreActuallyEmbedded() { /* @var $entityManager ObjectManager */ $entityManager = $this->objectManager->get(ObjectManager::class); $schemaTool = new SchemaTool($entityManager); $metaData = $entityManager->getClassMetadata(Fixtures\TestEntity::class); $this->assertTrue($metaData->hasField('embedded.value'), 'ClassMetadata does not contain embedded value'); $schema = $schemaTool->getSchemaFromMetadata(array($metaData)); $this->assertTrue($schema->getTable('persistence_testentity')->hasColumn('embedded_value'), 'Database schema does not contain embedded value field'); $embeddable = new Fixtures\TestEmbeddable('someValue'); $testEntity = new Fixtures\TestEntity(); $testEntity->setEmbedded($embeddable); $this->testEntityRepository->add($testEntity); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); /* @var $testEntity Fixtures\TestEntity */ $testEntity = $this->testEntityRepository->findAll()->getFirst(); $this->assertEquals('someValue', $testEntity->getEmbedded()->getValue()); }