Changeset 45580 for trunk/tests/phpunit/includes/utils.php
- Timestamp:
- 07/01/2019 08:00:12 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/utils.php
r43653 r45580 183 183 // convert valid xml to an array tree structure 184 184 // kinda lame but it works with a default php 4 installation 185 class testXMLParser {185 class TestXMLParser { 186 186 var $xml; 187 187 var $data = array(); … … 194 194 xml_set_object( $this->xml, $this ); 195 195 xml_parser_set_option( $this->xml, XML_OPTION_CASE_FOLDING, 0 ); 196 xml_set_element_handler( $this->xml, array( $this, 'start Handler' ), array( $this, 'endHandler' ) );197 xml_set_character_data_handler( $this->xml, array( $this, 'data Handler' ) );196 xml_set_element_handler( $this->xml, array( $this, 'start_handler' ), array( $this, 'end_handler' ) ); 197 xml_set_character_data_handler( $this->xml, array( $this, 'data_handler' ) ); 198 198 $this->parse( $in ); 199 199 } … … 215 215 } 216 216 217 function start Handler( $parser, $name, $attributes ) {217 function start_handler( $parser, $name, $attributes ) { 218 218 $data['name'] = $name; 219 219 if ( $attributes ) { … … 222 222 } 223 223 224 function data Handler( $parser, $data ) {224 function data_handler( $parser, $data ) { 225 225 $index = count( $this->data ) - 1; 226 226 @$this->data[ $index ]['content'] .= $data; 227 227 } 228 228 229 function end Handler( $parser, $name ) {229 function end_handler( $parser, $name ) { 230 230 if ( count( $this->data ) > 1 ) { 231 231 $data = array_pop( $this->data ); … … 237 237 238 238 function xml_to_array( $in ) { 239 $p = new testXMLParser( $in );239 $p = new TestXMLParser( $in ); 240 240 return $p->data; 241 241 }
Note: See TracChangeset
for help on using the changeset viewer.