Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366158 )

Change subject: Move message cleaning function to base test
......................................................................

Move message cleaning function to base test

Change-Id: Ib7657a72081d35df22feddfffe7a24de3e290230
---
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M tests/phpunit/DonationInterfaceTestCase.php
3 files changed, 14 insertions(+), 16 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/58/366158/1

diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
index 285495d..0247286 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectApiTest.php
@@ -29,11 +29,10 @@
                $this->assertNotEmpty( $match, 'GC API not setting proper 
return url' );
                $message = DonationQueue::instance()->pop( 'pending' );
                $this->assertNotNull( $message, 'Not sending a message to the 
pending queue' );
-               SourceFields::removeFromMessage( $message );
+               DonationInterfaceTestCase::unsetVariableFields( $message );
                $expected = array(
                        'gateway_txn_id' => '626113410',
                        'response' => 'Response Status: 20',
-                       'gateway_account' => 'test',
                        'fee' => 0,
                        'utm_source' => '..cc',
                        'language' => 'en',
diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
index 35b9b6a..7ea9f12 100644
--- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
+++ b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
@@ -31,15 +31,6 @@
                ) );
        }
 
-       protected function unsetVariableFields( &$message ) {
-               $fields = array(
-                       'date', 'source_enqueued_time', 'source_host', 
'source_run_id', 'source_version', 'gateway_account'
-               );
-               foreach ( $fields as $field ) {
-                       unset( $message[$field] );
-               }
-       }
-
        function testPaymentSetup() {
                $init = array(
                        'amount' => 1.55,
@@ -62,7 +53,7 @@
                );
                $message = DonationQueue::instance()->pop( 'pending' );
                $this->assertNotEmpty( $message, 'Missing pending message' );
-               $this->unsetVariableFields( $message );
+               self::unsetVariableFields( $message );
                $expected = array(
                        'country' => 'US',
                    'fee' => '0',
@@ -110,7 +101,7 @@
 
                $message = DonationQueue::instance()->pop( 'donations' );
                $this->assertNotNull( $message, 'Not sending a message to the 
donations queue' );
-               $this->unsetVariableFields( $message );
+               self::unsetVariableFields( $message );
                $expected = array (
                        'contribution_tracking_id' => 
$init['contribution_tracking_id'],
                        'country' => 'US',
@@ -160,8 +151,8 @@
 
                $message = DonationQueue::instance()->pop( 'donations' );
                $this->assertNotNull( $message, 'Not sending a message to the 
donations queue' );
-               $this->unsetVariableFields( $message );
-               $expected = array (
+               self::unsetVariableFields( $message );
+               $expected = array(
                        'contribution_tracking_id' => 
$init['contribution_tracking_id'],
                        'country' => 'US',
                        'fee' => '0',
diff --git a/tests/phpunit/DonationInterfaceTestCase.php 
b/tests/phpunit/DonationInterfaceTestCase.php
index c3548ae..a418960 100644
--- a/tests/phpunit/DonationInterfaceTestCase.php
+++ b/tests/phpunit/DonationInterfaceTestCase.php
@@ -19,7 +19,6 @@
 use SmashPig\Core\Context;
 use SmashPig\Tests\TestingContext;
 use SmashPig\Tests\TestingGlobalConfiguration;
-use SmashPig\Tests\TestingProviderConfiguration;
 use Wikimedia\TestingAccessWrapper;
 
 /**
@@ -710,4 +709,13 @@
                }
                return $innerHTML;
        }
+
+       public static function unsetVariableFields( &$message ) {
+               $fields = array(
+                       'date', 'source_enqueued_time', 'source_host', 
'source_run_id', 'source_version', 'gateway_account'
+               );
+               foreach ( $fields as $field ) {
+                       unset( $message[$field] );
+               }
+       }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7657a72081d35df22feddfffe7a24de3e290230
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <ej...@ejegg.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to