public function testGetWriterByFormatException() { try { $name = ezcDbSchemaHandlerManager::getWriterByFormat('bogus'); self::fail('Expected exception not thrown'); } catch (ezcDbSchemaUnknownFormatException $e) { self::assertEquals("There is no 'write' handler available for the 'bogus' format.", $e->getMessage()); } }
/** * Creates the tables defined in the schema into the database specified through $db. * * @throws ezcDbSchemaInvalidWriterClassException if the handler associated * with the $format is not a database schema writer. * * @param ezcDbHandler $db */ public function writeToDb(ezcDbHandler $db) { self::initOptions(); $className = ezcDbSchemaHandlerManager::getWriterByFormat($db->getName()); $writer = new $className(); self::checkSchemaWriter($writer, self::DATABASE); $writer->saveToDb($db, $this); }