Ejegg has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/363373 )
Change subject: Don't tie mock PayPal API to one specific test
......................................................................
Don't tie mock PayPal API to one specific test
This way, you can even use it in manual IPN testing in case you
don't actually want to hit the IPN verification URL
Change-Id: Ic2e67022bb8c41740ab5de46095817159d0ab83e
---
M PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
M PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
2 files changed, 10 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig
refs/changes/73/363373/1
diff --git a/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
b/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
index e35a52c..88948da 100644
--- a/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
+++ b/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
@@ -3,11 +3,15 @@
use SmashPig\PaymentProviders\PayPal\PayPalPaymentsAPI;
class MockPayPalPaymentsAPI extends PayPalPaymentsAPI {
+
+ static $fail_verification = false;
+ static $paypal_is_broken = false;
+
protected function curl ( $ch, $post_fields ) {
- if ( CaptureIncomingMessageTest::$fail_verification ) {
+ if ( self::$fail_verification ) {
return 'INVALID';
}
- if ( CaptureIncomingMessageTest::$paypal_is_broken ) {
+ if ( self::$paypal_is_broken ) {
return 'lkjasjdhfiuasdgjgbasdd';
}
return 'VERIFIED';
diff --git
a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
index 2b08ef4..2fb9eb5 100644
--- a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
+++ b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
@@ -21,9 +21,6 @@
*/
public $config;
- static $fail_verification = false;
- static $paypal_is_broken = false;
-
// filename and the queue it should get dropped in
static $message_data = array(
'web_accept.json' => 'donations',
@@ -49,8 +46,8 @@
}
public function tearDown() {
- self::$fail_verification = false;
- self::$paypal_is_broken = false;
+ MockPayPalPaymentsAPI::$fail_verification = false;
+ MockPayPalPaymentsAPI::$paypal_is_broken = false;
parent::tearDown();
}
@@ -146,7 +143,7 @@
}
public function testFailedVerification() {
- self::$fail_verification = true;
+ MockPayPalPaymentsAPI::$fail_verification = true;
$jobMessage = array( 'txn_type' => 'fail' );
$this->assertFalse( $this->capture( $jobMessage ) );
}
@@ -154,7 +151,7 @@
// FIXME: not really testing anything. Would like to verify that it
tried
// N times. Bubble that information up somehow.
public function testPayPalIsBroken() {
- self::$paypal_is_broken = true;
+ MockPayPalPaymentsAPI::$paypal_is_broken = true;
$jobMessage = array( 'txn_type' => 'fail' );
$this->assertFalse( $this->capture( $jobMessage ) );
}
--
To view, visit https://gerrit.wikimedia.org/r/363373
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2e67022bb8c41740ab5de46095817159d0ab83e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits