Author: ks
Date: Wed Sep 26 15:25:11 2007
New Revision: 6285
Log:
- Added a new test and some minor fixes.
Added:
experimental/Document/tests/convert_xhtml_test.php
experimental/Document/tests/document_basic_test.php
Removed:
experimental/Document/tests/convert_xhtml.php
Modified:
experimental/Document/src/converters/xhtml_docbook.php
experimental/Document/tests/files/docbook_sample.xml
experimental/Document/tests/files/xhtml_sample.xml
experimental/Document/tests/suite.php
Modified: experimental/Document/src/converters/xhtml_docbook.php
==============================================================================
--- experimental/Document/src/converters/xhtml_docbook.php [iso-8859-1]
(original)
+++ experimental/Document/src/converters/xhtml_docbook.php [iso-8859-1] Wed Sep
26 15:25:11 2007
@@ -56,7 +56,7 @@
if ( !ezcDocumentXhtmlToDocbook::$xslt )
{
ezcDocumentXhtmlToDocbook::$xslt = new DOMDocument;
- ezcDocumentXhtmlToDocbook::$xslt->load(
'Document/src/converters/xhtml_docbook.xsl' );
+ ezcDocumentXhtmlToDocbook::$xslt->load( dirname( __FILE__ ) .
'/../converters/xhtml_docbook.xsl' );
}
ezcDocumentXhtmlToDocbook::$proc = new XSLTProcessor;
ezcDocumentXhtmlToDocbook::$proc->importStyleSheet(
ezcDocumentXhtmlToDocbook::$xslt );
Added: experimental/Document/tests/convert_xhtml_test.php
==============================================================================
--- experimental/Document/tests/convert_xhtml_test.php (added)
+++ experimental/Document/tests/convert_xhtml_test.php [iso-8859-1] Wed Sep 26
15:25:11 2007
@@ -1,0 +1,39 @@
+<?php
+/**
+ * ezcDocTestConvertXhtmlDocbook
+ *
+ * @package Document
+ * @version //autogen//
+ * @subpackage Tests
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * Test suite for class.
+ *
+ * @package Document
+ * @subpackage Tests
+ */
+class ezcDocumentConvertXhtmlTest extends ezcTestCase
+{
+ public function testDocumentXHtmlToDocbook()
+ {
+ $xhtml = file_get_contents( dirname( __FILE__ ) .
'/files/xhtml_sample.xml' );
+ $docbook = file_get_contents( dirname( __FILE__ ) .
'/files/docbook_sample.xml' );
+
+ $docXhtml = new ezcDocumentXML( 'xhtml', $xhtml );
+ $converter = new ezcDocumentXhtmlToDocbook;
+ $docDocbook = $converter->convert( $docXhtml );
+ $result = $docDocbook->getXML();
+
+ self::assertEquals( $docbook, $result, 'Converting XHTML to DocBook
failed.' );
+
+ }
+
+ public static function suite()
+ {
+ return new PHPUnit_Framework_TestSuite( "ezcDocumentConvertXhtmlTest"
);
+ }
+}
+?>
Added: experimental/Document/tests/document_basic_test.php
==============================================================================
--- experimental/Document/tests/document_basic_test.php (added)
+++ experimental/Document/tests/document_basic_test.php [iso-8859-1] Wed Sep 26
15:25:11 2007
@@ -1,0 +1,38 @@
+<?php
+/**
+ * ezcDocTestConvertXhtmlDocbook
+ *
+ * @package Document
+ * @version //autogen//
+ * @subpackage Tests
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * Test suite for class.
+ *
+ * @package Document
+ * @subpackage Tests
+ */
+class ezcDocumentDocumentBasicTest extends ezcTestCase
+{
+ public function testXMLDocumentCreation()
+ {
+ $xhtmlXML = file_get_contents( dirname( __FILE__ ) .
'/files/xhtml_sample.xml' );
+
+ $docXhtml = new ezcDocumentXML( 'xhtml', $xhtmlXML );
+ $xhtmlDOM = $docXhtml->getDOM();
+
+ $docXhtml2 = new ezcDocumentXML( 'xhtml', $xhtmlDOM );
+ $xhtmlXML2 = $docXhtml2->getXML();
+
+ self::assertEquals( $xhtmlXML, $xhtmlXML2, 'Creating XML document
failed.' );
+ }
+
+ public static function suite()
+ {
+ return new PHPUnit_Framework_TestSuite( "ezcDocumentDocumentBasicTest"
);
+ }
+}
+?>
Modified: experimental/Document/tests/files/docbook_sample.xml
==============================================================================
--- experimental/Document/tests/files/docbook_sample.xml [iso-8859-1] (original)
+++ experimental/Document/tests/files/docbook_sample.xml [iso-8859-1] Wed Sep
26 15:25:11 2007
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
+<articleinfo><title>Test document</title></articleinfo>
<section><title>Header 1</title><para>
Para 1
</para><para>
Modified: experimental/Document/tests/files/xhtml_sample.xml
==============================================================================
--- experimental/Document/tests/files/xhtml_sample.xml [iso-8859-1] (original)
+++ experimental/Document/tests/files/xhtml_sample.xml [iso-8859-1] Wed Sep 26
15:25:11 2007
@@ -1,6 +1,7 @@
+<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
+<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test document</title>
</head>
<body>
@@ -22,7 +23,7 @@
</p>
</li>
<li>List item 2</li>
- <li>List item 2 line 1<br/>line 2</li>
+ <li>List item 2 line 1<br />line 2</li>
</ul>
</body>
</html>
Modified: experimental/Document/tests/suite.php
==============================================================================
--- experimental/Document/tests/suite.php [iso-8859-1] (original)
+++ experimental/Document/tests/suite.php [iso-8859-1] Wed Sep 26 15:25:11 2007
@@ -13,9 +13,10 @@
*/
/**
-* Requires conversion test suites.
+* Required test suites.
*/
-require_once 'convert_xhtml.php';
+require_once 'convert_xhtml_test.php';
+require_once 'document_basic_test.php';
class ezcDocumentSuite extends PHPUnit_Framework_TestSuite
@@ -25,6 +26,7 @@
parent::__construct();
$this->setName( "Document" );
$this->addTest( ezcDocumentConvertXhtmlTest::suite() );
+ $this->addTest( ezcDocumentDocumentBasicTest::suite() );
}
public static function suite()
--
svn-components mailing list
[EMAIL PROTECTED]
http://lists.ez.no/mailman/listinfo/svn-components