cvs: pear /XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord throwConfigException_element1.phpt throwConfigException_element2.phpt
throwConfigException_idcolumn.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord throwConfigException_dataOptionWrongType.phpt
throwConfigException_mergeMasterFalse.phpt throwConfigException_mergeMasterTrue.phpt throwConfigException_mergeselectiveOptionWrongType.phpt
throwConfigException_queryOptionMissing.phpt throwConfigException_sqlOptionWrongType.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement
throwXMLException_elementInvalid1.phpt throwXMLException_elementInvalid2.phpt throwXMLException_roottagOptionInvalid1.phpt
throwXMLException_roottagOptionInvalid2.phpt throwXMLException_rowtagOptionInvalid.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord
throwConfigException_attributeSpecWrongType.phpt throwConfigException_attributesOptionWrongType.phpt throwConfigException_elementsOp!
tionWrongType.phpt throwConfigException_idcolumnOptionMissing.phpt throwConfigException_mapperNotCallableFunction.phpt
throwConfigException_mapperNotCallableNonstaticMethod.phpt throwConfigException_mapperNotCallableStaticMethod1.phpt
throwConfigException_mapperNotCallableStaticMethod2.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName throwXMLException.phpt
/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute throwDBException_complexQuery.phpt throwDBException_simpleQuery.phpt
/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification rethrowConfigException.phpt throwConfigException_valueOptionMissing.phpt
/XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling clearProfiling.phpt /XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog disableDebugLog.phpt
/XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog enableDebugLog.phpt /XML_Query2XML/tests/XML_Query2XML/DB/factory throwDBException.phpt
/XML_Query2XML/tests/XML_Query2XML/DB/! getFlatXML case01.phpt simpleSelect.phpt throwDBException.phpt
/XML_Query2XML/tests/XML_Query2XML/DB/getProfile getProfile.phpt /XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile getRawProfile.phpt
/XML_Query2XML/tests/XML_Query2XML/DB/getXML asteriskShortcut_attributes1.phpt asteriskShortcut_attributes2.phpt asteriskSho
| From: | Lukas Feiler | Date: | Fri, 27 Oct 2006 23:07:03 +0000 |
| Subject: | cvs: pear /XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord throwConfigException_element1.phpt throwConfigException_element2.phpt throwConfigException_idcolumn.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord throwConfigException_dataOptionWrongType.phpt throwConfigException_mergeMasterFalse.phpt throwConfigException_mergeMasterTrue.phpt throwConfigException_mergeselectiveOptionWrongType.phpt throwConfigException_queryOptionMissing.phpt throwConfigException_sqlOptionWrongType.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement throwXMLException_elementInvalid1.phpt throwXMLException_elementInvalid2.phpt throwXMLException_roottagOptionInvalid1.phpt throwXMLException_roottagOptionInvalid2.phpt throwXMLException_rowtagOptionInvalid.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord throwConfigException_attributeSpecWrongType.phpt throwConfigException_attributesOptionWrongType.phpt throwConfigException_elementsOp! tionWrongType.phpt throwConfigException_idcolumnOptionMissing.phpt throwConfigException_mapperNotCallableFunction.phpt throwConfigException_mapperNotCallableNonstaticMethod.phpt throwConfigException_mapperNotCallableStaticMethod1.phpt throwConfigException_mapperNotCallableStaticMethod2.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName throwXMLException.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute throwDBException_complexQuery.phpt throwDBException_simpleQuery.phpt /XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification rethrowConfigException.phpt throwConfigException_valueOptionMissing.phpt /XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling clearProfiling.phpt /XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog disableDebugLog.phpt /XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog enableDebugLog.phpt /XML_Query2XML/tests/XML_Query2XML/DB/factory throwDBException.phpt /XML_Query2XML/tests/XML_Query2XML/DB/! getFlatXML case01.phpt simpleSelect.phpt throwDBException.phpt /XML_Query2XML/tests/XML_Query2XML/DB/getProfile getProfile.phpt /XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile getRawProfile.phpt /XML_Query2XML/tests/XML_Query2XML/DB/getXML asteriskShortcut_attributes1.phpt asteriskShortcut_attributes2.phpt asteriskSho |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-42845@lists.php.net to get a copy of this message | ||
lukasfeiler Fri Oct 27 23:07:03 2006 UTC
Added files:
/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord
throwConfigException_element1.phpt
throwConfigException_element2.phpt
throwConfigException_idcolumn.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord
throwConfigException_dataOptionWrongType.phpt
throwConfigException_mergeMasterFalse.phpt
throwConfigException_mergeMasterTrue.phpt
throwConfigException_mergeselectiveOptionWrongType.phpt
throwConfigException_queryOptionMissing.phpt
throwConfigException_sqlOptionWrongType.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement
throwXMLException_elementInvalid1.phpt
throwXMLException_elementInvalid2.phpt
throwXMLException_roottagOptionInvalid1.phpt
throwXMLException_roottagOptionInvalid2.phpt
throwXMLException_rowtagOptionInvalid.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord
throwConfigException_attributeSpecWrongType.phpt
throwConfigException_attributesOptionWrongType.phpt
throwConfigException_elementsOptionWrongType.phpt
throwConfigException_idcolumnOptionMissing.phpt
throwConfigException_mapperNotCallableFunction.phpt
throwConfigException_mapperNotCallableNonstaticMethod.phpt
throwConfigException_mapperNotCallableStaticMethod1.phpt
throwConfigException_mapperNotCallableStaticMethod2.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName
throwXMLException.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute
throwDBException_complexQuery.phpt
throwDBException_simpleQuery.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification
rethrowConfigException.phpt
throwConfigException_valueOptionMissing.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling
clearProfiling.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog
disableDebugLog.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog
enableDebugLog.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/factory
throwDBException.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML case01.phpt
simpleSelect.phpt
throwDBException.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/getProfile
getProfile.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile
getRawProfile.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML
asteriskShortcut_attributes1.phpt
asteriskShortcut_attributes2.phpt
asteriskShortcut_attributes3.phpt
asteriskShortcut_attributes4.phpt
asteriskShortcut_attributes5.phpt
asteriskShortcut_attributes6.phpt
asteriskShortcut_elements1.phpt
asteriskShortcut_elements2.phpt
asteriskShortcut_elements3.phpt
asteriskShortcut_elements4.phpt
asteriskShortcut_elements5.phpt
asteriskShortcut_elements6.phpt
case02.phpt
case03.phpt
case04.phpt
case05.phpt
case06.phpt
case07.phpt
case08.phpt
complexAttributeSpecification_complexQuerySpecification.phpt
complexAttributeSpecification_complexQuerySpecification_valuePHPCode.phpt
complexAttributeSpecification_conditionOption.phpt
complexAttributeSpecification_simpleQuerySpecification.phpt
complexAttributeSpecification_valuePrefixes.phpt
complexElementSpecification_conditionOption1.phpt
complexElementSpecification_conditionOption2.phpt
conditionPrefix_attribute_columnName.phpt
conditionPrefix_attribute_phpCode.phpt
conditionPrefix_attribute_staticText.phpt
conditionPrefix_element_columnName.phpt
conditionPrefix_element_phpCode.phpt
conditionPrefix_element_staticText.phpt
conditionPrefix_value_columnName.phpt
conditionPrefix_value_phpCode.phpt
conditionPrefix_value_staticText.phpt
throwDBException.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/startProfiling
startProfiling.phpt
/pear/XML_Query2XML/tests/XML_Query2XML/DB/stopProfiling
stopProfiling.phpt
Log:
migrated from PHPUnit2 to phpt
http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element1.phpt --TEST-- XML_Query2XML::_applyColumnStringToRecord(): check for XML_Query2XML_ConfigException - non-existing column name used in "elements" --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid ', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: The column "artistid " used in the option "elements" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element2.phpt --TEST-- XML_Query2XML::_applyColumnStringToRecord(): check for XML_Query2XML_ConfigException - non existing column name used in "elements" --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid ', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The column "albumid " used in the option "elements" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_idcolumn.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_idcolumn.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_idcolumn.phpt --TEST-- XML_Query2XML::_applyColumnStringToRecord(): check for XML_Query2XML_ConfigException - non-existing column used as idColumn --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid ', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: The column "artistid " used in the option "idColumn" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_dataOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_dataOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_dataOptionWrongType.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - "data" not an array --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => 1, 'query' => 'SELECT * FROM some_table' ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql]: The configuration option "data" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterFalse.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterFalse.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterFalse.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - non existing column in "merge_selective" with marge_master=false --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'merge_master' => false, 'merge_selective' => array('genre ') ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql_options]: The column "genre " used in the option "merge_selective" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterTrue.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterTrue.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterTrue.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - non existing column in "merge_selective" with marge_master=true --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'merge_master' => true, 'merge_selective' => array('genre ') ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql_options]: The column "genre " used in the option "merge_selective" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeselectiveOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeselectiveOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeselectiveOptionWrongType.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - "merge_selective" not an array --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'merge_master' => true, 'merge_selective' => 1 ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql_options]: The configuration option "merge_selective" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_queryOptionMissing.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_queryOptionMissing.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_queryOptionMissing.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - "query" missing --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array(), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql]: The configuration option "query" is missing. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_sqlOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_sqlOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_sqlOptionWrongType.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - "sql" not an array or string --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => 1, 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The configuration option "sql" is not an array or a string. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid1.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for element --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid ' => 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "artistid " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid2.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for element --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid ' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "albumid " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid1.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for rootTag --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library ', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "music_library " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid2.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for rootTag --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums ', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "albums " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_rowtagOptionInvalid.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_rowtagOptionInvalid.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_rowtagOptionInvalid.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for rowTag --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist ', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "artist " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributeSpecWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributeSpecWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributeSpecWrongType.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - attribute is not defined using an array or a string --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => 3 ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [attributes]: The attribute "genre" was not specified using a string nor an array http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributesOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributesOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributesOptionWrongType.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - "attributes" is not an array --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'attributes' => 1 ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The configuration option "attributes" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_elementsOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_elementsOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_elementsOptionWrongType.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - "elements" is not an array --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => 1 ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The configuration option "elements" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_idcolumnOptionMissing.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_idcolumnOptionMissing.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_idcolumnOptionMissing.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - "idColumn" missing --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn ' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: The configuration option "idColumn" is missing. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableFunction.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableFunction.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableFunction.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - mapper function not callable --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'mapper' => 'noSuchFunction', 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The method/function "noSuchFunction" specified in the configuration option "mapper" is not callable. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableNonstaticMethod.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableNonstaticMethod.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableNonstaticMethod.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - non-static mapper method not callable --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php class Mapper { } require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'mapper' => array(new Mapper(), 'noSuchMethod'), 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The method/function "Mapper::noSuchMethod" specified in the configuration option "mapper" is not callable. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod1.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - static mapper method not callable --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'mapper' => 'No:suchMethod', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: The method/function "No:suchMethod" specified in the configuration option "mapper" is not callable. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod2.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - static mapper method not callable --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'mapper' => 'No:suchMethod', 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The method/function "No:suchMethod" specified in the configuration option "mapper" is not callable. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName/throwXMLException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName/throwXMLException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName/throwXMLException.phpt --TEST-- XML_Query2XML::_mapSQLIdentifierToXMLName(): check for XML_Query2XML_ConfigException - mapper function throwing exception --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php class Helper { public function throwException($str) { throw new Exception('Throwing exception for ' . $str); } } require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'mapper' => array('Helper', 'throwException'), 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: Could not map "artistid" to an XML name using the mapper Helper::throwException: Throwing exception for artistid http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_complexQuery.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_complexQuery.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_complexQuery.phpt --TEST-- XML_Query2XML::_prepareAndExecute(): check for XML_Query2XML_DBException - Complex Query Specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'query' => 'SELECT * FROM non_existing_table' ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 75); } ?> --EXPECT-- XML_Query2XML_DBException: Could not execute the following SQL query: SELECT * FROM non_existing_table http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_simpleQuery.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_simpleQuery.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_simpleQuery.phpt --TEST-- XML_Query2XML::_prepareAndExecute(): check for XML_Query2XML_DBException - Simple Query Specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => 'SELECT * FROM non_existing_table', 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 71); } ?> --EXPECT-- XML_Query2XML_DBException: Could not run the following SQL query: SELECT * FROM non_existing_table http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/rethrowConfigException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/rethrowConfigException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/rethrowConfigException.phpt --TEST-- XML_Query2XML::_processComplexElementSpecification(): check for XML_Query2XML_ConfigException - bubbling up --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'albums' => array( 'elements' => array( 'sub1' => array( 'elements' => array( 'sub2' => array( 'elements' => array( 'sub3' => array( 'sql' => array( 'data' => 1, 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), ) ) ) ) ) ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][elements][sub1][elements][sub2][elements][sub3][sql]: The configuration option "data" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/throwConfigException_valueOptionMissing.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/throwConfigException_valueOptionMissing.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/throwConfigException_valueOptionMissing.phpt --TEST-- XML_Query2XML::_processComplexElementSpecification(): check for XML_Query2XML_ConfigException - missing "value" option --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => array( 'condition' => '$record["genre"] == "Soul"', ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [attributes][genre]: The option "value" is missing from the complex attribute specification http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling/clearProfiling.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling/clearProfiling.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling/clearProfiling.phpt --TEST-- XML_Query2XML::clearProfile() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $query2xml->clearProfile(); print count($query2xml->getRawProfile()); $query2xml->clearProfile(); ?> --EXPECT-- 0 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog/disableDebugLog.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog/disableDebugLog.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog/disableDebugLog.phpt --TEST-- XML_Query2XML::disableDebugLog() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php class MyLogger { public $data = ''; public function log($str) { $this->data .= $str . "\n"; } } require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $debugLogger = new MyLogger(); $query2xml->enableDebugLog($debugLogger); $query2xml->disableDebugLog(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); print strlen($debugLogger->data); ?> --EXPECT-- 0 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog/enableDebugLog.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog/enableDebugLog.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog/enableDebugLog.phpt --TEST-- XML_Query2XML::enableDebugLog() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php class MyLogger { public $data = ''; public function log($str) { $this->data .= $str . "\n"; } } require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $debugLogger = new MyLogger(); $query2xml->enableDebugLog($debugLogger); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $query2xml->disableDebugLog(); echo $debugLogger->data; ?> --EXPECT-- QUERY: SELECT * FROM artist DONE QUERY: SELECT * FROM album WHERE artist_id = ? DONE QUERY: SELECT * FROM album WHERE artist_id = ? DONE QUERY: SELECT * FROM album WHERE artist_id = ? DONE http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/factory/throwDBException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/factory/throwDBException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/factory/throwDBException.phpt --TEST-- XML_Query2XML::factory(): check for XML_Query2XML_DBException --SKIPIF-- <?php chdir(dirname(dirname(__FILE__))); require_once './skipif.php'; ?> --FILE-- <?php require_once('DB.php'); require_once('XML/Query2XML.php'); $db = DB::connect('mysql://bogususer@256.256.256.256/bugusdb'); try { $query2xml =& XML_Query2XML::factory($db); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 30); } ?> --EXPECT-- XML_Query2XML_DBException: Could not connect to database: http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/case01.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/case01.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/case01.phpt --TEST-- XML_Query2XML::getFlatXML(): Case01 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getFlatXML("SELECT * FROM artist", 'music_library', 'artist'); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_library> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> <artist> <artistid>3</artistid> <name>Ray Charles</name> <birth_year>1930</birth_year> <birth_place>Mississippi</birth_place> <genre>Country and Soul</genre> </artist> </music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/simpleSelect.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/simpleSelect.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/simpleSelect.phpt --TEST-- XML_Query2XML::getFlatXML(): simple select --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getFlatXML('SELECT * FROM album'); echo $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <root><row><albumid>1</albumid><artist_id>1</artist_id><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></row><row><albumid>2</albumid><artist_id>1</artist_id><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></row><row><albumid>3</albumid><artist_id>2</artist_id><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></row></root> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/throwDBException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/throwDBException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/throwDBException.phpt --TEST-- XML_Query2XML::getFlatXML(): check for XML_Query2XML_DBException --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getFlatXML('SELECT * FROM non_existing_table'); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 71); } ?> --EXPECT-- XML_Query2XML_DBException: Could not run the following SQL query: SELECT * FROM non_existing_table http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getProfile/getProfile.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getProfile/getProfile.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getProfile/getProfile.phpt --TEST-- XML_Query2XML::getProfile() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $profile = $query2xml->getProfile(); print preg_match_all('/SELECT/', $profile, $matches); ?> --EXPECT-- 2 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile/getRawProfile.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile/getRawProfile.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile/getRawProfile.phpt --TEST-- XML_Query2XML::getRawProfile() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $rawProfile = $query2xml->getRawProfile(); print count($rawProfile['queries']) ?> --EXPECT-- 2 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes1.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - simple --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="Soul"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="Soul"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="Country and Soul"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes2.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - as placeholder --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'ATTR1_*' => ':STATIC_VALUE', 'ATTR2_*' => ':VALUE_*', 'ATTR3_*' => '!return "--" . $record["*"] . "--";' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="Soul" ATTR1_artistid="STATIC_VALUE" ATTR1_name="STATIC_VALUE" ATTR1_birth_year="STATIC_VALUE" ATTR1_birth_place="STATIC_VALUE" ATTR1_genre="STATIC_VALUE" ATTR2_artistid="VALUE_artistid" ATTR2_name="VALUE_name" ATTR2_birth_year="VALUE_birth_year" ATTR2_birth_place="VALUE_birth_place" ATTR2_genre="VALUE_genre" ATTR3_artistid="--1--" ATTR3_name="--Curtis Mayfield--" ATTR3_birth_year="--1920--" ATTR3_birth_place="--Chicago--" ATTR3_genre="--Soul--"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="Soul" ATTR1_artistid="STATIC_VALUE" ATTR1_name="STATIC_VALUE" ATTR1_birth_year="STATIC_VALUE" ATTR1_birth_place="STATIC_VALUE" ATTR1_genre="STATIC_VALUE" ATTR2_artistid="VALUE_artistid" ATTR2_name="VALUE_name" ATTR2_birth_year="VALUE_birth_year" ATTR2_birth_place="VALUE_birth_place" ATTR2_genre="VALUE_genre" ATTR3_artistid="--2--" ATTR3_name=! "--Isaac Hayes--" ATTR3_birth_year="--1942--" ATTR3_birth_place="--Tennessee--" ATTR3_genre="--Soul--"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="Country and Soul" ATTR1_artistid="STATIC_VALUE" ATTR1_name="STATIC_VALUE" ATTR1_birth_year="STATIC_VALUE" ATTR1_birth_place="STATIC_VALUE" ATTR1_genre="STATIC_VALUE" ATTR2_artistid="VALUE_artistid" ATTR2_name="VALUE_name" ATTR2_birth_year="VALUE_birth_year" ATTR2_birth_place="VALUE_birth_place" ATTR2_genre="VALUE_genre" ATTR3_artistid="--3--" ATTR3_name="--Ray Charles--" ATTR3_birth_year="--1930--" ATTR3_birth_place="--Mississippi--" ATTR3_genre="--Country and Soul--"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes3.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes3.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes3.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - overwriting with simple attribute specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => '!return strtoupper($record["genre"]);' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="SOUL"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="SOUL"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="COUNTRY AND SOUL"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes4.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes4.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes4.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - overwriting with complex attribute specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => array( 'value' => '!return strtoupper($record["genre"]);' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="SOUL"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="SOUL"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="COUNTRY AND SOUL"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes5.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes5.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes5.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - supressing single attribute using '?:' --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => '?:' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes6.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes6.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes6.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - supressing single attribute using "condition" --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => array( 'condition' => 'false' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements1.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - simple --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements2.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - as placeholder --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'TAG1_*' => ':STATIC_VALUE', 'TAG2_*' => ':VALUE_*', 'TAG3_*' => '!return "--" . $record["*"] . "--";' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><TAG1_artistid>STATIC_VALUE</TAG1_artistid><TAG1_name>STATIC_VALUE</TAG1_name><TAG1_birth_year>STATIC_VALUE</TAG1_birth_year><TAG1_birth_place>STATIC_VALUE</TAG1_birth_place><TAG1_genre>STATIC_VALUE</TAG1_genre><TAG2_artistid>VALUE_artistid</TAG2_artistid><TAG2_name>VALUE_name</TAG2_name><TAG2_birth_year>VALUE_birth_year</TAG2_birth_year><TAG2_birth_place>VALUE_birth_place</TAG2_birth_place><TAG2_genre>VALUE_genre</TAG2_genre><TAG3_artistid>--1--</TAG3_artistid><TAG3_name>--Curtis Mayfield--</TAG3_name><TAG3_birth_year>--1920--</TAG3_birth_year><TAG3_birth_place>--Chicago--</TAG3_birth_place><TAG3_genre>--Soul--</TAG3_genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><TAG1_artistid>STATIC_VALUE</TAG1_artistid><TAG1_name>S! TATIC_VALUE</TAG1_name><TAG1_birth_year>STATIC_VALUE</TAG1_birth_year><TAG1_birth_place>STATIC_VALUE</TAG1_birth_place><TAG1_genre>STATIC_VALUE</TAG1_genre><TAG2_artistid>VALUE_artistid</TAG2_artistid><TAG2_name>VALUE_name</TAG2_name><TAG2_birth_year>VALUE_birth_year</TAG2_birth_year><TAG2_birth_place>VALUE_birth_place</TAG2_birth_place><TAG2_genre>VALUE_genre</TAG2_genre><TAG3_artistid>--2--</TAG3_artistid><TAG3_name>--Isaac Hayes--</TAG3_name><TAG3_birth_year>--1942--</TAG3_birth_year><TAG3_birth_place>--Tennessee--</TAG3_birth_place><TAG3_genre>--Soul--</TAG3_genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><TAG1_artistid>STATIC_VALUE</TAG1_artistid><TAG1_name>STATIC_VALUE</TAG1_name><TAG1_birth_year>STATIC_VALUE</TAG1_birth_year><TAG1_birth_place>STATIC_VALUE</TAG1_birth_place><TAG1_genre>STATIC_VALUE</TAG1_genre><TAG2_artistid>VALUE_artistid</TAG2_artis! tid><TAG2_name>VALUE_name</TAG2_name><TAG2_birth_year>VALUE_birth_year </TAG2_birth_year><TAG2_birth_place>VALUE_birth_place</TAG2_birth_place><TAG2_genre>VALUE_genre</TAG2_genre><TAG3_artistid>--3--</TAG3_artistid><TAG3_name>--Ray Charles--</TAG3_name><TAG3_birth_year>--1930--</TAG3_birth_year><TAG3_birth_place>--Mississippi--</TAG3_birth_place><TAG3_genre>--Country and Soul--</TAG3_genre></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements3.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements3.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements3.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - overwriting with simple element specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'genre' => '!return strtoupper($record["genre"]);' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>SOUL</genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>SOUL</genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>COUNTRY AND SOUL</genre></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements4.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements4.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements4.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - overwriting with complex element specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'genre' => array( 'value' => '!return strtoupper($record["genre"]);' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>SOUL</genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>SOUL</genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>COUNTRY AND SOUL</genre></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements5.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements5.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements5.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - supressing single element using '?:' --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'genre' => '?:' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements6.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements6.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements6.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - supressing single element using "condition" --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'genre' => array( 'condition' => 'false' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case02.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case02.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case02.phpt --TEST-- XML_Query2XML::getXML(): Case02 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_library> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> <albums> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> </album> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> </album> </albums> </artist> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> <albums> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> </album> </albums> </artist> <artist> <artistid>3</artistid> <name>Ray Charles</name> <birth_year>1930</birth_year> <birth_place>Mississippi</birth_place> <genre>Country and Soul</genre> <albums /> </artist> </music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case03.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case03.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case03.phpt --TEST-- XML_Query2XML::getXML(): Case03 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_library> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> <albums> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> </album> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> </album> </albums> </artist> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> <albums> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> </album> </albums> </artist> <artist> <artistid>3</artistid> <name>Ray Charles</name> <birth_year>1930</birth_year> <birth_place>Mississippi</birth_place> <genre>Country and Soul</genre> <albums /> </artist> </music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case04.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case04.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case04.phpt --TEST-- XML_Query2XML::getXML(): Case04 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'MUSIC_LIBRARY', 'rowTag' => 'ARTIST', 'idColumn' => 'artistid', 'elements' => array( 'NAME' => 'name', 'BIRTH_YEAR' => 'birth_year', 'BIRTH_YEAR_TWO_DIGIT' => "!return substr(\"{\$record['birth_year']}\", 2);", 'BIRTH_PLACE' => 'birth_place', 'GENRE' => 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => true, 'merge_master' => false ), 'rootTag' => '', 'rowTag' => 'ALBUM', 'idColumn' => 'albumid', 'elements' => array( 'TITLE' => 'title', 'PUBLISHED_YEAR' => 'published_year', 'COMMENT' => 'comment', 'GENRE' => 'genre' ), 'attributes' => array( 'ALBUMID' => 'albumid' ) ) ), 'attributes' => array( 'ARTISTID' => 'artistid', 'MAINTAINER' => ':Lukas Feiler' ) ) ); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <MUSIC_LIBRARY> <ARTIST ARTISTID="1" MAINTAINER="Lukas Feiler"> <NAME>Curtis Mayfield</NAME> <BIRTH_YEAR>1920</BIRTH_YEAR> <BIRTH_YEAR_TWO_DIGIT>20</BIRTH_YEAR_TWO_DIGIT> <BIRTH_PLACE>Chicago</BIRTH_PLACE> <GENRE>Soul</GENRE> <ALBUM ALBUMID="1"> <TITLE>New World Order</TITLE> <PUBLISHED_YEAR>1990</PUBLISHED_YEAR> <COMMENT>the best ever!</COMMENT> <GENRE>Soul</GENRE> </ALBUM> <ALBUM ALBUMID="2"> <TITLE>Curtis</TITLE> <PUBLISHED_YEAR>1970</PUBLISHED_YEAR> <COMMENT>that man's got somthin' to say</COMMENT> <GENRE>Soul</GENRE> </ALBUM> </ARTIST> <ARTIST ARTISTID="2" MAINTAINER="Lukas Feiler"> <NAME>Isaac Hayes</NAME> <BIRTH_YEAR>1942</BIRTH_YEAR> <BIRTH_YEAR_TWO_DIGIT>42</BIRTH_YEAR_TWO_DIGIT> <BIRTH_PLACE>Tennessee</BIRTH_PLACE> <GENRE>Soul</GENRE> <ALBUM ALBUMID="3"> <TITLE>Shaft</TITLE> <PUBLISHED_YEAR>1972</PUBLISHED_YEAR> <COMMENT>he's the man</COMMENT> <GENRE>Soul</GENRE> </ALBUM> </ARTIST> <ARTIST ARTISTID="3" MAINTAINER="Lukas Feiler"> <NAME>Ray Charles</NAME> <BIRTH_YEAR>1930</BIRTH_YEAR> <BIRTH_YEAR_TWO_DIGIT>30</BIRTH_YEAR_TWO_DIGIT> <BIRTH_PLACE>Mississippi</BIRTH_PLACE> <GENRE>Country and Soul</GENRE> </ARTIST> </MUSIC_LIBRARY> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case05.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case05.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case05.phpt --TEST-- XML_Query2XML::getXML(): Case05 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM customer c LEFT JOIN sale s ON c.customerid = s.customer_id LEFT JOIN album al ON s.album_id = al.albumid LEFT JOIN artist ar ON al.artist_id = ar.artistid", array( 'rootTag' => 'music_store', 'rowTag' => 'customer', 'idColumn' => 'customerid', 'elements' => array( 'customerid', 'first_name', 'last_name', 'email', 'sales' => array( 'rootTag' => 'sales', 'rowTag' => 'sale', 'idColumn' => 'saleid', 'elements' => array( 'saleid', 'timestamp', 'date' => "!return substr(\"{\$record['timestamp']}\", 0, strpos(\"{\$record['timestamp']}\", ' '));", 'time' => "!return substr(\"{\$record['timestamp']}\", strpos(\"{\$record['timestamp']}\", ' ') + 1);", 'album' => array( 'rootTag' => '', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', 'artist' => array( 'rootTag' => '', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre' ) //artist elements ) //artist array ) //album elements ) //album array ) //sales elements ) //sales array ) //root elements ) //root ); $root = $dom->firstChild; $root->setAttribute('date_generated', date("Y-m-d\TH:i:s", 1124801570)); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_store date_generated="2005-08-23T14:52:50"> <customer> <customerid>1</customerid> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> <sales> <sale> <saleid>1</saleid> <timestamp>2005-05-25 16:32:00</timestamp> <date>2005-05-25</date> <time>16:32:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>11</saleid> <timestamp>2005-05-25 16:23:00</timestamp> <date>2005-05-25</date> <time>16:23:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>2</customerid> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> <sales> <sale> <saleid>2</saleid> <timestamp>2005-06-05 12:56:00</timestamp> <date>2005-06-05</date> <time>12:56:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>16</saleid> <timestamp>2005-06-05 12:56:12</timestamp> <date>2005-06-05</date> <time>12:56:12</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>3</customerid> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> <sales> <sale> <saleid>3</saleid> <timestamp>2005-07-10 11:03:00</timestamp> <date>2005-07-10</date> <time>11:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>12</saleid> <timestamp>2005-07-10 11:56:00</timestamp> <date>2005-07-10</date> <time>11:56:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>4</customerid> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> <sales> <sale> <saleid>4</saleid> <timestamp>2005-07-10 10:03:00</timestamp> <date>2005-07-10</date> <time>10:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>17</saleid> <timestamp>2005-07-10 10:03:32</timestamp> <date>2005-07-10</date> <time>10:03:32</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>5</customerid> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> <sales> <sale> <saleid>5</saleid> <timestamp>2005-07-10 13:03:00</timestamp> <date>2005-07-10</date> <time>13:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>13</saleid> <timestamp>2005-07-10 13:12:00</timestamp> <date>2005-07-10</date> <time>13:12:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>6</customerid> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> <sales> <sale> <saleid>6</saleid> <timestamp>2005-07-10 14:03:00</timestamp> <date>2005-07-10</date> <time>14:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>18</saleid> <timestamp>2005-07-10 14:03:52</timestamp> <date>2005-07-10</date> <time>14:03:52</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>7</customerid> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> <sales> <sale> <saleid>7</saleid> <timestamp>2005-07-10 15:03:00</timestamp> <date>2005-07-10</date> <time>15:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>14</saleid> <timestamp>2005-07-10 15:09:00</timestamp> <date>2005-07-10</date> <time>15:09:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>8</customerid> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> <sales> <sale> <saleid>8</saleid> <timestamp>2005-07-10 16:03:00</timestamp> <date>2005-07-10</date> <time>16:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>19</saleid> <timestamp>2005-07-10 16:03:01</timestamp> <date>2005-07-10</date> <time>16:03:01</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>9</customerid> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> <sales> <sale> <saleid>9</saleid> <timestamp>2005-07-10 18:03:00</timestamp> <date>2005-07-10</date> <time>18:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>15</saleid> <timestamp>2005-07-10 18:49:00</timestamp> <date>2005-07-10</date> <time>18:49:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>10</customerid> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> <sales> <sale> <saleid>10</saleid> <timestamp>2005-07-10 19:03:00</timestamp> <date>2005-07-10</date> <time>19:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>20</saleid> <timestamp>2005-07-10 19:03:50</timestamp> <date>2005-07-10</date> <time>19:03:50</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> </music_store> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case06.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case06.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case06.phpt --TEST-- XML_Query2XML::getXML(): Case06 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php /**Static class that provides validation and parsing methods for * generating XML. * * It is static so that we can easyly call its methods from inside * Query2XML using eval'd code. */ class Helper { /**Associative array of US postal state codes*/ public static $statePostalCodes = array( 'ALABAMA' => 'AL', 'ALASKA' => 'AK', 'AMERICAN SAMOA' => 'AS', 'ARIZONA' => 'AZ', 'ARKANSAS' => 'AR', 'CALIFORNIA' => 'CA', 'COLORADO' => 'CO', 'CONNECTICUT' => 'CT', 'DELAWARE' => 'DE', 'DISTRICT OF COLUMBIA' => 'DC', 'FEDERATED STATES OF MICRONESIA' => 'FM', 'FLORIDA' => 'FL', 'GEORGIA' => 'GA', 'GUAM' => 'GU', 'HAWAII' => 'HI', 'IDAHO' => 'ID', 'ILLINOIS' => 'IL', 'INDIANA' => 'IN', 'IOWA' => 'IA', 'KANSAS' => 'KS', 'KENTUCKY' => 'KY', 'LOUISIANA' => 'LA', 'MAINE' => 'ME', 'MARSHALL ISLANDS' => 'MH', 'MARYLAND' => 'MD', 'MASSACHUSETTS' => 'MA', 'MICHIGAN' => 'MI', 'MINNESOTA' => 'MN', 'MISSISSIPPI' => 'MS', 'MISSOURI' => 'MO', 'MONTANA' => 'MT', 'NEBRASKA' => 'NE', 'NEVADA' => 'NV', 'NEW HAMPSHIRE' => 'NH', 'NEW JERSEY' => 'NJ', 'NEW JESEY' => 'NJ', 'NEW MEXICO' => 'NM', 'NEW YORK' => 'NY', 'NORTH CAROLINA' => 'NC', 'NORTH DAKOTA' => 'ND', 'NORTHERN MARIANA ISLANDS' => 'MP', 'OHIO' => 'OH', 'OKLAHOMA' => 'OK', 'OREGON' => 'OR', 'PALAU' => 'PW', 'PENNSYLVANIA' => 'PA', 'PUERTO RICO' => 'PR', 'RHODE ISLAND' => 'RI', 'SOUTH CAROLINA' => 'SC', 'SOUTH DAKOTA' => 'SD', 'TENNESSEE' => 'TN', 'TEXAS' => 'TX', 'UTAH' => 'UT', 'VERMONT' => 'VT', 'VIRGIN ISLANDS' => 'VI', 'VIRGINIA' => 'VA', 'WASHINGTON' => 'WA', 'WEST VIRGINIA' => 'WV', 'WISCONSIN' => 'WI', 'WYOMING' => 'WY' ); /**Translates a US state name into its two-letter postal code. * If the translation fails, $state is returned unchanged * @param $state The state's name */ public static function getStatePostalCode($state) { $s = str_replace(" ", " ", trim(strtoupper($state))); if (isset(self::$statePostalCodes[$s])) { return self::$statePostalCodes[$s]; } else { return $state; } } function summarize($str, $limit=50, $appendString=' ...') { if (strlen($str) > $limit) { $str = substr($str, 0, $limit - strlen($appendString)) . $appendString; } return $str; } } require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT s.*, manager.employeeid AS manager_employeeid, manager.employeename AS manager_employeename, d.*, department_head.employeeid AS department_head_employeeid, department_head.employeename AS department_head_employeename, e.*, sa.*, c.*, al.*, ar.*, (SELECT COUNT(*) FROM sale WHERE sale.store_id = s.storeid) AS store_sales, (SELECT COUNT(*) FROM sale, employee, employee_department WHERE sale.employee_id = employee.employeeid AND employee_department.employee_id = employee.employeeid AND employee_department.department_id = d.departmentid ) AS department_sales, (SELECT COUNT(*) FROM employee, employee_department, department WHERE employee_department.employee_id = employee.employeeid AND employee_department.department_id = department.departmentid AND department.store_id = s.storeid ) AS store_employees, (SELECT COUNT(*) FROM employee, employee_department WHERE employee_department.employee_id = employee.employeeid AND employee_department.department_id = d.departmentid ) AS department_employees FROM store s LEFT JOIN employee manager ON s.manager = manager.employeeid LEFT JOIN department d ON d.store_id = s.storeid LEFT JOIN employee department_head ON department_head.employeeid = d.department_head LEFT JOIN employee_department ed ON ed.department_id = d.departmentid LEFT JOIN employee e ON e.employeeid = ed.employee_id LEFT JOIN sale sa ON sa.employee_id = e.employeeid LEFT JOIN customer c ON c.customerid = sa.customer_id LEFT JOIN album al ON al.albumid = sa.album_id LEFT JOIN artist ar ON ar.artistid = al.artist_id", array( 'rootTag' => 'music_company', 'rowTag' => 'store', 'idColumn' => 'storeid', 'attributes' => array( 'storeid' ), 'elements' => array( 'store_sales', 'store_employees', 'manager' => array( 'idColumn' => 'manager_employeeid', 'attributes' => array( 'manager_employeeid' ), 'elements' => array( 'manager_employeename' ) ), 'address' => array( 'elements' => array( 'country', 'state' => '!return Helper::getStatePostalCode($record["state"]);', 'city', 'street', 'phone' ) ), 'department' => array( 'idColumn' => 'departmentid', 'attributes' => array( 'departmentid' ), 'elements' => array( 'department_sales', 'department_employees', 'departmentname', 'department_head' => array( 'idColumn' => 'department_head_employeeid', 'attributes' => array( 'department_head_employeeid' ), 'elements' => array( 'department_head_employeename' ) ), 'employees' => array( 'rootTag' => 'employees', 'rowTag' => 'employee', 'idColumn' => 'employeeid', 'attributes' => array( 'employeeid' ), 'elements' => array( 'employeename', 'sales' => array( 'rootTag' => 'sales', 'rowTag' => 'sale', 'idColumn' => 'saleid', 'attributes' => array( 'saleid' ), 'elements' => array( 'timestamp', 'customer' => array( 'idColumn' => 'customerid', 'attributes' => array( 'customerid' ), 'elements' => array( 'first_name', 'last_name', 'email' ) ), 'album' => array( 'idColumn' => 'albumid', 'attributes' => array( 'albumid' ), 'elements' => array( 'title', 'published_year', 'comment' => '?!return Helper::summarize($record["comment"], 12);', 'artist' => array( 'idColumn' => 'artistid', 'attributes' => array( 'artistid' ), 'elements' => array( 'name', 'birth_year', 'birth_place', 'genre' ) ) ) // album elements ) //album array ) //sales elements ) //sales array ) //employees elements ) //employees array ) //department elements ) // department array ) //root elements ) //root ); $root = $dom->firstChild; $root->setAttribute('date_generated', date("Y-m-d\TH:i:s", 1124801570)); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_company date_generated="2005-08-23T14:52:50"> <store storeid="1"> <store_sales>10</store_sales> <store_employees>6</store_employees> <manager manager_employeeid="1"> <manager_employeename>Michael Jones</manager_employeename> </manager> <address> <country>US</country> <state>NY</state> <city>New York</city> <street>Broadway & 72nd Str</street> <phone>123 456 7890</phone> </address> <department departmentid="1"> <department_sales>10</department_sales> <department_employees>3</department_employees> <departmentname>Sales</departmentname> <department_head department_head_employeeid="1"> <department_head_employeename>Michael Jones</department_head_employeename> </department_head> <employees> <employee employeeid="1"> <employeename>Michael Jones</employeename> <sales> <sale saleid="1"> <timestamp>2005-05-25 16:32:00</timestamp> <customer customerid="1"> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="7"> <timestamp>2005-07-10 15:03:00</timestamp> <customer customerid="7"> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="16"> <timestamp>2005-06-05 12:56:12</timestamp> <customer customerid="2"> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="19"> <timestamp>2005-07-10 16:03:01</timestamp> <customer customerid="8"> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee employeeid="2"> <employeename>Susi Weintraub</employeename> <sales> <sale saleid="3"> <timestamp>2005-07-10 11:03:00</timestamp> <customer customerid="3"> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="9"> <timestamp>2005-07-10 18:03:00</timestamp> <customer customerid="9"> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="17"> <timestamp>2005-07-10 10:03:32</timestamp> <customer customerid="4"> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="20"> <timestamp>2005-07-10 19:03:50</timestamp> <customer customerid="10"> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee employeeid="3"> <employeename>Steve Hack</employeename> <sales> <sale saleid="5"> <timestamp>2005-07-10 13:03:00</timestamp> <customer customerid="5"> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="18"> <timestamp>2005-07-10 14:03:52</timestamp> <customer customerid="6"> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> </employees> </department> <department departmentid="2"> <department_sales>0</department_sales> <department_employees>3</department_employees> <departmentname>Marketing</departmentname> <department_head department_head_employeeid="4"> <department_head_employeename>Joan Kerr</department_head_employeename> </department_head> <employees> <employee employeeid="4"> <employeename>Joan Kerr</employeename> <sales /> </employee> <employee employeeid="5"> <employeename>Marcus Roth</employeename> <sales /> </employee> <employee employeeid="6"> <employeename>Jack Mack</employeename> <sales /> </employee> </employees> </department> </store> <store storeid="2"> <store_sales>10</store_sales> <store_employees>6</store_employees> <manager manager_employeeid="2"> <manager_employeename>Susi Weintraub</manager_employeename> </manager> <address> <country>US</country> <state>NY</state> <city>Larchmont</city> <street>Palmer Ave 71</street> <phone>456 7890</phone> </address> <department departmentid="3"> <department_sales>10</department_sales> <department_employees>3</department_employees> <departmentname>Sales</departmentname> <department_head department_head_employeeid="7"> <department_head_employeename>Rita Doktor</department_head_employeename> </department_head> <employees> <employee employeeid="7"> <employeename>Rita Doktor</employeename> <sales> <sale saleid="2"> <timestamp>2005-06-05 12:56:00</timestamp> <customer customerid="2"> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="8"> <timestamp>2005-07-10 16:03:00</timestamp> <customer customerid="8"> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="11"> <timestamp>2005-05-25 16:23:00</timestamp> <customer customerid="1"> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="14"> <timestamp>2005-07-10 15:09:00</timestamp> <customer customerid="7"> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee employeeid="8"> <employeename>David Til</employeename> <sales> <sale saleid="4"> <timestamp>2005-07-10 10:03:00</timestamp> <customer customerid="4"> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="10"> <timestamp>2005-07-10 19:03:00</timestamp> <customer customerid="10"> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="12"> <timestamp>2005-07-10 11:56:00</timestamp> <customer customerid="3"> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="15"> <timestamp>2005-07-10 18:49:00</timestamp> <customer customerid="9"> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee employeeid="9"> <employeename>Pia Eist</employeename> <sales> <sale saleid="6"> <timestamp>2005-07-10 14:03:00</timestamp> <customer customerid="6"> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="13"> <timestamp>2005-07-10 13:12:00</timestamp> <customer customerid="5"> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> </employees> </department> <department departmentid="4"> <department_sales>0</department_sales> <department_employees>3</department_employees> <departmentname>Marketing</departmentname> <department_head department_head_employeeid="10"> <department_head_employeename>Hanna Poll</department_head_employeename> </department_head> <employees> <employee employeeid="10"> <employeename>Hanna Poll</employeename> <sales /> </employee> <employee employeeid="11"> <employeename>Jim Wells</employeename> <sales /> </employee> <employee employeeid="12"> <employeename>Sandra Wilson</employeename> <sales /> </employee> </employees> </department> </store> </music_company> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case07.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case07.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case07.phpt --TEST-- XML_Query2XML::getXML(): Case07 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( '*', 'artist_id' => '?:' ) ) ) ) ); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_library> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> <albums> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> </album> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> </album> </albums> </artist> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> <albums> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> </album> </albums> </artist> <artist> <artistid>3</artistid> <name>Ray Charles</name> <birth_year>1930</birth_year> <birth_place>Mississippi</birth_place> <genre>Country and Soul</genre> <albums /> </artist> </music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case08.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case08.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case08.phpt --TEST-- XML_Query2XML::getXML(): Case08 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php class Mappers { public static function departmentMapper($str) { //maps 'one_two_three' to 'oneTwoThree' return preg_replace("/(_)([a-z])/e", "strtoupper('\\2')", $str); } public static function employeeMapper($str) { //maps 'one_two_three' to 'OneTwoThree' return ucfirst(preg_replace("/(_)([a-z])/e", "strtoupper('\\2')", $str)); } public function saleMapper($str) { //maps 'one_two_three' to 'ONETWOTHREE' return strtoupper(str_replace('_', '', $str)); } } /**Static class that provides validation and parsing methods for * generating XML. * * It is static so that we can easyly call its methods from inside * Query2XML using eval'd code. */ class Helper { /**Associative array of US postal state codes*/ public static $statePostalCodes = array( 'ALABAMA' => 'AL', 'ALASKA' => 'AK', 'AMERICAN SAMOA' => 'AS', 'ARIZONA' => 'AZ', 'ARKANSAS' => 'AR', 'CALIFORNIA' => 'CA', 'COLORADO' => 'CO', 'CONNECTICUT' => 'CT', 'DELAWARE' => 'DE', 'DISTRICT OF COLUMBIA' => 'DC', 'FEDERATED STATES OF MICRONESIA' => 'FM', 'FLORIDA' => 'FL', 'GEORGIA' => 'GA', 'GUAM' => 'GU', 'HAWAII' => 'HI', 'IDAHO' => 'ID', 'ILLINOIS' => 'IL', 'INDIANA' => 'IN', 'IOWA' => 'IA', 'KANSAS' => 'KS', 'KENTUCKY' => 'KY', 'LOUISIANA' => 'LA', 'MAINE' => 'ME', 'MARSHALL ISLANDS' => 'MH', 'MARYLAND' => 'MD', 'MASSACHUSETTS' => 'MA', 'MICHIGAN' => 'MI', 'MINNESOTA' => 'MN', 'MISSISSIPPI' => 'MS', 'MISSOURI' => 'MO', 'MONTANA' => 'MT', 'NEBRASKA' => 'NE', 'NEVADA' => 'NV', 'NEW HAMPSHIRE' => 'NH', 'NEW JERSEY' => 'NJ', 'NEW JESEY' => 'NJ', 'NEW MEXICO' => 'NM', 'NEW YORK' => 'NY', 'NORTH CAROLINA' => 'NC', 'NORTH DAKOTA' => 'ND', 'NORTHERN MARIANA ISLANDS' => 'MP', 'OHIO' => 'OH', 'OKLAHOMA' => 'OK', 'OREGON' => 'OR', 'PALAU' => 'PW', 'PENNSYLVANIA' => 'PA', 'PUERTO RICO' => 'PR', 'RHODE ISLAND' => 'RI', 'SOUTH CAROLINA' => 'SC', 'SOUTH DAKOTA' => 'SD', 'TENNESSEE' => 'TN', 'TEXAS' => 'TX', 'UTAH' => 'UT', 'VERMONT' => 'VT', 'VIRGIN ISLANDS' => 'VI', 'VIRGINIA' => 'VA', 'WASHINGTON' => 'WA', 'WEST VIRGINIA' => 'WV', 'WISCONSIN' => 'WI', 'WYOMING' => 'WY' ); /**Translates a US state name into its two-letter postal code. * If the translation fails, $state is returned unchanged * @param $state The state's name */ public static function getStatePostalCode($state) { $s = str_replace(" ", " ", trim(strtoupper($state))); if (isset(self::$statePostalCodes[$s])) { return self::$statePostalCodes[$s]; } else { return $state; } } function summarize($str, $limit=50, $appendString=' ...') { if (strlen($str) > $limit) { $str = substr($str, 0, $limit - strlen($appendString)) . $appendString; } return $str; } } function mapArtist($str) { //maps 'one_two_three' to 'onetwothree' return strtolower(str_replace('_', '', $str)); } require_once 'XML/Query2XML.php'; require_once 'XML/Query2XML/ISO9075Mapper.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $myMappers = new Mappers(); $dom =& $query2xml->getXML( "SELECT s.*, manager.employeeid AS manager_employeeid, manager.employeename AS manager_employeename, d.*, department_head.employeeid AS department_head_employeeid, department_head.employeename AS department_head_employeename, e.*, sa.*, c.*, al.*, ar.*, (SELECT COUNT(*) FROM sale WHERE sale.store_id = s.storeid) AS store_sales, (SELECT COUNT(*) FROM sale, employee, employee_department WHERE sale.employee_id = employee.employeeid AND employee_department.employee_id = employee.employeeid AND employee_department.department_id = d.departmentid ) AS department_sales, (SELECT COUNT(*) FROM employee, employee_department, department WHERE employee_department.employee_id = employee.employeeid AND employee_department.department_id = department.departmentid AND department.store_id = s.storeid ) AS store_employees, (SELECT COUNT(*) FROM employee, employee_department WHERE employee_department.employee_id = employee.employeeid AND employee_department.department_id = d.departmentid ) AS department_employees FROM store s LEFT JOIN employee manager ON s.manager = manager.employeeid LEFT JOIN department d ON d.store_id = s.storeid LEFT JOIN employee department_head ON department_head.employeeid = d.department_head LEFT JOIN employee_department ed ON ed.department_id = d.departmentid LEFT JOIN employee e ON e.employeeid = ed.employee_id LEFT JOIN sale sa ON sa.employee_id = e.employeeid LEFT JOIN customer c ON c.customerid = sa.customer_id LEFT JOIN album al ON al.albumid = sa.album_id LEFT JOIN artist ar ON ar.artistid = al.artist_id", array( 'rootTag' => 'music_company', 'rowTag' => 'store', 'idColumn' => 'storeid', 'mapper' => 'strtoupper', 'attributes' => array( 'storeid' ), 'elements' => array( 'store_sales', 'store_employees', 'manager' => array( 'idColumn' => 'manager_employeeid', 'attributes' => array( 'manager_employeeid' ), 'elements' => array( 'manager_employeename' ) ), 'address' => array( 'elements' => array( 'country', 'state' => '!return Helper::getStatePostalCode($record["state"]);', 'city', 'street', 'phone' ) ), 'department' => array( 'idColumn' => 'departmentid', 'mapper' => 'Mappers::departmentMapper', 'attributes' => array( 'departmentid' ), 'elements' => array( 'department_sales', 'department_employees', 'departmentname', 'department_head' => array( 'idColumn' => 'department_head_employeeid', 'attributes' => array( 'department_head_employeeid' ), 'elements' => array( 'department_head_employeename' ) ), 'employees' => array( 'rootTag' => 'employees', 'rowTag' => 'employee', 'idColumn' => 'employeeid', 'mapper' => array('Mappers', 'employeeMapper'), 'attributes' => array( 'employeeid' ), 'elements' => array( 'employeename', 'sales' => array( 'rootTag' => 'sales', 'rowTag' => 'sale', 'idColumn' => 'saleid', 'mapper' => array($myMappers, 'saleMapper'), 'attributes' => array( 'saleid' ), 'elements' => array( 'timestamp', 'customer' => array( 'idColumn' => 'customerid', 'mapper' => false, 'attributes' => array( 'customerid' ), 'elements' => array( 'first_name', 'last_name', 'email' ) ), 'album' => array( 'idColumn' => 'albumid', 'mapper' => 'XML_Query2XML_ISO9075Mapper::map', 'attributes' => array( 'albumid' ), 'elements' => array( 'title', 'published_year', 'comment' => '?!return Helper::summarize($record["comment"], 12);', 'artist' => array( 'idColumn' => 'artistid', 'mapper' => 'mapArtist', 'attributes' => array( 'artistid' ), 'elements' => array( 'name', 'birth_year', 'birth_place', 'genre' ) ) ) // album elements ) //album array ) //sales elements ) //sales array ) //employees elements ) //employees array ) //department elements ) // department array ) //root elements ) //root ); $root = $dom->firstChild; $root->setAttribute('date_generated', date("Y-m-d\TH:i:s", 1124801570)); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_company date_generated="2005-08-23T14:52:50"> <store STOREID="1"> <STORE_SALES>10</STORE_SALES> <STORE_EMPLOYEES>6</STORE_EMPLOYEES> <manager MANAGER_EMPLOYEEID="1"> <MANAGER_EMPLOYEENAME>Michael Jones</MANAGER_EMPLOYEENAME> </manager> <address> <COUNTRY>US</COUNTRY> <STATE>NY</STATE> <CITY>New York</CITY> <STREET>Broadway & 72nd Str</STREET> <PHONE>123 456 7890</PHONE> </address> <department departmentid="1"> <departmentSales>10</departmentSales> <departmentEmployees>3</departmentEmployees> <departmentname>Sales</departmentname> <department_head departmentHeadEmployeeid="1"> <departmentHeadEmployeename>Michael Jones</departmentHeadEmployeename> </department_head> <employees> <employee Employeeid="1"> <Employeename>Michael Jones</Employeename> <sales> <sale SALEID="1"> <TIMESTAMP>2005-05-25 16:32:00</TIMESTAMP> <customer customerid="1"> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="7"> <TIMESTAMP>2005-07-10 15:03:00</TIMESTAMP> <customer customerid="7"> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="16"> <TIMESTAMP>2005-06-05 12:56:12</TIMESTAMP> <customer customerid="2"> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="19"> <TIMESTAMP>2005-07-10 16:03:01</TIMESTAMP> <customer customerid="8"> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee Employeeid="2"> <Employeename>Susi Weintraub</Employeename> <sales> <sale SALEID="3"> <TIMESTAMP>2005-07-10 11:03:00</TIMESTAMP> <customer customerid="3"> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="9"> <TIMESTAMP>2005-07-10 18:03:00</TIMESTAMP> <customer customerid="9"> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="17"> <TIMESTAMP>2005-07-10 10:03:32</TIMESTAMP> <customer customerid="4"> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="20"> <TIMESTAMP>2005-07-10 19:03:50</TIMESTAMP> <customer customerid="10"> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee Employeeid="3"> <Employeename>Steve Hack</Employeename> <sales> <sale SALEID="5"> <TIMESTAMP>2005-07-10 13:03:00</TIMESTAMP> <customer customerid="5"> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="18"> <TIMESTAMP>2005-07-10 14:03:52</TIMESTAMP> <customer customerid="6"> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> </employees> </department> <department departmentid="2"> <departmentSales>0</departmentSales> <departmentEmployees>3</departmentEmployees> <departmentname>Marketing</departmentname> <department_head departmentHeadEmployeeid="4"> <departmentHeadEmployeename>Joan Kerr</departmentHeadEmployeename> </department_head> <employees> <employee Employeeid="4"> <Employeename>Joan Kerr</Employeename> <sales /> </employee> <employee Employeeid="5"> <Employeename>Marcus Roth</Employeename> <sales /> </employee> <employee Employeeid="6"> <Employeename>Jack Mack</Employeename> <sales /> </employee> </employees> </department> </store> <store STOREID="2"> <STORE_SALES>10</STORE_SALES> <STORE_EMPLOYEES>6</STORE_EMPLOYEES> <manager MANAGER_EMPLOYEEID="2"> <MANAGER_EMPLOYEENAME>Susi Weintraub</MANAGER_EMPLOYEENAME> </manager> <address> <COUNTRY>US</COUNTRY> <STATE>NY</STATE> <CITY>Larchmont</CITY> <STREET>Palmer Ave 71</STREET> <PHONE>456 7890</PHONE> </address> <department departmentid="3"> <departmentSales>10</departmentSales> <departmentEmployees>3</departmentEmployees> <departmentname>Sales</departmentname> <department_head departmentHeadEmployeeid="7"> <departmentHeadEmployeename>Rita Doktor</departmentHeadEmployeename> </department_head> <employees> <employee Employeeid="7"> <Employeename>Rita Doktor</Employeename> <sales> <sale SALEID="2"> <TIMESTAMP>2005-06-05 12:56:00</TIMESTAMP> <customer customerid="2"> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="8"> <TIMESTAMP>2005-07-10 16:03:00</TIMESTAMP> <customer customerid="8"> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="11"> <TIMESTAMP>2005-05-25 16:23:00</TIMESTAMP> <customer customerid="1"> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="14"> <TIMESTAMP>2005-07-10 15:09:00</TIMESTAMP> <customer customerid="7"> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee Employeeid="8"> <Employeename>David Til</Employeename> <sales> <sale SALEID="4"> <TIMESTAMP>2005-07-10 10:03:00</TIMESTAMP> <customer customerid="4"> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="10"> <TIMESTAMP>2005-07-10 19:03:00</TIMESTAMP> <customer customerid="10"> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="12"> <TIMESTAMP>2005-07-10 11:56:00</TIMESTAMP> <customer customerid="3"> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="15"> <TIMESTAMP>2005-07-10 18:49:00</TIMESTAMP> <customer customerid="9"> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee Employeeid="9"> <Employeename>Pia Eist</Employeename> <sales> <sale SALEID="6"> <TIMESTAMP>2005-07-10 14:03:00</TIMESTAMP> <customer customerid="6"> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="13"> <TIMESTAMP>2005-07-10 13:12:00</TIMESTAMP> <customer customerid="5"> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> </employees> </department> <department departmentid="4"> <departmentSales>0</departmentSales> <departmentEmployees>3</departmentEmployees> <departmentname>Marketing</departmentname> <department_head departmentHeadEmployeeid="10"> <departmentHeadEmployeename>Hanna Poll</departmentHeadEmployeename> </department_head> <employees> <employee Employeeid="10"> <Employeename>Hanna Poll</Employeename> <sales /> </employee> <employee Employeeid="11"> <Employeename>Jim Wells</Employeename> <sales /> </employee> <employee Employeeid="12"> <Employeename>Sandra Wilson</Employeename> <sales /> </employee> </employees> </department> </store> </music_company> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with complex query specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'name', 'firstAlbumTitle' => array( 'value' => 'title', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ) ), 'firstAlbumYear' => array( 'value' => 'published_year', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist name="Curtis Mayfield" firstAlbumTitle="New World Order" firstAlbumYear="1990"/><artist name="Isaac Hayes" firstAlbumTitle="Shaft" firstAlbumYear="1972"/><artist name="Ray Charles"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification_valuePHPCode.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification_valuePHPCode.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification_valuePHPCode.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with complex query specification using PHP code as value --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'name', 'firstAlbumTitle' => array( 'value' => 'title', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ) ), 'firstAlbumYear' => array( 'value' => 'published_year', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ) ), 'firstAlbumGenre' => array( 'value' => '!return $record["genre"] . " of " . $record["published_year"];', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ), 'sql_options' => array( 'merge' => true ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist name="Curtis Mayfield" firstAlbumTitle="New World Order" firstAlbumYear="1990" firstAlbumGenre="Soul of 1990"/><artist name="Isaac Hayes" firstAlbumTitle="Shaft" firstAlbumYear="1972" firstAlbumGenre="Soul of 1972"/><artist name="Ray Charles"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_conditionOption.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_conditionOption.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_conditionOption.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with condition option --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'attr1' => array( 'value' => ':only for atistid 1', 'condition' => '$record["artistid"] == 1' ), 'attr2' => array( 'value' => ':only for atistid 2', 'condition' => '$record["artistid"] == 2' ), 'attr3' => array( 'value' => ':only for atistid 3', 'condition' => '$record["artistid"] == 3' ), 'name' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist attr1="only for atistid 1" name="Curtis Mayfield"/><artist attr2="only for atistid 2" name="Isaac Hayes"/><artist attr3="only for atistid 3" name="Ray Charles"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_simpleQuerySpecification.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_simpleQuerySpecification.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_simpleQuerySpecification.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with simple query specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'name', 'firstAlbumTitle' => array( 'value' => 'title', 'sql' => 'SELECT * FROM album WHERE artist_id = {$record["artistid"]}' ), 'firstAlbumYear' => array( 'value' => 'published_year', 'sql' => 'SELECT * FROM album WHERE artist_id = {$record["artistid"]}' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist name="Curtis Mayfield" firstAlbumTitle="New World Order" firstAlbumYear="1990"/><artist name="Isaac Hayes" firstAlbumTitle="Shaft" firstAlbumYear="1972"/><artist name="Ray Charles"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_valuePrefixes.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_valuePrefixes.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_valuePrefixes.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with value prefixes --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'static' => array( 'value' => ':some static text', ), 'hide' => array( 'value' => '?:' ), 'six' => array( 'value' => '!return 2 * 3;' ), 'hide2' => array( 'value' => '?!return "";' ), 'artistid' => array( 'value' => 'artistid' ), 'genre' => array( 'value' => '!return strtoupper($record["genre"]);' ), 'birth_year' => array( 'value' => '?birth_year' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist static="some static text" six="6" artistid="1" genre="SOUL" birth_year="1920"/><artist static="some static text" six="6" artistid="2" genre="SOUL" birth_year="1942"/><artist static="some static text" six="6" artistid="3" genre="COUNTRY AND SOUL" birth_year="1930"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption1.phpt --TEST-- XML_Query2XML::getXML(): complex element specification with "condition" option #1 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'condition' => '$record["artistid"] != 3', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption2.phpt --TEST-- XML_Query2XML::getXML(): complex element specification with "condition" option #2 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'condition' => '$record["albumid"] != 1', 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_columnName.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_columnName.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_columnName.phpt --TEST-- XML_Query2XML::getXML(): simple attribute - condition prefix with column name --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ), 'attributes' => array( 'artistid', 'name', 'test' => '?test' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield"><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist artistid="2" name="Isaac Hayes"><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist artistid="3" name="Ray Charles"><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul! </genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_phpCode.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_phpCode.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_phpCode.phpt --TEST-- XML_Query2XML::getXML(): simple attribute - condition prefix with PHP code --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ), 'attributes' => array( 'artistid', 'name', 'test' => '?!return "";' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield"><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist artistid="2" name="Isaac Hayes"><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist artistid="3" name="Ray Charles"><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul! </genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_staticText.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_staticText.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_staticText.phpt --TEST-- XML_Query2XML::getXML(): simple attribute - condition prefix with static text --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ), 'attributes' => array( 'artistid', 'name', 'test' => '?:' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield"><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist artistid="2" name="Isaac Hayes"><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist artistid="3" name="Ray Charles"><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul! </genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_columnName.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_columnName.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_columnName.phpt --TEST-- XML_Query2XML::getXML(): simple element - condition prefix with column name --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', 'test' => '?test' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_phpCode.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_phpCode.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_phpCode.phpt --TEST-- XML_Query2XML::getXML(): simple element - condition prefix with PHP code --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', 'test' => '?!return "";' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_staticText.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_staticText.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_staticText.phpt --TEST-- XML_Query2XML::getXML(): simple element - condition prefix with static text --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', 'test' => '?:' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_columnName.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_columnName.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_columnName.phpt --TEST-- XML_Query2XML::getXML(): value - condition prefix with column name --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'value' => '?test', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_phpCode.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_phpCode.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_phpCode.phpt --TEST-- XML_Query2XML::getXML(): value - condition prefix with PHP code --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'value' => '?!return "";', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_staticText.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_staticText.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_staticText.phpt --TEST-- XML_Query2XML::getXML(): value - condition prefix with static text --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'value' => '?:', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/throwDBException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/throwDBException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/throwDBException.phpt --TEST-- XML_Query2XML::getXML(): check for XML_Query2XML_DBException - $sql argument contains invalid query --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN non_existing_table ON non_existing_table.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 199); } ?> --EXPECT-- XML_Query2XML_DBException: Could not run the following SQL query: SELECT * FROM artist LEFT JOIN non_existing_table ON non_existing_table.artist_id = artist.artistid http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/startProfiling/startProfiling.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/startProfiling/startProfiling.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/startProfiling/startProfiling.phpt --TEST-- XML_Query2XML::startProfiling() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); print count($query2xml->getRawProfile()); $query2xml->clearProfile(); ?> --EXPECT-- 6 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/stopProfiling/stopProfiling.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/stopProfiling/stopProfiling.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/stopProfiling/stopProfiling.phpt --TEST-- XML_Query2XML::stopProfiling() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $query2xml->stopProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $profile = $query2xml->getRawProfile(); print count($profile['queries']) ?> --EXPECT-- 0
http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element1.phpt --TEST-- XML_Query2XML::_applyColumnStringToRecord(): check for XML_Query2XML_ConfigException - non-existing column name used in "elements" --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid ', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: The column "artistid " used in the option "elements" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_element2.phpt --TEST-- XML_Query2XML::_applyColumnStringToRecord(): check for XML_Query2XML_ConfigException - non existing column name used in "elements" --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid ', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The column "albumid " used in the option "elements" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_idcolumn.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_idcolumn.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applyColumnStringToRecord/throwConfigException_idcolumn.phpt --TEST-- XML_Query2XML::_applyColumnStringToRecord(): check for XML_Query2XML_ConfigException - non-existing column used as idColumn --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid ', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: The column "artistid " used in the option "idColumn" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_dataOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_dataOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_dataOptionWrongType.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - "data" not an array --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => 1, 'query' => 'SELECT * FROM some_table' ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql]: The configuration option "data" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterFalse.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterFalse.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterFalse.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - non existing column in "merge_selective" with marge_master=false --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'merge_master' => false, 'merge_selective' => array('genre ') ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql_options]: The column "genre " used in the option "merge_selective" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterTrue.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterTrue.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeMasterTrue.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - non existing column in "merge_selective" with marge_master=true --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'merge_master' => true, 'merge_selective' => array('genre ') ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql_options]: The column "genre " used in the option "merge_selective" does not exist in the result set. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeselectiveOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeselectiveOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_mergeselectiveOptionWrongType.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - "merge_selective" not an array --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'merge_master' => true, 'merge_selective' => 1 ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql_options]: The configuration option "merge_selective" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_queryOptionMissing.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_queryOptionMissing.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_queryOptionMissing.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - "query" missing --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array(), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][sql]: The configuration option "query" is missing. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_sqlOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_sqlOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_applySqlOptionsToRecord/throwConfigException_sqlOptionWrongType.phpt --TEST-- XML_Query2XML::_applySqlOptionsToRecord(): check for XML_Query2XML_ConfigException - "sql" not an array or string --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => 1, 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The configuration option "sql" is not an array or a string. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid1.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for element --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid ' => 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "artistid " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_elementInvalid2.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for element --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid ' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "albumid " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid1.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for rootTag --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library ', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "music_library " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_roottagOptionInvalid2.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for rootTag --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums ', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "albums " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_rowtagOptionInvalid.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_rowtagOptionInvalid.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_createDOMElement/throwXMLException_rowtagOptionInvalid.phpt --TEST-- XML_Query2XML::_createDOMElement(): check for XML_Query2XML_XMLException - invalid XML name for rowTag --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist ', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: "artist " is an invalid XML element name: Invalid Character Error http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributeSpecWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributeSpecWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributeSpecWrongType.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - attribute is not defined using an array or a string --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => 3 ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [attributes]: The attribute "genre" was not specified using a string nor an array http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributesOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributesOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_attributesOptionWrongType.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - "attributes" is not an array --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'attributes' => 1 ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The configuration option "attributes" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_elementsOptionWrongType.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_elementsOptionWrongType.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_elementsOptionWrongType.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - "elements" is not an array --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => 1 ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The configuration option "elements" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_idcolumnOptionMissing.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_idcolumnOptionMissing.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_idcolumnOptionMissing.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - "idColumn" missing --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn ' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: The configuration option "idColumn" is missing. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableFunction.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableFunction.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableFunction.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - mapper function not callable --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'mapper' => 'noSuchFunction', 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The method/function "noSuchFunction" specified in the configuration option "mapper" is not callable. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableNonstaticMethod.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableNonstaticMethod.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableNonstaticMethod.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - non-static mapper method not callable --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php class Mapper { } require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'mapper' => array(new Mapper(), 'noSuchMethod'), 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The method/function "Mapper::noSuchMethod" specified in the configuration option "mapper" is not callable. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod1.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - static mapper method not callable --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'mapper' => 'No:suchMethod', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: The method/function "No:suchMethod" specified in the configuration option "mapper" is not callable. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_getNestedXMLRecord/throwConfigException_mapperNotCallableStaticMethod2.phpt --TEST-- XML_Query2XML::_getNestedXMLRecord(): check for XML_Query2XML_ConfigException - static mapper method not callable --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'mapper' => 'No:suchMethod', 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums]: The method/function "No:suchMethod" specified in the configuration option "mapper" is not callable. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName/throwXMLException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName/throwXMLException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_mapSQLIdentifierToXMLName/throwXMLException.phpt --TEST-- XML_Query2XML::_mapSQLIdentifierToXMLName(): check for XML_Query2XML_ConfigException - mapper function throwing exception --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php class Helper { public function throwException($str) { throw new Exception('Throwing exception for ' . $str); } } require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'mapper' => array('Helper', 'throwException'), 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( '*' ) ) ) ) ); } catch (XML_Query2XML_XMLException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_XMLException: Could not map "artistid" to an XML name using the mapper Helper::throwException: Throwing exception for artistid http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_complexQuery.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_complexQuery.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_complexQuery.phpt --TEST-- XML_Query2XML::_prepareAndExecute(): check for XML_Query2XML_DBException - Complex Query Specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'query' => 'SELECT * FROM non_existing_table' ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 75); } ?> --EXPECT-- XML_Query2XML_DBException: Could not execute the following SQL query: SELECT * FROM non_existing_table http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_simpleQuery.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_simpleQuery.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_prepareAndExecute/throwDBException_simpleQuery.phpt --TEST-- XML_Query2XML::_prepareAndExecute(): check for XML_Query2XML_DBException - Simple Query Specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => 'SELECT * FROM non_existing_table', 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid' => 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 71); } ?> --EXPECT-- XML_Query2XML_DBException: Could not run the following SQL query: SELECT * FROM non_existing_table http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/rethrowConfigException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/rethrowConfigException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/rethrowConfigException.phpt --TEST-- XML_Query2XML::_processComplexElementSpecification(): check for XML_Query2XML_ConfigException - bubbling up --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'albums' => array( 'elements' => array( 'sub1' => array( 'elements' => array( 'sub2' => array( 'elements' => array( 'sub3' => array( 'sql' => array( 'data' => 1, 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), ) ) ) ) ) ) ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [elements][albums][elements][sub1][elements][sub2][elements][sub3][sql]: The configuration option "data" is not an array. http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/throwConfigException_valueOptionMissing.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/throwConfigException_valueOptionMissing.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/_processComplexElementSpecification/throwConfigException_valueOptionMissing.phpt --TEST-- XML_Query2XML::_processComplexElementSpecification(): check for XML_Query2XML_ConfigException - missing "value" option --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => array( 'condition' => '$record["genre"] == "Soul"', ) ) ) ); } catch (XML_Query2XML_ConfigException $e) { echo get_class($e) . ': ' . $e->getMessage(); } ?> --EXPECT-- XML_Query2XML_ConfigException: [attributes][genre]: The option "value" is missing from the complex attribute specification http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling/clearProfiling.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling/clearProfiling.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/clearProfiling/clearProfiling.phpt --TEST-- XML_Query2XML::clearProfile() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $query2xml->clearProfile(); print count($query2xml->getRawProfile()); $query2xml->clearProfile(); ?> --EXPECT-- 0 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog/disableDebugLog.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog/disableDebugLog.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/disableDebugLog/disableDebugLog.phpt --TEST-- XML_Query2XML::disableDebugLog() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php class MyLogger { public $data = ''; public function log($str) { $this->data .= $str . "\n"; } } require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $debugLogger = new MyLogger(); $query2xml->enableDebugLog($debugLogger); $query2xml->disableDebugLog(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); print strlen($debugLogger->data); ?> --EXPECT-- 0 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog/enableDebugLog.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog/enableDebugLog.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/enableDebugLog/enableDebugLog.phpt --TEST-- XML_Query2XML::enableDebugLog() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php class MyLogger { public $data = ''; public function log($str) { $this->data .= $str . "\n"; } } require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $debugLogger = new MyLogger(); $query2xml->enableDebugLog($debugLogger); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $query2xml->disableDebugLog(); echo $debugLogger->data; ?> --EXPECT-- QUERY: SELECT * FROM artist DONE QUERY: SELECT * FROM album WHERE artist_id = ? DONE QUERY: SELECT * FROM album WHERE artist_id = ? DONE QUERY: SELECT * FROM album WHERE artist_id = ? DONE http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/factory/throwDBException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/factory/throwDBException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/factory/throwDBException.phpt --TEST-- XML_Query2XML::factory(): check for XML_Query2XML_DBException --SKIPIF-- <?php chdir(dirname(dirname(__FILE__))); require_once './skipif.php'; ?> --FILE-- <?php require_once('DB.php'); require_once('XML/Query2XML.php'); $db = DB::connect('mysql://bogususer@256.256.256.256/bugusdb'); try { $query2xml =& XML_Query2XML::factory($db); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 30); } ?> --EXPECT-- XML_Query2XML_DBException: Could not connect to database: http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/case01.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/case01.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/case01.phpt --TEST-- XML_Query2XML::getFlatXML(): Case01 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getFlatXML("SELECT * FROM artist", 'music_library', 'artist'); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_library> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> <artist> <artistid>3</artistid> <name>Ray Charles</name> <birth_year>1930</birth_year> <birth_place>Mississippi</birth_place> <genre>Country and Soul</genre> </artist> </music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/simpleSelect.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/simpleSelect.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/simpleSelect.phpt --TEST-- XML_Query2XML::getFlatXML(): simple select --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getFlatXML('SELECT * FROM album'); echo $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <root><row><albumid>1</albumid><artist_id>1</artist_id><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></row><row><albumid>2</albumid><artist_id>1</artist_id><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></row><row><albumid>3</albumid><artist_id>2</artist_id><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></row></root> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/throwDBException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/throwDBException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getFlatXML/throwDBException.phpt --TEST-- XML_Query2XML::getFlatXML(): check for XML_Query2XML_DBException --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getFlatXML('SELECT * FROM non_existing_table'); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 71); } ?> --EXPECT-- XML_Query2XML_DBException: Could not run the following SQL query: SELECT * FROM non_existing_table http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getProfile/getProfile.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getProfile/getProfile.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getProfile/getProfile.phpt --TEST-- XML_Query2XML::getProfile() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $profile = $query2xml->getProfile(); print preg_match_all('/SELECT/', $profile, $matches); ?> --EXPECT-- 2 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile/getRawProfile.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile/getRawProfile.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getRawProfile/getRawProfile.phpt --TEST-- XML_Query2XML::getRawProfile() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $rawProfile = $query2xml->getRawProfile(); print count($rawProfile['queries']) ?> --EXPECT-- 2 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes1.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - simple --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="Soul"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="Soul"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="Country and Soul"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes2.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - as placeholder --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'ATTR1_*' => ':STATIC_VALUE', 'ATTR2_*' => ':VALUE_*', 'ATTR3_*' => '!return "--" . $record["*"] . "--";' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="Soul" ATTR1_artistid="STATIC_VALUE" ATTR1_name="STATIC_VALUE" ATTR1_birth_year="STATIC_VALUE" ATTR1_birth_place="STATIC_VALUE" ATTR1_genre="STATIC_VALUE" ATTR2_artistid="VALUE_artistid" ATTR2_name="VALUE_name" ATTR2_birth_year="VALUE_birth_year" ATTR2_birth_place="VALUE_birth_place" ATTR2_genre="VALUE_genre" ATTR3_artistid="--1--" ATTR3_name="--Curtis Mayfield--" ATTR3_birth_year="--1920--" ATTR3_birth_place="--Chicago--" ATTR3_genre="--Soul--"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="Soul" ATTR1_artistid="STATIC_VALUE" ATTR1_name="STATIC_VALUE" ATTR1_birth_year="STATIC_VALUE" ATTR1_birth_place="STATIC_VALUE" ATTR1_genre="STATIC_VALUE" ATTR2_artistid="VALUE_artistid" ATTR2_name="VALUE_name" ATTR2_birth_year="VALUE_birth_year" ATTR2_birth_place="VALUE_birth_place" ATTR2_genre="VALUE_genre" ATTR3_artistid="--2--" ATTR3_name=! "--Isaac Hayes--" ATTR3_birth_year="--1942--" ATTR3_birth_place="--Tennessee--" ATTR3_genre="--Soul--"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="Country and Soul" ATTR1_artistid="STATIC_VALUE" ATTR1_name="STATIC_VALUE" ATTR1_birth_year="STATIC_VALUE" ATTR1_birth_place="STATIC_VALUE" ATTR1_genre="STATIC_VALUE" ATTR2_artistid="VALUE_artistid" ATTR2_name="VALUE_name" ATTR2_birth_year="VALUE_birth_year" ATTR2_birth_place="VALUE_birth_place" ATTR2_genre="VALUE_genre" ATTR3_artistid="--3--" ATTR3_name="--Ray Charles--" ATTR3_birth_year="--1930--" ATTR3_birth_place="--Mississippi--" ATTR3_genre="--Country and Soul--"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes3.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes3.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes3.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - overwriting with simple attribute specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => '!return strtoupper($record["genre"]);' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="SOUL"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="SOUL"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="COUNTRY AND SOUL"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes4.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes4.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes4.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - overwriting with complex attribute specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => array( 'value' => '!return strtoupper($record["genre"]);' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="SOUL"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="SOUL"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="COUNTRY AND SOUL"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes5.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes5.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes5.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - supressing single attribute using '?:' --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => '?:' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes6.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes6.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_attributes6.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with attributes - supressing single attribute using "condition" --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( '*' => '*', 'genre' => array( 'condition' => 'false' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements1.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - simple --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements2.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - as placeholder --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'TAG1_*' => ':STATIC_VALUE', 'TAG2_*' => ':VALUE_*', 'TAG3_*' => '!return "--" . $record["*"] . "--";' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><TAG1_artistid>STATIC_VALUE</TAG1_artistid><TAG1_name>STATIC_VALUE</TAG1_name><TAG1_birth_year>STATIC_VALUE</TAG1_birth_year><TAG1_birth_place>STATIC_VALUE</TAG1_birth_place><TAG1_genre>STATIC_VALUE</TAG1_genre><TAG2_artistid>VALUE_artistid</TAG2_artistid><TAG2_name>VALUE_name</TAG2_name><TAG2_birth_year>VALUE_birth_year</TAG2_birth_year><TAG2_birth_place>VALUE_birth_place</TAG2_birth_place><TAG2_genre>VALUE_genre</TAG2_genre><TAG3_artistid>--1--</TAG3_artistid><TAG3_name>--Curtis Mayfield--</TAG3_name><TAG3_birth_year>--1920--</TAG3_birth_year><TAG3_birth_place>--Chicago--</TAG3_birth_place><TAG3_genre>--Soul--</TAG3_genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><TAG1_artistid>STATIC_VALUE</TAG1_artistid><TAG1_name>S! TATIC_VALUE</TAG1_name><TAG1_birth_year>STATIC_VALUE</TAG1_birth_year><TAG1_birth_place>STATIC_VALUE</TAG1_birth_place><TAG1_genre>STATIC_VALUE</TAG1_genre><TAG2_artistid>VALUE_artistid</TAG2_artistid><TAG2_name>VALUE_name</TAG2_name><TAG2_birth_year>VALUE_birth_year</TAG2_birth_year><TAG2_birth_place>VALUE_birth_place</TAG2_birth_place><TAG2_genre>VALUE_genre</TAG2_genre><TAG3_artistid>--2--</TAG3_artistid><TAG3_name>--Isaac Hayes--</TAG3_name><TAG3_birth_year>--1942--</TAG3_birth_year><TAG3_birth_place>--Tennessee--</TAG3_birth_place><TAG3_genre>--Soul--</TAG3_genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><TAG1_artistid>STATIC_VALUE</TAG1_artistid><TAG1_name>STATIC_VALUE</TAG1_name><TAG1_birth_year>STATIC_VALUE</TAG1_birth_year><TAG1_birth_place>STATIC_VALUE</TAG1_birth_place><TAG1_genre>STATIC_VALUE</TAG1_genre><TAG2_artistid>VALUE_artistid</TAG2_artis! tid><TAG2_name>VALUE_name</TAG2_name><TAG2_birth_year>VALUE_birth_year </TAG2_birth_year><TAG2_birth_place>VALUE_birth_place</TAG2_birth_place><TAG2_genre>VALUE_genre</TAG2_genre><TAG3_artistid>--3--</TAG3_artistid><TAG3_name>--Ray Charles--</TAG3_name><TAG3_birth_year>--1930--</TAG3_birth_year><TAG3_birth_place>--Mississippi--</TAG3_birth_place><TAG3_genre>--Country and Soul--</TAG3_genre></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements3.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements3.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements3.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - overwriting with simple element specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'genre' => '!return strtoupper($record["genre"]);' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>SOUL</genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>SOUL</genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>COUNTRY AND SOUL</genre></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements4.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements4.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements4.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - overwriting with complex element specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'genre' => array( 'value' => '!return strtoupper($record["genre"]);' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>SOUL</genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>SOUL</genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>COUNTRY AND SOUL</genre></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements5.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements5.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements5.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - supressing single element using '?:' --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'genre' => '?:' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements6.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements6.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/asteriskShortcut_elements6.phpt --TEST-- XML_Query2XML::getXML(): asterisk shortcut with elements - supressing single element using "condition" --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*' => '*', 'genre' => array( 'condition' => 'false' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case02.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case02.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case02.phpt --TEST-- XML_Query2XML::getXML(): Case02 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_library> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> <albums> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> </album> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> </album> </albums> </artist> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> <albums> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> </album> </albums> </artist> <artist> <artistid>3</artistid> <name>Ray Charles</name> <birth_year>1930</birth_year> <birth_place>Mississippi</birth_place> <genre>Country and Soul</genre> <albums /> </artist> </music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case03.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case03.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case03.phpt --TEST-- XML_Query2XML::getXML(): Case03 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_library> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> <albums> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> </album> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> </album> </albums> </artist> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> <albums> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> </album> </albums> </artist> <artist> <artistid>3</artistid> <name>Ray Charles</name> <birth_year>1930</birth_year> <birth_place>Mississippi</birth_place> <genre>Country and Soul</genre> <albums /> </artist> </music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case04.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case04.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case04.phpt --TEST-- XML_Query2XML::getXML(): Case04 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'MUSIC_LIBRARY', 'rowTag' => 'ARTIST', 'idColumn' => 'artistid', 'elements' => array( 'NAME' => 'name', 'BIRTH_YEAR' => 'birth_year', 'BIRTH_YEAR_TWO_DIGIT' => "!return substr(\"{\$record['birth_year']}\", 2);", 'BIRTH_PLACE' => 'birth_place', 'GENRE' => 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => true, 'merge_master' => false ), 'rootTag' => '', 'rowTag' => 'ALBUM', 'idColumn' => 'albumid', 'elements' => array( 'TITLE' => 'title', 'PUBLISHED_YEAR' => 'published_year', 'COMMENT' => 'comment', 'GENRE' => 'genre' ), 'attributes' => array( 'ALBUMID' => 'albumid' ) ) ), 'attributes' => array( 'ARTISTID' => 'artistid', 'MAINTAINER' => ':Lukas Feiler' ) ) ); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <MUSIC_LIBRARY> <ARTIST ARTISTID="1" MAINTAINER="Lukas Feiler"> <NAME>Curtis Mayfield</NAME> <BIRTH_YEAR>1920</BIRTH_YEAR> <BIRTH_YEAR_TWO_DIGIT>20</BIRTH_YEAR_TWO_DIGIT> <BIRTH_PLACE>Chicago</BIRTH_PLACE> <GENRE>Soul</GENRE> <ALBUM ALBUMID="1"> <TITLE>New World Order</TITLE> <PUBLISHED_YEAR>1990</PUBLISHED_YEAR> <COMMENT>the best ever!</COMMENT> <GENRE>Soul</GENRE> </ALBUM> <ALBUM ALBUMID="2"> <TITLE>Curtis</TITLE> <PUBLISHED_YEAR>1970</PUBLISHED_YEAR> <COMMENT>that man's got somthin' to say</COMMENT> <GENRE>Soul</GENRE> </ALBUM> </ARTIST> <ARTIST ARTISTID="2" MAINTAINER="Lukas Feiler"> <NAME>Isaac Hayes</NAME> <BIRTH_YEAR>1942</BIRTH_YEAR> <BIRTH_YEAR_TWO_DIGIT>42</BIRTH_YEAR_TWO_DIGIT> <BIRTH_PLACE>Tennessee</BIRTH_PLACE> <GENRE>Soul</GENRE> <ALBUM ALBUMID="3"> <TITLE>Shaft</TITLE> <PUBLISHED_YEAR>1972</PUBLISHED_YEAR> <COMMENT>he's the man</COMMENT> <GENRE>Soul</GENRE> </ALBUM> </ARTIST> <ARTIST ARTISTID="3" MAINTAINER="Lukas Feiler"> <NAME>Ray Charles</NAME> <BIRTH_YEAR>1930</BIRTH_YEAR> <BIRTH_YEAR_TWO_DIGIT>30</BIRTH_YEAR_TWO_DIGIT> <BIRTH_PLACE>Mississippi</BIRTH_PLACE> <GENRE>Country and Soul</GENRE> </ARTIST> </MUSIC_LIBRARY> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case05.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case05.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case05.phpt --TEST-- XML_Query2XML::getXML(): Case05 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM customer c LEFT JOIN sale s ON c.customerid = s.customer_id LEFT JOIN album al ON s.album_id = al.albumid LEFT JOIN artist ar ON al.artist_id = ar.artistid", array( 'rootTag' => 'music_store', 'rowTag' => 'customer', 'idColumn' => 'customerid', 'elements' => array( 'customerid', 'first_name', 'last_name', 'email', 'sales' => array( 'rootTag' => 'sales', 'rowTag' => 'sale', 'idColumn' => 'saleid', 'elements' => array( 'saleid', 'timestamp', 'date' => "!return substr(\"{\$record['timestamp']}\", 0, strpos(\"{\$record['timestamp']}\", ' '));", 'time' => "!return substr(\"{\$record['timestamp']}\", strpos(\"{\$record['timestamp']}\", ' ') + 1);", 'album' => array( 'rootTag' => '', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', 'artist' => array( 'rootTag' => '', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre' ) //artist elements ) //artist array ) //album elements ) //album array ) //sales elements ) //sales array ) //root elements ) //root ); $root = $dom->firstChild; $root->setAttribute('date_generated', date("Y-m-d\TH:i:s", 1124801570)); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_store date_generated="2005-08-23T14:52:50"> <customer> <customerid>1</customerid> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> <sales> <sale> <saleid>1</saleid> <timestamp>2005-05-25 16:32:00</timestamp> <date>2005-05-25</date> <time>16:32:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>11</saleid> <timestamp>2005-05-25 16:23:00</timestamp> <date>2005-05-25</date> <time>16:23:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>2</customerid> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> <sales> <sale> <saleid>2</saleid> <timestamp>2005-06-05 12:56:00</timestamp> <date>2005-06-05</date> <time>12:56:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>16</saleid> <timestamp>2005-06-05 12:56:12</timestamp> <date>2005-06-05</date> <time>12:56:12</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>3</customerid> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> <sales> <sale> <saleid>3</saleid> <timestamp>2005-07-10 11:03:00</timestamp> <date>2005-07-10</date> <time>11:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>12</saleid> <timestamp>2005-07-10 11:56:00</timestamp> <date>2005-07-10</date> <time>11:56:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>4</customerid> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> <sales> <sale> <saleid>4</saleid> <timestamp>2005-07-10 10:03:00</timestamp> <date>2005-07-10</date> <time>10:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>17</saleid> <timestamp>2005-07-10 10:03:32</timestamp> <date>2005-07-10</date> <time>10:03:32</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>5</customerid> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> <sales> <sale> <saleid>5</saleid> <timestamp>2005-07-10 13:03:00</timestamp> <date>2005-07-10</date> <time>13:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>13</saleid> <timestamp>2005-07-10 13:12:00</timestamp> <date>2005-07-10</date> <time>13:12:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>6</customerid> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> <sales> <sale> <saleid>6</saleid> <timestamp>2005-07-10 14:03:00</timestamp> <date>2005-07-10</date> <time>14:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>18</saleid> <timestamp>2005-07-10 14:03:52</timestamp> <date>2005-07-10</date> <time>14:03:52</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>7</customerid> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> <sales> <sale> <saleid>7</saleid> <timestamp>2005-07-10 15:03:00</timestamp> <date>2005-07-10</date> <time>15:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>14</saleid> <timestamp>2005-07-10 15:09:00</timestamp> <date>2005-07-10</date> <time>15:09:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>8</customerid> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> <sales> <sale> <saleid>8</saleid> <timestamp>2005-07-10 16:03:00</timestamp> <date>2005-07-10</date> <time>16:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>19</saleid> <timestamp>2005-07-10 16:03:01</timestamp> <date>2005-07-10</date> <time>16:03:01</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>9</customerid> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> <sales> <sale> <saleid>9</saleid> <timestamp>2005-07-10 18:03:00</timestamp> <date>2005-07-10</date> <time>18:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>15</saleid> <timestamp>2005-07-10 18:49:00</timestamp> <date>2005-07-10</date> <time>18:49:00</time> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> <customer> <customerid>10</customerid> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> <sales> <sale> <saleid>10</saleid> <timestamp>2005-07-10 19:03:00</timestamp> <date>2005-07-10</date> <time>19:03:00</time> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale> <saleid>20</saleid> <timestamp>2005-07-10 19:03:50</timestamp> <date>2005-07-10</date> <time>19:03:50</time> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </customer> </music_store> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case06.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case06.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case06.phpt --TEST-- XML_Query2XML::getXML(): Case06 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php /**Static class that provides validation and parsing methods for * generating XML. * * It is static so that we can easyly call its methods from inside * Query2XML using eval'd code. */ class Helper { /**Associative array of US postal state codes*/ public static $statePostalCodes = array( 'ALABAMA' => 'AL', 'ALASKA' => 'AK', 'AMERICAN SAMOA' => 'AS', 'ARIZONA' => 'AZ', 'ARKANSAS' => 'AR', 'CALIFORNIA' => 'CA', 'COLORADO' => 'CO', 'CONNECTICUT' => 'CT', 'DELAWARE' => 'DE', 'DISTRICT OF COLUMBIA' => 'DC', 'FEDERATED STATES OF MICRONESIA' => 'FM', 'FLORIDA' => 'FL', 'GEORGIA' => 'GA', 'GUAM' => 'GU', 'HAWAII' => 'HI', 'IDAHO' => 'ID', 'ILLINOIS' => 'IL', 'INDIANA' => 'IN', 'IOWA' => 'IA', 'KANSAS' => 'KS', 'KENTUCKY' => 'KY', 'LOUISIANA' => 'LA', 'MAINE' => 'ME', 'MARSHALL ISLANDS' => 'MH', 'MARYLAND' => 'MD', 'MASSACHUSETTS' => 'MA', 'MICHIGAN' => 'MI', 'MINNESOTA' => 'MN', 'MISSISSIPPI' => 'MS', 'MISSOURI' => 'MO', 'MONTANA' => 'MT', 'NEBRASKA' => 'NE', 'NEVADA' => 'NV', 'NEW HAMPSHIRE' => 'NH', 'NEW JERSEY' => 'NJ', 'NEW JESEY' => 'NJ', 'NEW MEXICO' => 'NM', 'NEW YORK' => 'NY', 'NORTH CAROLINA' => 'NC', 'NORTH DAKOTA' => 'ND', 'NORTHERN MARIANA ISLANDS' => 'MP', 'OHIO' => 'OH', 'OKLAHOMA' => 'OK', 'OREGON' => 'OR', 'PALAU' => 'PW', 'PENNSYLVANIA' => 'PA', 'PUERTO RICO' => 'PR', 'RHODE ISLAND' => 'RI', 'SOUTH CAROLINA' => 'SC', 'SOUTH DAKOTA' => 'SD', 'TENNESSEE' => 'TN', 'TEXAS' => 'TX', 'UTAH' => 'UT', 'VERMONT' => 'VT', 'VIRGIN ISLANDS' => 'VI', 'VIRGINIA' => 'VA', 'WASHINGTON' => 'WA', 'WEST VIRGINIA' => 'WV', 'WISCONSIN' => 'WI', 'WYOMING' => 'WY' ); /**Translates a US state name into its two-letter postal code. * If the translation fails, $state is returned unchanged * @param $state The state's name */ public static function getStatePostalCode($state) { $s = str_replace(" ", " ", trim(strtoupper($state))); if (isset(self::$statePostalCodes[$s])) { return self::$statePostalCodes[$s]; } else { return $state; } } function summarize($str, $limit=50, $appendString=' ...') { if (strlen($str) > $limit) { $str = substr($str, 0, $limit - strlen($appendString)) . $appendString; } return $str; } } require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT s.*, manager.employeeid AS manager_employeeid, manager.employeename AS manager_employeename, d.*, department_head.employeeid AS department_head_employeeid, department_head.employeename AS department_head_employeename, e.*, sa.*, c.*, al.*, ar.*, (SELECT COUNT(*) FROM sale WHERE sale.store_id = s.storeid) AS store_sales, (SELECT COUNT(*) FROM sale, employee, employee_department WHERE sale.employee_id = employee.employeeid AND employee_department.employee_id = employee.employeeid AND employee_department.department_id = d.departmentid ) AS department_sales, (SELECT COUNT(*) FROM employee, employee_department, department WHERE employee_department.employee_id = employee.employeeid AND employee_department.department_id = department.departmentid AND department.store_id = s.storeid ) AS store_employees, (SELECT COUNT(*) FROM employee, employee_department WHERE employee_department.employee_id = employee.employeeid AND employee_department.department_id = d.departmentid ) AS department_employees FROM store s LEFT JOIN employee manager ON s.manager = manager.employeeid LEFT JOIN department d ON d.store_id = s.storeid LEFT JOIN employee department_head ON department_head.employeeid = d.department_head LEFT JOIN employee_department ed ON ed.department_id = d.departmentid LEFT JOIN employee e ON e.employeeid = ed.employee_id LEFT JOIN sale sa ON sa.employee_id = e.employeeid LEFT JOIN customer c ON c.customerid = sa.customer_id LEFT JOIN album al ON al.albumid = sa.album_id LEFT JOIN artist ar ON ar.artistid = al.artist_id", array( 'rootTag' => 'music_company', 'rowTag' => 'store', 'idColumn' => 'storeid', 'attributes' => array( 'storeid' ), 'elements' => array( 'store_sales', 'store_employees', 'manager' => array( 'idColumn' => 'manager_employeeid', 'attributes' => array( 'manager_employeeid' ), 'elements' => array( 'manager_employeename' ) ), 'address' => array( 'elements' => array( 'country', 'state' => '!return Helper::getStatePostalCode($record["state"]);', 'city', 'street', 'phone' ) ), 'department' => array( 'idColumn' => 'departmentid', 'attributes' => array( 'departmentid' ), 'elements' => array( 'department_sales', 'department_employees', 'departmentname', 'department_head' => array( 'idColumn' => 'department_head_employeeid', 'attributes' => array( 'department_head_employeeid' ), 'elements' => array( 'department_head_employeename' ) ), 'employees' => array( 'rootTag' => 'employees', 'rowTag' => 'employee', 'idColumn' => 'employeeid', 'attributes' => array( 'employeeid' ), 'elements' => array( 'employeename', 'sales' => array( 'rootTag' => 'sales', 'rowTag' => 'sale', 'idColumn' => 'saleid', 'attributes' => array( 'saleid' ), 'elements' => array( 'timestamp', 'customer' => array( 'idColumn' => 'customerid', 'attributes' => array( 'customerid' ), 'elements' => array( 'first_name', 'last_name', 'email' ) ), 'album' => array( 'idColumn' => 'albumid', 'attributes' => array( 'albumid' ), 'elements' => array( 'title', 'published_year', 'comment' => '?!return Helper::summarize($record["comment"], 12);', 'artist' => array( 'idColumn' => 'artistid', 'attributes' => array( 'artistid' ), 'elements' => array( 'name', 'birth_year', 'birth_place', 'genre' ) ) ) // album elements ) //album array ) //sales elements ) //sales array ) //employees elements ) //employees array ) //department elements ) // department array ) //root elements ) //root ); $root = $dom->firstChild; $root->setAttribute('date_generated', date("Y-m-d\TH:i:s", 1124801570)); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_company date_generated="2005-08-23T14:52:50"> <store storeid="1"> <store_sales>10</store_sales> <store_employees>6</store_employees> <manager manager_employeeid="1"> <manager_employeename>Michael Jones</manager_employeename> </manager> <address> <country>US</country> <state>NY</state> <city>New York</city> <street>Broadway & 72nd Str</street> <phone>123 456 7890</phone> </address> <department departmentid="1"> <department_sales>10</department_sales> <department_employees>3</department_employees> <departmentname>Sales</departmentname> <department_head department_head_employeeid="1"> <department_head_employeename>Michael Jones</department_head_employeename> </department_head> <employees> <employee employeeid="1"> <employeename>Michael Jones</employeename> <sales> <sale saleid="1"> <timestamp>2005-05-25 16:32:00</timestamp> <customer customerid="1"> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="7"> <timestamp>2005-07-10 15:03:00</timestamp> <customer customerid="7"> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="16"> <timestamp>2005-06-05 12:56:12</timestamp> <customer customerid="2"> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="19"> <timestamp>2005-07-10 16:03:01</timestamp> <customer customerid="8"> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee employeeid="2"> <employeename>Susi Weintraub</employeename> <sales> <sale saleid="3"> <timestamp>2005-07-10 11:03:00</timestamp> <customer customerid="3"> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="9"> <timestamp>2005-07-10 18:03:00</timestamp> <customer customerid="9"> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="17"> <timestamp>2005-07-10 10:03:32</timestamp> <customer customerid="4"> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="20"> <timestamp>2005-07-10 19:03:50</timestamp> <customer customerid="10"> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee employeeid="3"> <employeename>Steve Hack</employeename> <sales> <sale saleid="5"> <timestamp>2005-07-10 13:03:00</timestamp> <customer customerid="5"> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="18"> <timestamp>2005-07-10 14:03:52</timestamp> <customer customerid="6"> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> </employees> </department> <department departmentid="2"> <department_sales>0</department_sales> <department_employees>3</department_employees> <departmentname>Marketing</departmentname> <department_head department_head_employeeid="4"> <department_head_employeename>Joan Kerr</department_head_employeename> </department_head> <employees> <employee employeeid="4"> <employeename>Joan Kerr</employeename> <sales /> </employee> <employee employeeid="5"> <employeename>Marcus Roth</employeename> <sales /> </employee> <employee employeeid="6"> <employeename>Jack Mack</employeename> <sales /> </employee> </employees> </department> </store> <store storeid="2"> <store_sales>10</store_sales> <store_employees>6</store_employees> <manager manager_employeeid="2"> <manager_employeename>Susi Weintraub</manager_employeename> </manager> <address> <country>US</country> <state>NY</state> <city>Larchmont</city> <street>Palmer Ave 71</street> <phone>456 7890</phone> </address> <department departmentid="3"> <department_sales>10</department_sales> <department_employees>3</department_employees> <departmentname>Sales</departmentname> <department_head department_head_employeeid="7"> <department_head_employeename>Rita Doktor</department_head_employeename> </department_head> <employees> <employee employeeid="7"> <employeename>Rita Doktor</employeename> <sales> <sale saleid="2"> <timestamp>2005-06-05 12:56:00</timestamp> <customer customerid="2"> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="8"> <timestamp>2005-07-10 16:03:00</timestamp> <customer customerid="8"> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="11"> <timestamp>2005-05-25 16:23:00</timestamp> <customer customerid="1"> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="14"> <timestamp>2005-07-10 15:09:00</timestamp> <customer customerid="7"> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee employeeid="8"> <employeename>David Til</employeename> <sales> <sale saleid="4"> <timestamp>2005-07-10 10:03:00</timestamp> <customer customerid="4"> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="10"> <timestamp>2005-07-10 19:03:00</timestamp> <customer customerid="10"> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="12"> <timestamp>2005-07-10 11:56:00</timestamp> <customer customerid="3"> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="15"> <timestamp>2005-07-10 18:49:00</timestamp> <customer customerid="9"> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee employeeid="9"> <employeename>Pia Eist</employeename> <sales> <sale saleid="6"> <timestamp>2005-07-10 14:03:00</timestamp> <customer customerid="6"> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> <sale saleid="13"> <timestamp>2005-07-10 13:12:00</timestamp> <customer customerid="5"> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> </employees> </department> <department departmentid="4"> <department_sales>0</department_sales> <department_employees>3</department_employees> <departmentname>Marketing</departmentname> <department_head department_head_employeeid="10"> <department_head_employeename>Hanna Poll</department_head_employeename> </department_head> <employees> <employee employeeid="10"> <employeename>Hanna Poll</employeename> <sales /> </employee> <employee employeeid="11"> <employeename>Jim Wells</employeename> <sales /> </employee> <employee employeeid="12"> <employeename>Sandra Wilson</employeename> <sales /> </employee> </employees> </department> </store> </music_company> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case07.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case07.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case07.phpt --TEST-- XML_Query2XML::getXML(): Case07 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( '*', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( '*', 'artist_id' => '?:' ) ) ) ) ); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_library> <artist> <artistid>1</artistid> <name>Curtis Mayfield</name> <birth_year>1920</birth_year> <birth_place>Chicago</birth_place> <genre>Soul</genre> <albums> <album> <albumid>1</albumid> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ever!</comment> </album> <album> <albumid>2</albumid> <title>Curtis</title> <published_year>1970</published_year> <comment>that man's got somthin' to say</comment> </album> </albums> </artist> <artist> <artistid>2</artistid> <name>Isaac Hayes</name> <birth_year>1942</birth_year> <birth_place>Tennessee</birth_place> <genre>Soul</genre> <albums> <album> <albumid>3</albumid> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> </album> </albums> </artist> <artist> <artistid>3</artistid> <name>Ray Charles</name> <birth_year>1930</birth_year> <birth_place>Mississippi</birth_place> <genre>Country and Soul</genre> <albums /> </artist> </music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case08.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case08.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/case08.phpt --TEST-- XML_Query2XML::getXML(): Case08 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> <?php require_once dirname(dirname(__FILE__)) . '/skipif_XML_Beautifier.php'; ?> --FILE-- <?php class Mappers { public static function departmentMapper($str) { //maps 'one_two_three' to 'oneTwoThree' return preg_replace("/(_)([a-z])/e", "strtoupper('\\2')", $str); } public static function employeeMapper($str) { //maps 'one_two_three' to 'OneTwoThree' return ucfirst(preg_replace("/(_)([a-z])/e", "strtoupper('\\2')", $str)); } public function saleMapper($str) { //maps 'one_two_three' to 'ONETWOTHREE' return strtoupper(str_replace('_', '', $str)); } } /**Static class that provides validation and parsing methods for * generating XML. * * It is static so that we can easyly call its methods from inside * Query2XML using eval'd code. */ class Helper { /**Associative array of US postal state codes*/ public static $statePostalCodes = array( 'ALABAMA' => 'AL', 'ALASKA' => 'AK', 'AMERICAN SAMOA' => 'AS', 'ARIZONA' => 'AZ', 'ARKANSAS' => 'AR', 'CALIFORNIA' => 'CA', 'COLORADO' => 'CO', 'CONNECTICUT' => 'CT', 'DELAWARE' => 'DE', 'DISTRICT OF COLUMBIA' => 'DC', 'FEDERATED STATES OF MICRONESIA' => 'FM', 'FLORIDA' => 'FL', 'GEORGIA' => 'GA', 'GUAM' => 'GU', 'HAWAII' => 'HI', 'IDAHO' => 'ID', 'ILLINOIS' => 'IL', 'INDIANA' => 'IN', 'IOWA' => 'IA', 'KANSAS' => 'KS', 'KENTUCKY' => 'KY', 'LOUISIANA' => 'LA', 'MAINE' => 'ME', 'MARSHALL ISLANDS' => 'MH', 'MARYLAND' => 'MD', 'MASSACHUSETTS' => 'MA', 'MICHIGAN' => 'MI', 'MINNESOTA' => 'MN', 'MISSISSIPPI' => 'MS', 'MISSOURI' => 'MO', 'MONTANA' => 'MT', 'NEBRASKA' => 'NE', 'NEVADA' => 'NV', 'NEW HAMPSHIRE' => 'NH', 'NEW JERSEY' => 'NJ', 'NEW JESEY' => 'NJ', 'NEW MEXICO' => 'NM', 'NEW YORK' => 'NY', 'NORTH CAROLINA' => 'NC', 'NORTH DAKOTA' => 'ND', 'NORTHERN MARIANA ISLANDS' => 'MP', 'OHIO' => 'OH', 'OKLAHOMA' => 'OK', 'OREGON' => 'OR', 'PALAU' => 'PW', 'PENNSYLVANIA' => 'PA', 'PUERTO RICO' => 'PR', 'RHODE ISLAND' => 'RI', 'SOUTH CAROLINA' => 'SC', 'SOUTH DAKOTA' => 'SD', 'TENNESSEE' => 'TN', 'TEXAS' => 'TX', 'UTAH' => 'UT', 'VERMONT' => 'VT', 'VIRGIN ISLANDS' => 'VI', 'VIRGINIA' => 'VA', 'WASHINGTON' => 'WA', 'WEST VIRGINIA' => 'WV', 'WISCONSIN' => 'WI', 'WYOMING' => 'WY' ); /**Translates a US state name into its two-letter postal code. * If the translation fails, $state is returned unchanged * @param $state The state's name */ public static function getStatePostalCode($state) { $s = str_replace(" ", " ", trim(strtoupper($state))); if (isset(self::$statePostalCodes[$s])) { return self::$statePostalCodes[$s]; } else { return $state; } } function summarize($str, $limit=50, $appendString=' ...') { if (strlen($str) > $limit) { $str = substr($str, 0, $limit - strlen($appendString)) . $appendString; } return $str; } } function mapArtist($str) { //maps 'one_two_three' to 'onetwothree' return strtolower(str_replace('_', '', $str)); } require_once 'XML/Query2XML.php'; require_once 'XML/Query2XML/ISO9075Mapper.php'; require_once('XML/Beautifier.php'); require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $myMappers = new Mappers(); $dom =& $query2xml->getXML( "SELECT s.*, manager.employeeid AS manager_employeeid, manager.employeename AS manager_employeename, d.*, department_head.employeeid AS department_head_employeeid, department_head.employeename AS department_head_employeename, e.*, sa.*, c.*, al.*, ar.*, (SELECT COUNT(*) FROM sale WHERE sale.store_id = s.storeid) AS store_sales, (SELECT COUNT(*) FROM sale, employee, employee_department WHERE sale.employee_id = employee.employeeid AND employee_department.employee_id = employee.employeeid AND employee_department.department_id = d.departmentid ) AS department_sales, (SELECT COUNT(*) FROM employee, employee_department, department WHERE employee_department.employee_id = employee.employeeid AND employee_department.department_id = department.departmentid AND department.store_id = s.storeid ) AS store_employees, (SELECT COUNT(*) FROM employee, employee_department WHERE employee_department.employee_id = employee.employeeid AND employee_department.department_id = d.departmentid ) AS department_employees FROM store s LEFT JOIN employee manager ON s.manager = manager.employeeid LEFT JOIN department d ON d.store_id = s.storeid LEFT JOIN employee department_head ON department_head.employeeid = d.department_head LEFT JOIN employee_department ed ON ed.department_id = d.departmentid LEFT JOIN employee e ON e.employeeid = ed.employee_id LEFT JOIN sale sa ON sa.employee_id = e.employeeid LEFT JOIN customer c ON c.customerid = sa.customer_id LEFT JOIN album al ON al.albumid = sa.album_id LEFT JOIN artist ar ON ar.artistid = al.artist_id", array( 'rootTag' => 'music_company', 'rowTag' => 'store', 'idColumn' => 'storeid', 'mapper' => 'strtoupper', 'attributes' => array( 'storeid' ), 'elements' => array( 'store_sales', 'store_employees', 'manager' => array( 'idColumn' => 'manager_employeeid', 'attributes' => array( 'manager_employeeid' ), 'elements' => array( 'manager_employeename' ) ), 'address' => array( 'elements' => array( 'country', 'state' => '!return Helper::getStatePostalCode($record["state"]);', 'city', 'street', 'phone' ) ), 'department' => array( 'idColumn' => 'departmentid', 'mapper' => 'Mappers::departmentMapper', 'attributes' => array( 'departmentid' ), 'elements' => array( 'department_sales', 'department_employees', 'departmentname', 'department_head' => array( 'idColumn' => 'department_head_employeeid', 'attributes' => array( 'department_head_employeeid' ), 'elements' => array( 'department_head_employeename' ) ), 'employees' => array( 'rootTag' => 'employees', 'rowTag' => 'employee', 'idColumn' => 'employeeid', 'mapper' => array('Mappers', 'employeeMapper'), 'attributes' => array( 'employeeid' ), 'elements' => array( 'employeename', 'sales' => array( 'rootTag' => 'sales', 'rowTag' => 'sale', 'idColumn' => 'saleid', 'mapper' => array($myMappers, 'saleMapper'), 'attributes' => array( 'saleid' ), 'elements' => array( 'timestamp', 'customer' => array( 'idColumn' => 'customerid', 'mapper' => false, 'attributes' => array( 'customerid' ), 'elements' => array( 'first_name', 'last_name', 'email' ) ), 'album' => array( 'idColumn' => 'albumid', 'mapper' => 'XML_Query2XML_ISO9075Mapper::map', 'attributes' => array( 'albumid' ), 'elements' => array( 'title', 'published_year', 'comment' => '?!return Helper::summarize($record["comment"], 12);', 'artist' => array( 'idColumn' => 'artistid', 'mapper' => 'mapArtist', 'attributes' => array( 'artistid' ), 'elements' => array( 'name', 'birth_year', 'birth_place', 'genre' ) ) ) // album elements ) //album array ) //sales elements ) //sales array ) //employees elements ) //employees array ) //department elements ) // department array ) //root elements ) //root ); $root = $dom->firstChild; $root->setAttribute('date_generated', date("Y-m-d\TH:i:s", 1124801570)); $beautifier = new XML_Beautifier(); print $beautifier->formatString($dom->saveXML()); ?> --EXPECT-- <music_company date_generated="2005-08-23T14:52:50"> <store STOREID="1"> <STORE_SALES>10</STORE_SALES> <STORE_EMPLOYEES>6</STORE_EMPLOYEES> <manager MANAGER_EMPLOYEEID="1"> <MANAGER_EMPLOYEENAME>Michael Jones</MANAGER_EMPLOYEENAME> </manager> <address> <COUNTRY>US</COUNTRY> <STATE>NY</STATE> <CITY>New York</CITY> <STREET>Broadway & 72nd Str</STREET> <PHONE>123 456 7890</PHONE> </address> <department departmentid="1"> <departmentSales>10</departmentSales> <departmentEmployees>3</departmentEmployees> <departmentname>Sales</departmentname> <department_head departmentHeadEmployeeid="1"> <departmentHeadEmployeename>Michael Jones</departmentHeadEmployeename> </department_head> <employees> <employee Employeeid="1"> <Employeename>Michael Jones</Employeename> <sales> <sale SALEID="1"> <TIMESTAMP>2005-05-25 16:32:00</TIMESTAMP> <customer customerid="1"> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="7"> <TIMESTAMP>2005-07-10 15:03:00</TIMESTAMP> <customer customerid="7"> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="16"> <TIMESTAMP>2005-06-05 12:56:12</TIMESTAMP> <customer customerid="2"> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="19"> <TIMESTAMP>2005-07-10 16:03:01</TIMESTAMP> <customer customerid="8"> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee Employeeid="2"> <Employeename>Susi Weintraub</Employeename> <sales> <sale SALEID="3"> <TIMESTAMP>2005-07-10 11:03:00</TIMESTAMP> <customer customerid="3"> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="9"> <TIMESTAMP>2005-07-10 18:03:00</TIMESTAMP> <customer customerid="9"> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="17"> <TIMESTAMP>2005-07-10 10:03:32</TIMESTAMP> <customer customerid="4"> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="20"> <TIMESTAMP>2005-07-10 19:03:50</TIMESTAMP> <customer customerid="10"> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee Employeeid="3"> <Employeename>Steve Hack</Employeename> <sales> <sale SALEID="5"> <TIMESTAMP>2005-07-10 13:03:00</TIMESTAMP> <customer customerid="5"> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="18"> <TIMESTAMP>2005-07-10 14:03:52</TIMESTAMP> <customer customerid="6"> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> </customer> <album albumid="3"> <title>Shaft</title> <published_year>1972</published_year> <comment>he's the man</comment> <artist artistid="2"> <name>Isaac Hayes</name> <birthyear>1942</birthyear> <birthplace>Tennessee</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> </employees> </department> <department departmentid="2"> <departmentSales>0</departmentSales> <departmentEmployees>3</departmentEmployees> <departmentname>Marketing</departmentname> <department_head departmentHeadEmployeeid="4"> <departmentHeadEmployeename>Joan Kerr</departmentHeadEmployeename> </department_head> <employees> <employee Employeeid="4"> <Employeename>Joan Kerr</Employeename> <sales /> </employee> <employee Employeeid="5"> <Employeename>Marcus Roth</Employeename> <sales /> </employee> <employee Employeeid="6"> <Employeename>Jack Mack</Employeename> <sales /> </employee> </employees> </department> </store> <store STOREID="2"> <STORE_SALES>10</STORE_SALES> <STORE_EMPLOYEES>6</STORE_EMPLOYEES> <manager MANAGER_EMPLOYEEID="2"> <MANAGER_EMPLOYEENAME>Susi Weintraub</MANAGER_EMPLOYEENAME> </manager> <address> <COUNTRY>US</COUNTRY> <STATE>NY</STATE> <CITY>Larchmont</CITY> <STREET>Palmer Ave 71</STREET> <PHONE>456 7890</PHONE> </address> <department departmentid="3"> <departmentSales>10</departmentSales> <departmentEmployees>3</departmentEmployees> <departmentname>Sales</departmentname> <department_head departmentHeadEmployeeid="7"> <departmentHeadEmployeename>Rita Doktor</departmentHeadEmployeename> </department_head> <employees> <employee Employeeid="7"> <Employeename>Rita Doktor</Employeename> <sales> <sale SALEID="2"> <TIMESTAMP>2005-06-05 12:56:00</TIMESTAMP> <customer customerid="2"> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="8"> <TIMESTAMP>2005-07-10 16:03:00</TIMESTAMP> <customer customerid="8"> <first_name>Ed</first_name> <last_name>Burton</last_name> <email>ed.burton@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="11"> <TIMESTAMP>2005-05-25 16:23:00</TIMESTAMP> <customer customerid="1"> <first_name>Jane</first_name> <last_name>Doe</last_name> <email>jane.doe@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="14"> <TIMESTAMP>2005-07-10 15:09:00</TIMESTAMP> <customer customerid="7"> <first_name>Nick</first_name> <last_name>Fallow</last_name> <email>nick.fallow@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee Employeeid="8"> <Employeename>David Til</Employeename> <sales> <sale SALEID="4"> <TIMESTAMP>2005-07-10 10:03:00</TIMESTAMP> <customer customerid="4"> <first_name>Victoria</first_name> <last_name>Alt</last_name> <email>victory.alt@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="10"> <TIMESTAMP>2005-07-10 19:03:00</TIMESTAMP> <customer customerid="10"> <first_name>Maria</first_name> <last_name>Gonzales</last_name> <email>maria.gonzales@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="12"> <TIMESTAMP>2005-07-10 11:56:00</TIMESTAMP> <customer customerid="3"> <first_name>Susan</first_name> <last_name>Green</last_name> <email>susan.green@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="15"> <TIMESTAMP>2005-07-10 18:49:00</TIMESTAMP> <customer customerid="9"> <first_name>Jack</first_name> <last_name>Woo</last_name> <email>jack.woo@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> <employee Employeeid="9"> <Employeename>Pia Eist</Employeename> <sales> <sale SALEID="6"> <TIMESTAMP>2005-07-10 14:03:00</TIMESTAMP> <customer customerid="6"> <first_name>Tim</first_name> <last_name>Raw</last_name> <email>tim.raw@example.com</email> </customer> <album albumid="1"> <title>New World Order</title> <published_year>1990</published_year> <comment>the best ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> <sale SALEID="13"> <TIMESTAMP>2005-07-10 13:12:00</TIMESTAMP> <customer customerid="5"> <first_name>Will</first_name> <last_name>Rippy</last_name> <email>will.wippy@example.com</email> </customer> <album albumid="2"> <title>Curtis</title> <published_year>1970</published_year> <comment>that man ...</comment> <artist artistid="1"> <name>Curtis Mayfield</name> <birthyear>1920</birthyear> <birthplace>Chicago</birthplace> <genre>Soul</genre> </artist> </album> </sale> </sales> </employee> </employees> </department> <department departmentid="4"> <departmentSales>0</departmentSales> <departmentEmployees>3</departmentEmployees> <departmentname>Marketing</departmentname> <department_head departmentHeadEmployeeid="10"> <departmentHeadEmployeename>Hanna Poll</departmentHeadEmployeename> </department_head> <employees> <employee Employeeid="10"> <Employeename>Hanna Poll</Employeename> <sales /> </employee> <employee Employeeid="11"> <Employeename>Jim Wells</Employeename> <sales /> </employee> <employee Employeeid="12"> <Employeename>Sandra Wilson</Employeename> <sales /> </employee> </employees> </department> </store> </music_company> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with complex query specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'name', 'firstAlbumTitle' => array( 'value' => 'title', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ) ), 'firstAlbumYear' => array( 'value' => 'published_year', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist name="Curtis Mayfield" firstAlbumTitle="New World Order" firstAlbumYear="1990"/><artist name="Isaac Hayes" firstAlbumTitle="Shaft" firstAlbumYear="1972"/><artist name="Ray Charles"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification_valuePHPCode.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification_valuePHPCode.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_complexQuerySpecification_valuePHPCode.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with complex query specification using PHP code as value --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'name', 'firstAlbumTitle' => array( 'value' => 'title', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ) ), 'firstAlbumYear' => array( 'value' => 'published_year', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ) ), 'firstAlbumGenre' => array( 'value' => '!return $record["genre"] . " of " . $record["published_year"];', 'sql' => array( 'data' => array( 'artistid' ), 'query' => "SELECT * FROM album WHERE artist_id = ?" ), 'sql_options' => array( 'merge' => true ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist name="Curtis Mayfield" firstAlbumTitle="New World Order" firstAlbumYear="1990" firstAlbumGenre="Soul of 1990"/><artist name="Isaac Hayes" firstAlbumTitle="Shaft" firstAlbumYear="1972" firstAlbumGenre="Soul of 1972"/><artist name="Ray Charles"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_conditionOption.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_conditionOption.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_conditionOption.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with condition option --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'attr1' => array( 'value' => ':only for atistid 1', 'condition' => '$record["artistid"] == 1' ), 'attr2' => array( 'value' => ':only for atistid 2', 'condition' => '$record["artistid"] == 2' ), 'attr3' => array( 'value' => ':only for atistid 3', 'condition' => '$record["artistid"] == 3' ), 'name' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist attr1="only for atistid 1" name="Curtis Mayfield"/><artist attr2="only for atistid 2" name="Isaac Hayes"/><artist attr3="only for atistid 3" name="Ray Charles"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_simpleQuerySpecification.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_simpleQuerySpecification.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_simpleQuerySpecification.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with simple query specification --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'name', 'firstAlbumTitle' => array( 'value' => 'title', 'sql' => 'SELECT * FROM album WHERE artist_id = {$record["artistid"]}' ), 'firstAlbumYear' => array( 'value' => 'published_year', 'sql' => 'SELECT * FROM album WHERE artist_id = {$record["artistid"]}' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist name="Curtis Mayfield" firstAlbumTitle="New World Order" firstAlbumYear="1990"/><artist name="Isaac Hayes" firstAlbumTitle="Shaft" firstAlbumYear="1972"/><artist name="Ray Charles"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_valuePrefixes.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_valuePrefixes.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexAttributeSpecification_valuePrefixes.phpt --TEST-- XML_Query2XML::getXML(): complex attribute specification with value prefixes --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'attributes' => array( 'static' => array( 'value' => ':some static text', ), 'hide' => array( 'value' => '?:' ), 'six' => array( 'value' => '!return 2 * 3;' ), 'hide2' => array( 'value' => '?!return "";' ), 'artistid' => array( 'value' => 'artistid' ), 'genre' => array( 'value' => '!return strtoupper($record["genre"]);' ), 'birth_year' => array( 'value' => '?birth_year' ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist static="some static text" six="6" artistid="1" genre="SOUL" birth_year="1920"/><artist static="some static text" six="6" artistid="2" genre="SOUL" birth_year="1942"/><artist static="some static text" six="6" artistid="3" genre="COUNTRY AND SOUL" birth_year="1930"/></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption1.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption1.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption1.phpt --TEST-- XML_Query2XML::getXML(): complex element specification with "condition" option #1 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'condition' => '$record["artistid"] != 3', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption2.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption2.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/complexElementSpecification_conditionOption2.phpt --TEST-- XML_Query2XML::getXML(): complex element specification with "condition" option #2 --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'condition' => '$record["albumid"] != 1', 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_columnName.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_columnName.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_columnName.phpt --TEST-- XML_Query2XML::getXML(): simple attribute - condition prefix with column name --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ), 'attributes' => array( 'artistid', 'name', 'test' => '?test' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield"><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist artistid="2" name="Isaac Hayes"><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist artistid="3" name="Ray Charles"><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul! </genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_phpCode.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_phpCode.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_phpCode.phpt --TEST-- XML_Query2XML::getXML(): simple attribute - condition prefix with PHP code --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ), 'attributes' => array( 'artistid', 'name', 'test' => '?!return "";' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield"><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist artistid="2" name="Isaac Hayes"><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist artistid="3" name="Ray Charles"><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul! </genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_staticText.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_staticText.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_attribute_staticText.phpt --TEST-- XML_Query2XML::getXML(): simple attribute - condition prefix with static text --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ), 'attributes' => array( 'artistid', 'name', 'test' => '?:' ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist artistid="1" name="Curtis Mayfield"><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist artistid="2" name="Isaac Hayes"><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist artistid="3" name="Ray Charles"><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul! </genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_columnName.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_columnName.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_columnName.phpt --TEST-- XML_Query2XML::getXML(): simple element - condition prefix with column name --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', 'test' => '?test' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_phpCode.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_phpCode.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_phpCode.phpt --TEST-- XML_Query2XML::getXML(): simple element - condition prefix with PHP code --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', 'test' => '?!return "";' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_staticText.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_staticText.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_element_staticText.phpt --TEST-- XML_Query2XML::getXML(): simple element - condition prefix with static text --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', 'test' => '?:' ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums><album><albumid>1</albumid><title>New World Order</title><published_year>1990</published_year><comment>the best ever!</comment></album><album><albumid>2</albumid><title>Curtis</title><published_year>1970</published_year><comment>that man's got somthin' to say</comment></album></albums></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums><album><albumid>3</albumid><title>Shaft</title><published_year>1972</published_year><comment>he's the man</comment></album></albums></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_columnName.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_columnName.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_columnName.phpt --TEST-- XML_Query2XML::getXML(): value - condition prefix with column name --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT artist.*, album.*, '' AS test FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'value' => '?test', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_phpCode.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_phpCode.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_phpCode.phpt --TEST-- XML_Query2XML::getXML(): value - condition prefix with PHP code --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'value' => '?!return "";', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_staticText.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_staticText.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/conditionPrefix_value_staticText.phpt --TEST-- XML_Query2XML::getXML(): value - condition prefix with static text --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $dom =& $query2xml->getXML( "SELECT * FROM artist LEFT JOIN album ON album.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'value' => '?:', 'elements' => array( 'albumid', 'title', 'published_year', 'comment', ) ) ) ) ); print $dom->saveXML(); ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> <music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>Soul</genre><albums/></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>Country and Soul</genre><albums/></artist></music_library> http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/throwDBException.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/throwDBException.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/getXML/throwDBException.phpt --TEST-- XML_Query2XML::getXML(): check for XML_Query2XML_DBException - $sql argument contains invalid query --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; try { $query2xml =& XML_Query2XML::factory($db); $query2xml->getXML( "SELECT * FROM artist LEFT JOIN non_existing_table ON non_existing_table.artist_id = artist.artistid", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); } catch (XML_Query2XML_DBException $e) { echo get_class($e) . ': ' . substr($e->getMessage(), 0, 199); } ?> --EXPECT-- XML_Query2XML_DBException: Could not run the following SQL query: SELECT * FROM artist LEFT JOIN non_existing_table ON non_existing_table.artist_id = artist.artistid http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/startProfiling/startProfiling.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/startProfiling/startProfiling.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/startProfiling/startProfiling.phpt --TEST-- XML_Query2XML::startProfiling() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); print count($query2xml->getRawProfile()); $query2xml->clearProfile(); ?> --EXPECT-- 6 http://cvs.php.net/viewvc.cgi/pear/XML_Query2XML/tests/XML_Query2XML/DB/stopProfiling/stopProfiling.phpt?view=markup&rev=1.1 Index: pear/XML_Query2XML/tests/XML_Query2XML/DB/stopProfiling/stopProfiling.phpt +++ pear/XML_Query2XML/tests/XML_Query2XML/DB/stopProfiling/stopProfiling.phpt --TEST-- XML_Query2XML::stopProfiling() --SKIPIF-- <?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?> --FILE-- <?php require_once 'XML/Query2XML.php'; require_once dirname(dirname(__FILE__)) . '/db_init.php'; $query2xml =& XML_Query2XML::factory($db); $query2xml->startProfiling(); $query2xml->stopProfiling(); $dom =& $query2xml->getXML( "SELECT * FROM artist", array( 'rootTag' => 'music_library', 'rowTag' => 'artist', 'idColumn' => 'artistid', 'elements' => array( 'artistid', 'name', 'birth_year', 'birth_place', 'genre', 'albums' => array( 'sql' => array( 'data' => array( 'artistid' ), 'query' => 'SELECT * FROM album WHERE artist_id = ?' ), 'sql_options' => array( 'uncached' => true, 'single_record' => false, 'merge' => false, 'merge_master' => false ), 'rootTag' => 'albums', 'rowTag' => 'album', 'idColumn' => 'albumid', 'elements' => array( 'albumid', 'title', 'published_year', 'comment' ) ) ) ) ); $profile = $query2xml->getRawProfile(); print count($profile['queries']) ?> --EXPECT-- 0