jenkins-bot has submitted this change and it was merged. ( 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(-) Approvals: Mepps: Looks good to me, approved jenkins-bot: Verified 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: merged Gerrit-Change-Id: Ib7657a72081d35df22feddfffe7a24de3e290230 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com> Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org> Gerrit-Reviewer: Mepps <me...@wikimedia.org> Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits