Author: kn Date: Wed Feb 6 13:01:57 2008 New Revision: 7302 Log: - Added options class stubs - Added two first test cases for option class
Added: experimental/Document/src/options/ experimental/Document/src/options/document_docbook.php (with props) experimental/Document/src/options/document_ezp3.php (with props) experimental/Document/src/options/document_ezp4.php (with props) experimental/Document/src/options/document_rst.php (with props) experimental/Document/src/options/document_xhtml.php (with props) experimental/Document/src/options/document_xml_base.php (with props) experimental/Document/tests/document_options_xml_base_test.php (with props) experimental/Document/tests/options_test_case.php (with props) Removed: experimental/Document/tests/convert_ezp3_test.php experimental/Document/tests/convert_xhtml_test.php experimental/Document/tests/document_basic_test.php Modified: experimental/Document/design/class_diagram.png experimental/Document/src/document_autoload.php experimental/Document/tests/suite.php Modified: experimental/Document/design/class_diagram.png ============================================================================== Binary files - no diff available. Modified: experimental/Document/src/document_autoload.php ============================================================================== --- experimental/Document/src/document_autoload.php [iso-8859-1] (original) +++ experimental/Document/src/document_autoload.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -14,16 +14,22 @@ 'ezcDocumentConverter' => 'Document/interfaces/converter.php', 'ezcDocumentValidation' => 'Document/interfaces/validation.php', 'ezcDocumentXmlBase' => 'Document/document/xml_base.php', + 'ezcDocumentXmlBaseOptions' => 'Document/options/document_xml_base.php', 'ezcDocumentXsltConverter' => 'Document/converters/xslt.php', 'ezcDocumentDocbook' => 'Document/document/xml/docbook.php', + 'ezcDocumentDocbookOptions' => 'Document/options/document_docbook.php', 'ezcDocumentEzp3ToEzp4Converter' => 'Document/converters/xslt/ezp3_ezp4.php', 'ezcDocumentEzp3Xml' => 'Document/document/xml/ezp3.php', + 'ezcDocumentEzp3XmlOptions' => 'Document/options/document_ezp3.php', 'ezcDocumentEzp4Xml' => 'Document/document/xml/ezp4.php', + 'ezcDocumentEzp4XmlOptions' => 'Document/options/document_ezp4.php', 'ezcDocumentHtmlConversion' => 'Document/interfaces/conversions/html.php', 'ezcDocumentManager' => 'Document/document_manager.php', 'ezcDocumentRelaxNgValidator' => 'Document/validator/realxng.php', 'ezcDocumentRst' => 'Document/document/rst.php', + 'ezcDocumentRstOptions' => 'Document/options/document_rst.php', 'ezcDocumentXhtml' => 'Document/document/xml/xhtml.php', + 'ezcDocumentXhtmlOptions' => 'Document/options/document_xhtml.php', 'ezcDocumentXhtmlToDocbookConverter' => 'Document/converters/xslt/xhtml_docbook.php', ); ?> Added: experimental/Document/src/options/document_docbook.php ============================================================================== --- experimental/Document/src/options/document_docbook.php (added) +++ experimental/Document/src/options/document_docbook.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,0 +1,72 @@ +<?php +/** + * File containing the options class for the ezcDocumentDocbook class + * + * @package Document + * @version //autogen// + * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ + +/** + * Class containing the basic options for the ezcDocumentDocbook class + * + * @property bool $indentXml + * Indent XML on output + * + * @package Document + * @version //autogen// + */ +class ezcDocumentDocbookOptions extends ezcDocumentXmlBaseOptions +{ + /** + * Constructs an object with the specified values. + * + * @throws ezcBasePropertyNotFoundException + * if $options contains a property not defined + * @throws ezcBaseValueException + * if $options contains a property with a value not allowed + * @param array(string=>mixed) $options + */ + public function __construct( array $options = array() ) + { + /* More to come ... + $this->indentXml = false; + */ + + parent::__construct( $options ); + } + + /** + * Sets the option $name to $value. + * + * @throws ezcBasePropertyNotFoundException + * if the property $name is not defined + * @throws ezcBaseValueException + * if $value is not correct for the property $name + * @param string $name + * @param mixed $value + * @ignore + */ + public function __set( $name, $value ) + { + switch ( $name ) + { + /* More to come ... + case 'indentXml': + if ( !is_bool( $value ) ) + { + throw new ezcBaseValueException( $name, $value, 'bool' ); + } + + $this->properties[$name] = (bool) $value; + break; + */ + + default: + parent::__set( $name, $value ); + } + } +} + +?> Propchange: experimental/Document/src/options/document_docbook.php ------------------------------------------------------------------------------ svn:eol-style = native Added: experimental/Document/src/options/document_ezp3.php ============================================================================== --- experimental/Document/src/options/document_ezp3.php (added) +++ experimental/Document/src/options/document_ezp3.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,0 +1,72 @@ +<?php +/** + * File containing the options class for the ezcDocumentEzp3Xml class + * + * @package Document + * @version //autogen// + * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ + +/** + * Class containing the basic options for the ezcDocumentEzp3Xml class + * + * @property bool $indentXml + * Indent XML on output + * + * @package Document + * @version //autogen// + */ +class ezcDocumentEzp3XmlOptions extends ezcDocumentXmlBaseOptions +{ + /** + * Constructs an object with the specified values. + * + * @throws ezcBasePropertyNotFoundException + * if $options contains a property not defined + * @throws ezcBaseValueException + * if $options contains a property with a value not allowed + * @param array(string=>mixed) $options + */ + public function __construct( array $options = array() ) + { + /* More to come ... + $this->indentXml = false; + */ + + parent::__construct( $options ); + } + + /** + * Sets the option $name to $value. + * + * @throws ezcBasePropertyNotFoundException + * if the property $name is not defined + * @throws ezcBaseValueException + * if $value is not correct for the property $name + * @param string $name + * @param mixed $value + * @ignore + */ + public function __set( $name, $value ) + { + switch ( $name ) + { + /* More to come ... + case 'indentXml': + if ( !is_bool( $value ) ) + { + throw new ezcBaseValueException( $name, $value, 'bool' ); + } + + $this->properties[$name] = (bool) $value; + break; + */ + + default: + parent::__set( $name, $value ); + } + } +} + +?> Propchange: experimental/Document/src/options/document_ezp3.php ------------------------------------------------------------------------------ svn:eol-style = native Added: experimental/Document/src/options/document_ezp4.php ============================================================================== --- experimental/Document/src/options/document_ezp4.php (added) +++ experimental/Document/src/options/document_ezp4.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,0 +1,72 @@ +<?php +/** + * File containing the options class for the ezcDocumentEzp4Xml class + * + * @package Document + * @version //autogen// + * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ + +/** + * Class containing the basic options for the ezcDocumentEzp4Xml class + * + * @property bool $indentXml + * Indent XML on output + * + * @package Document + * @version //autogen// + */ +class ezcDocumentEzp4XmlOptions extends ezcDocumentXmlBaseOptions +{ + /** + * Constructs an object with the specified values. + * + * @throws ezcBasePropertyNotFoundException + * if $options contains a property not defined + * @throws ezcBaseValueException + * if $options contains a property with a value not allowed + * @param array(string=>mixed) $options + */ + public function __construct( array $options = array() ) + { + /* More to come ... + $this->indentXml = false; + */ + + parent::__construct( $options ); + } + + /** + * Sets the option $name to $value. + * + * @throws ezcBasePropertyNotFoundException + * if the property $name is not defined + * @throws ezcBaseValueException + * if $value is not correct for the property $name + * @param string $name + * @param mixed $value + * @ignore + */ + public function __set( $name, $value ) + { + switch ( $name ) + { + /* More to come ... + case 'indentXml': + if ( !is_bool( $value ) ) + { + throw new ezcBaseValueException( $name, $value, 'bool' ); + } + + $this->properties[$name] = (bool) $value; + break; + */ + + default: + parent::__set( $name, $value ); + } + } +} + +?> Propchange: experimental/Document/src/options/document_ezp4.php ------------------------------------------------------------------------------ svn:eol-style = native Added: experimental/Document/src/options/document_rst.php ============================================================================== --- experimental/Document/src/options/document_rst.php (added) +++ experimental/Document/src/options/document_rst.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,0 +1,72 @@ +<?php +/** + * File containing the options class for the ezcDocumentRst class + * + * @package Document + * @version //autogen// + * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ + +/** + * Class containing the basic options for the ezcDocumentRst + * + * @property bool $indentXml + * Indent XML on output + * + * @package Document + * @version //autogen// + */ +class ezcDocumentRstOptions extends ezcBaseOptions +{ + /** + * Constructs an object with the specified values. + * + * @throws ezcBasePropertyNotFoundException + * if $options contains a property not defined + * @throws ezcBaseValueException + * if $options contains a property with a value not allowed + * @param array(string=>mixed) $options + */ + public function __construct( array $options = array() ) + { + /* More to come... + $this->indentXml = false; + */ + + parent::__construct( $options ); + } + + /** + * Sets the option $name to $value. + * + * @throws ezcBasePropertyNotFoundException + * if the property $name is not defined + * @throws ezcBaseValueException + * if $value is not correct for the property $name + * @param string $name + * @param mixed $value + * @ignore + */ + public function __set( $name, $value ) + { + switch ( $name ) + { + /* More to come... + case 'indentXml': + if ( !is_bool( $value ) ) + { + throw new ezcBaseValueException( $name, $value, 'bool' ); + } + + $this->properties[$name] = (bool) $value; + break; + */ + + default: + throw new ezcBasePropertyNotFoundException( $name ); + } + } +} + +?> Propchange: experimental/Document/src/options/document_rst.php ------------------------------------------------------------------------------ svn:eol-style = native Added: experimental/Document/src/options/document_xhtml.php ============================================================================== --- experimental/Document/src/options/document_xhtml.php (added) +++ experimental/Document/src/options/document_xhtml.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,0 +1,72 @@ +<?php +/** + * File containing the options class for the ezcDocumentXhtml class + * + * @package Document + * @version //autogen// + * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ + +/** + * Class containing the basic options for the ezcDocumentXhtml class + * + * @property bool $indentXml + * Indent XML on output + * + * @package Document + * @version //autogen// + */ +class ezcDocumentXhtmlOptions extends ezcDocumentXmlBaseOptions +{ + /** + * Constructs an object with the specified values. + * + * @throws ezcBasePropertyNotFoundException + * if $options contains a property not defined + * @throws ezcBaseValueException + * if $options contains a property with a value not allowed + * @param array(string=>mixed) $options + */ + public function __construct( array $options = array() ) + { + /* More to come ... + $this->indentXml = false; + */ + + parent::__construct( $options ); + } + + /** + * Sets the option $name to $value. + * + * @throws ezcBasePropertyNotFoundException + * if the property $name is not defined + * @throws ezcBaseValueException + * if $value is not correct for the property $name + * @param string $name + * @param mixed $value + * @ignore + */ + public function __set( $name, $value ) + { + switch ( $name ) + { + /* More to come ... + case 'indentXml': + if ( !is_bool( $value ) ) + { + throw new ezcBaseValueException( $name, $value, 'bool' ); + } + + $this->properties[$name] = (bool) $value; + break; + */ + + default: + parent::__set( $name, $value ); + } + } +} + +?> Propchange: experimental/Document/src/options/document_xhtml.php ------------------------------------------------------------------------------ svn:eol-style = native Added: experimental/Document/src/options/document_xml_base.php ============================================================================== --- experimental/Document/src/options/document_xml_base.php (added) +++ experimental/Document/src/options/document_xml_base.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,0 +1,68 @@ +<?php +/** + * File containing the options class for the ezcDocumentXmlBase class + * + * @package Document + * @version //autogen// + * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @license http://ez.no/licenses/new_bsd New BSD License + */ + +/** + * Class containing the basic options for the ezcDocumentXmlBase + * + * @property bool $indentXml + * Indent XML on output + * + * @package Document + * @version //autogen// + */ +class ezcDocumentXmlBaseOptions extends ezcBaseOptions +{ + /** + * Constructs an object with the specified values. + * + * @throws ezcBasePropertyNotFoundException + * if $options contains a property not defined + * @throws ezcBaseValueException + * if $options contains a property with a value not allowed + * @param array(string=>mixed) $options + */ + public function __construct( array $options = array() ) + { + $this->indentXml = false; + + parent::__construct( $options ); + } + + /** + * Sets the option $name to $value. + * + * @throws ezcBasePropertyNotFoundException + * if the property $name is not defined + * @throws ezcBaseValueException + * if $value is not correct for the property $name + * @param string $name + * @param mixed $value + * @ignore + */ + public function __set( $name, $value ) + { + switch ( $name ) + { + case 'indentXml': + if ( !is_bool( $value ) ) + { + throw new ezcBaseValueException( $name, $value, 'bool' ); + } + + $this->properties[$name] = (bool) $value; + break; + + default: + throw new ezcBasePropertyNotFoundException( $name ); + } + } +} + +?> Propchange: experimental/Document/src/options/document_xml_base.php ------------------------------------------------------------------------------ svn:eol-style = native Added: experimental/Document/tests/document_options_xml_base_test.php ============================================================================== --- experimental/Document/tests/document_options_xml_base_test.php (added) +++ experimental/Document/tests/document_options_xml_base_test.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,0 +1,50 @@ +<?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 + */ + +require_once dirname( __FILE__ ) . '/options_test_case.php'; + +/** + * Test suite for class. + * + * @package Document + * @subpackage Tests + */ +class ezcDocumentOptionsXmlBaseTests extends ezcDocumentOptionsTestCase +{ + public static function suite() + { + return new PHPUnit_Framework_TestSuite( __CLASS__ ); + } + + public static function provideValidData() + { + return array( + array( + new ezcDocumentXmlBaseOptions(), + 'indentXml', + array( true, false ), + ), + ); + } + + public static function provideInvalidData() + { + return array( + array( + new ezcDocumentXmlBaseOptions(), + 'indentXml', + array( 1, 'foo', .5, new StdClass(), array() ), + ), + ); + } +} + +?> Propchange: experimental/Document/tests/document_options_xml_base_test.php ------------------------------------------------------------------------------ svn:eol-style = native Added: experimental/Document/tests/options_test_case.php ============================================================================== --- experimental/Document/tests/options_test_case.php (added) +++ experimental/Document/tests/options_test_case.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,0 +1,98 @@ +<?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 + */ +abstract class ezcDocumentOptionsTestCase extends ezcTestCase +{ + /** + * Return valid data for options to test + * + * Returned array should be in the format: + * + * <code> + * array( + * array( + * 'optionname', + * array( + * 'value 1', 'value 2', ... + * ), + * ), + * ... + * ) + * </code> + * + * @return void + */ + public static function provideValidData() + { + return array(); + } + + /** + * Return invalid data for options to test + * + * Returned array should be in the format: + * + * <code> + * array( + * array( + * new ezcComponentOptionClass(), + * 'optionname', + * array( + * 'value 1', 'value 2', ... + * ), + * ), + * ... + * ) + * </code> + * + * @return void + */ + public static function provideInvalidData() + { + return array(); + } + + /** + * Test all options provided by the data provider + * + * @dataProvider provideValidData + */ + public function testOptionsValidValues( $option, $property, $values ) + { + $this->assertSetProperty( + $option, + $property, + $values + ); + } + + /** + * Test all options provided by the data provider + * + * @dataProvider provideInvalidData + */ + public function testOptionsInvalidValues( $option, $property, $values ) + { + $this->assertSetPropertyFails( + $option, + $property, + $values + ); + } +} + +?> Propchange: experimental/Document/tests/options_test_case.php ------------------------------------------------------------------------------ svn:eol-style = native Modified: experimental/Document/tests/suite.php ============================================================================== --- experimental/Document/tests/suite.php [iso-8859-1] (original) +++ experimental/Document/tests/suite.php [iso-8859-1] Wed Feb 6 13:01:57 2008 @@ -1,7 +1,6 @@ <?php - /** - * File containing the ezcDocument class + * File containing the ezcDocument test suite * * @package Document * @version //autogen// @@ -15,25 +14,29 @@ /** * Required test suites. */ -require_once 'convert_ezp3_test.php'; -require_once 'convert_xhtml_test.php'; -require_once 'document_basic_test.php'; +// require_once 'convert_ezp3_test.php'; +// require_once 'convert_xhtml_test.php'; + +require_once 'document_options_xml_base_test.php'; class ezcDocumentSuite extends PHPUnit_Framework_TestSuite { + public static function suite() + { + return new ezcDocumentSuite( __CLASS__ ); + } + public function __construct() { parent::__construct(); $this->setName( "Document" ); - $this->addTest( ezcDocumentConvertXhtmlTest::suite() ); - $this->addTest( ezcDocumentConvertEzp3Test::suite() ); - $this->addTest( ezcDocumentDocumentBasicTest::suite() ); - } - public static function suite() - { - return new ezcDocumentSuite( __CLASS__ ); +// $this->addTest( ezcDocumentConvertXhtmlTest::suite() ); +// $this->addTest( ezcDocumentConvertEzp3Test::suite() ); + + $this->addTest( ezcDocumentOptionsXmlBaseTests::suite() ); } } + ?> -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components