Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/150897
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(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/97/150897/1
diff --git a/tests/Adapter/WorldPay/WorldPayTestCase.php
b/tests/Adapter/WorldPay/WorldPayTestCase.php
index 6131732..b8c50d0 100644
--- a/tests/Adapter/WorldPay/WorldPayTestCase.php
+++ b/tests/Adapter/WorldPay/WorldPayTestCase.php
@@ -135,7 +135,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 fa8f751..f71dfb7 100644
--- a/tests/DonationInterfaceTestCase.php
+++ b/tests/DonationInterfaceTestCase.php
@@ -396,10 +396,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') );
@@ -483,4 +483,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: newchange
Gerrit-Change-Id: I533f60c233a590f651b689741e45630697fa9128
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits