_createSchemaTool($fixtureName, $this->_createPlatform()); } abstract protected function _createPlatform(); private function _createSchemaTool($fixtureName, $platform) { $fixture = include __DIR__."/DbFixture/".$fixtureName.".php"; $sm = new UpdateSchemaMock($fixture); $this->_em = $this->_getTestEntityManager(null, null, null, false); $this->_em->getConnection()->setDatabasePlatform($platform); $this->_em->getConnection()->getDriver()->setSchemaManager($sm); return new SchemaTool($this->_em); } /** * @param string $className * @return \Doctrine\ORM\Mapping\ClassMetadata */ protected function _getMetadataFor($className) { return $this->_em->getClassMetadata($className); } } class UpdateSchemaMock extends \Doctrine\DBAL\Schema\AbstractSchemaManager { private $_fixtureData; public function __construct($fixtureData) { $this->_fixtureData = $fixtureData; } public function listTables() { return array_keys($this->_fixtureData); } public function listTableColumns($tableName) { return $this->_fixtureData[$tableName]; } }