/** * Factory method to create a ezcDbSchemaDiff object from the file $file with the format $format. * * @throws ezcDbSchemaInvalidReaderClassException if the handler associated * with the $format is not a file schema reader. * * @param string $format * @param string $file * @return ezcDbSchemaDiff */ public static function createFromFile($format, $file) { $className = ezcDbSchemaHandlerManager::getDiffReaderByFormat($format); $reader = new $className(); self::checkSchemaDiffReader($reader, ezcDbSchema::FILE); return $reader->loadDiffFromFile($file); }
public function testGetDiffReaderByFormatException() { try { $name = ezcDbSchemaHandlerManager::getDiffReaderByFormat('bogus'); self::fail('Expected exception not thrown'); } catch (ezcDbSchemaUnknownFormatException $e) { self::assertEquals("There is no 'difference read' handler available for the 'bogus' format.", $e->getMessage()); } }