DAT-3331 update comment, reformat

This commit is contained in:
idradm 2016-01-04 15:57:25 +01:00
parent 5f42ce9742
commit c477600b9d

View file

@ -215,10 +215,14 @@ class PortableInfoboxParserTagControllerTest extends WikiaBaseTest {
$result = [ ]; $result = [ ];
$xpath = $this->getXPath( $output ); $xpath = $this->getXPath( $output );
// get all data nodes from parsed infobox
$dataNodes = $xpath->query( '//aside/div[contains(@class,\'pi-data\')]' ); $dataNodes = $xpath->query( '//aside/div[contains(@class,\'pi-data\')]' );
for ( $i = 0; $i < $dataNodes->length; $i++ ) { for ( $i = 0; $i < $dataNodes->length; $i++ ) {
$result[ $xpath->query( 'h3[contains(@class, \'pi-data-label\')]', $dataNodes->item( $i ) )->item( 0 )->nodeValue ] = // get map of label => value from parsed data node
$xpath->query( 'div[contains(@class, \'pi-data-value\')]', $dataNodes->item( $i ) )->item( 0 )->nodeValue; $result[ $xpath->query( 'h3[contains(@class, \'pi-data-label\')]', $dataNodes->item( $i ) )
->item( 0 )->nodeValue ] =
$xpath->query( 'div[contains(@class, \'pi-data-value\')]', $dataNodes->item( $i ) )
->item( 0 )->nodeValue;
} }
$this->assertEquals( $expected, $result ); $this->assertEquals( $expected, $result );