handler available for the format.', $e->getMessage() ); } } public function testGetWriterByFormatException() { try { $name = ezcDbSchemaHandlerManager::getWriterByFormat( 'bogus' ); self::fail( 'Expected exception not thrown' ); } catch ( ezcDbSchemaUnknownFormatException $e ) { self::assertEquals( 'There is no handler available for the format.', $e->getMessage() ); } } public function testGetDiffReaderByFormatException() { try { $name = ezcDbSchemaHandlerManager::getDiffReaderByFormat( 'bogus' ); self::fail( 'Expected exception not thrown' ); } catch ( ezcDbSchemaUnknownFormatException $e ) { self::assertEquals( 'There is no handler available for the format.', $e->getMessage() ); } } public function testGetDiffWriterByFormatException() { try { $name = ezcDbSchemaHandlerManager::getDiffWriterByFormat( 'bogus' ); self::fail( 'Expected exception not thrown' ); } catch ( ezcDbSchemaUnknownFormatException $e ) { self::assertEquals( 'There is no handler available for the format.', $e->getMessage() ); } } public function testSupportedFormats1() { $formats = ezcDbSchemaHandlerManager::getSupportedFormats(); self::assertEquals( array( 'array', 'mysql', 'xml', 'persistent' ), $formats ); } public function testSupportedFormats2() { ezcDbSchemaHandlerManager::addReader( 'test1', 'TestSchemaReaderImplementation' ); $formats = ezcDbSchemaHandlerManager::getSupportedFormats(); self::assertEquals( array( 'array', 'mysql', 'xml', 'test1', 'persistent' ), $formats ); } public function testSupportedFormats3() { ezcDbSchemaHandlerManager::addWriter( 'test1', 'TestSchemaWriterImplementation' ); $formats = ezcDbSchemaHandlerManager::getSupportedFormats(); self::assertEquals( array( 'array', 'mysql', 'xml', 'test1', 'persistent' ), $formats ); } public function testSupportedFormats4() { ezcDbSchemaHandlerManager::addReader( 'test1', 'TestSchemaReaderImplementation' ); ezcDbSchemaHandlerManager::addWriter( 'test1', 'TestSchemaWriterImplementation' ); $formats = ezcDbSchemaHandlerManager::getSupportedFormats(); self::assertEquals( array( 'array', 'mysql', 'xml', 'test1', 'persistent' ), $formats ); } public function testSupportedDiffFormats1() { $formats = ezcDbSchemaHandlerManager::getSupportedDiffFormats(); self::assertEquals( array( 'array', 'xml', 'mysql' ), $formats ); } public function testSupportedDiffFormats2() { ezcDbSchemaHandlerManager::addDiffReader( 'test1', 'TestSchemaDiffReaderImplementation' ); $formats = ezcDbSchemaHandlerManager::getSupportedDiffFormats(); self::assertEquals( array( 'array', 'xml', 'test1', 'mysql' ), $formats ); } public function testSupportedDiffFormats3() { ezcDbSchemaHandlerManager::addDiffWriter( 'test1', 'TestSchemaDiffWriterImplementation' ); $formats = ezcDbSchemaHandlerManager::getSupportedDiffFormats(); self::assertEquals( array( 'array', 'xml', 'test1', 'mysql' ), $formats ); } public function testSupportedDiffFormats4() { ezcDbSchemaHandlerManager::addDiffReader( 'test1', 'TestSchemaDiffReaderImplementation' ); ezcDbSchemaHandlerManager::addDiffWriter( 'test1', 'TestSchemaDiffWriterImplementation' ); $formats = ezcDbSchemaHandlerManager::getSupportedDiffFormats(); self::assertEquals( array( 'array', 'xml', 'test1', 'mysql' ), $formats ); } public function testWrongReaderClass1() { try { @ezcDbSchemaHandlerManager::addReader( 'dummy', 'fooBar' ); self::fail( "Expected exception not thrown" ); } catch ( ezcDbSchemaInvalidReaderClassException $e ) { $this->assertEquals( "Class does not exist, or does not implement the interface.", $e->getMessage() ); } } public function testWrongReaderClass2() { try { ezcDbSchemaHandlerManager::addReader( 'dummy', 'stdClass' ); self::fail( "Expected exception not thrown" ); } catch ( ezcDbSchemaInvalidReaderClassException $e ) { $this->assertEquals( "Class does not exist, or does not implement the interface.", $e->getMessage() ); } } public function testWrongWriterClass1() { try { @ezcDbSchemaHandlerManager::addWriter( 'dummy', 'fooBar' ); self::fail( "Expected exception not thrown" ); } catch ( ezcDbSchemaInvalidWriterClassException $e ) { $this->assertEquals( "Class does not exist, or does not implement the interface.", $e->getMessage() ); } } public function testWrongWriterClass2() { try { ezcDbSchemaHandlerManager::addWriter( 'dummy', 'stdClass' ); self::fail( "Expected exception not thrown" ); } catch ( ezcDbSchemaInvalidWriterClassException $e ) { $this->assertEquals( "Class does not exist, or does not implement the interface.", $e->getMessage() ); } } public function testWrongDiffReaderClass1() { try { @ezcDbSchemaHandlerManager::addDiffReader( 'dummy', 'fooBar' ); self::fail( "Expected exception not thrown" ); } catch ( ezcDbSchemaInvalidDiffReaderClassException $e ) { $this->assertEquals( "Class does not exist, or does not implement the interface.", $e->getMessage() ); } } public function testWrongDiffReaderClass2() { try { ezcDbSchemaHandlerManager::addDiffReader( 'dummy', 'stdClass' ); self::fail( "Expected exception not thrown" ); } catch ( ezcDbSchemaInvalidDiffReaderClassException $e ) { $this->assertEquals( "Class does not exist, or does not implement the interface.", $e->getMessage() ); } } public function testWrongDiffWriterClass1() { try { @ezcDbSchemaHandlerManager::addDiffWriter( 'dummy', 'fooBar' ); self::fail( "Expected exception not thrown" ); } catch ( ezcDbSchemaInvalidDiffWriterClassException $e ) { $this->assertEquals( "Class does not exist, or does not implement the interface.", $e->getMessage() ); } } public function testWrongDiffWriterClass2() { try { ezcDbSchemaHandlerManager::addDiffWriter( 'dummy', 'stdClass' ); self::fail( "Expected exception not thrown" ); } catch ( ezcDbSchemaInvalidDiffWriterClassException $e ) { $this->assertEquals( "Class does not exist, or does not implement the interface.", $e->getMessage() ); } } public static function suite() { return new ezcTestSuite( 'ezcDatabaseSchemaHandlerManagerTest' ); } } ?>