loadFile( dirname( __FILE__ ) . '/files/xhtml_sample_basic.xml' ); $this->assertTrue( $doc->getDomDocument() instanceof DOMDocument, 'DOMDocument not created properly' ); } public function testLoadXmlDocumentFromString() { $string = file_get_contents( dirname( __FILE__ ) . '/files/xhtml_sample_basic.xml' ); $doc = new ezcDocumentDocbook(); $doc->loadString( $string ); $this->assertTrue( $doc->getDomDocument() instanceof DOMDocument, 'DOMDocument not created properly' ); } public function testLoadErroneousXmlDocument() { $doc = new ezcDocumentDocbook(); try { $doc->loadFile( dirname( __FILE__ ) . '/files/xhtml_sample_errnous.xml' ); } catch ( ezcDocumentErroneousXmlException $e ) { $errors = $e->getXmlErrors(); $this->assertSame( 2, count( $errors ), 'Expected 2 XML errors.' ); } $this->assertTrue( $doc->getDomDocument() instanceof DOMDocument, 'DOMDocument not created properly' ); } public function testLoadErroneousXmlDocumentSilent() { $doc = new ezcDocumentDocbook(); $doc->options->failOnError = false; $doc->loadFile( dirname( __FILE__ ) . '/files/xhtml_sample_errnous.xml' ); $this->assertTrue( $doc->getDomDocument() instanceof DOMDocument, 'DOMDocument not created properly' ); } public function testSerializeXml() { $doc = new ezcDocumentDocbook(); $doc->loadFile( dirname( __FILE__ ) . '/files/xhtml_sample_basic.xml' ); $this->assertEquals( file_get_contents( dirname( __FILE__ ) . '/files/xhtml_sample_basic.xml' ), $doc->save() ); } public function testSerializeXmlFormat() { $doc = new ezcDocumentDocbook(); $doc->options->indentXml = true; $doc->loadFile( dirname( __FILE__ ) . '/files/xhtml_sample_basic.xml' ); $this->assertEquals( file_get_contents( dirname( __FILE__ ) . '/files/xhtml_sample_basic_indented.xml' ), $doc->save() ); } } ?>