jenkins-bot has submitted this change and it was merged.

Change subject: Get innerHTML correctly in DI node assertions
......................................................................


Get innerHTML correctly in DI node assertions

Change-Id: I533f60c233a590f651b689741e45630697fa9128
---
M tests/Adapter/WorldPay/WorldPayTestCase.php
M tests/DonationInterfaceTestCase.php
2 files changed, 11 insertions(+), 3 deletions(-)

Approvals:
  Awight: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/Adapter/WorldPay/WorldPayTestCase.php 
b/tests/Adapter/WorldPay/WorldPayTestCase.php
index 10a22fd..389cd3c 100644
--- a/tests/Adapter/WorldPay/WorldPayTestCase.php
+++ b/tests/Adapter/WorldPay/WorldPayTestCase.php
@@ -140,7 +140,7 @@
                        ),
                        'informationsharing' => array (
                                'nodename' => 'p',
-                               'innerhtml' => 'By donating, you are sharing 
your information with the Wikimedia Foundation, the nonprofit organization that 
hosts Wikipedia and other Wikimedia projects, and its service providers in the 
U.S. and elsewhere pursuant to our donor privacy policy. We do not sell or 
trade your information to anyone. For more information please read our donor 
policy.',
+                               'innerhtml' => 'By donating, you are sharing 
your information with the Wikimedia Foundation, the nonprofit organization that 
hosts Wikipedia and other Wikimedia projects, and its service providers in the 
U.S. and elsewhere pursuant to our donor privacy policy. We do not sell or 
trade your information to anyone. For more information please read <a 
href="//wikimediafoundation.org/wiki/Donor_policy/en">our donor policy</a>.',
                        ),
                );
 
diff --git a/tests/DonationInterfaceTestCase.php 
b/tests/DonationInterfaceTestCase.php
index ab26907..73825fa 100644
--- a/tests/DonationInterfaceTestCase.php
+++ b/tests/DonationInterfaceTestCase.php
@@ -401,10 +401,10 @@
                                                $this->assertEquals( $expected, 
$input_node->nodeName, "The node with id '$id' is not an '$expected'. It is a " 
. $input_node->nodeName );
                                                break;
                                        case 'innerhtml':
-                                               $this->assertEquals( $expected, 
$input_node->nodeValue, "The node with id '$id' does not have value 
'$expected'. It has value " . $input_node->nodeValue );
+                                               $this->assertEquals( $expected, 
self::getInnerHTML( $input_node ), "The node with id '$id' does not have value 
'$expected'. It has value " . self::getInnerHTML( $input_node ) );
                                                break;
                                        case 'innerhtmlmatches':
-                                               $this->assertEquals( 1, 
preg_match($expected, $input_node->nodeValue), "Value of the node with id '$id' 
does not match pattern '$expected'. It has value " . $input_node->nodeValue );
+                                               $this->assertEquals( 1, 
preg_match( $expected, self::getInnerHTML( $input_node ) ), "Value of the node 
with id '$id' does not match pattern '$expected'. It has value " . 
self::getInnerHTML( $input_node ) );
                                                break;
                                        case 'value':
                                                $this->assertEquals( $expected, 
$input_node->getAttribute('value'), "The node with id '$id' does not have value 
'$expected'. It has value " . $input_node->getAttribute('value') );
@@ -488,4 +488,12 @@
                return $return;
        }
 
+       static function getInnerHTML( $node ) {
+               $innerHTML = '';
+               $children = $node->childNodes;
+               foreach ( $children as $child ) {
+                       $innerHTML .= $child->ownerDocument->saveXML( $child );
+               }
+               return $innerHTML;
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/150897
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I533f60c233a590f651b689741e45630697fa9128
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to