Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312539

Change subject: Merge branch 'master' into deployment
......................................................................

Merge branch 'master' into deployment

and delete tests

a2719e4 Test Configuration merge edge case
f7e6308 Fix undefined date warning
9da5847 Move jobs-paypal under default queue key
4d1bb55 Add recurring PayPal test
d0ecdda Add placeholder class for NotificationOfFraud messages

Change-Id: I5c9a3c9a6012d808197313d26bf3e2fefda2c74f
---
D PaymentProviders/PayPal/Tests/Data/subscr_payment.json
D PaymentProviders/PayPal/Tests/Data/subscr_signup.json
D PaymentProviders/PayPal/Tests/Data/web_accept.json
D PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
D PaymentProviders/PayPal/Tests/PayPalTestConfiguration.php
D PaymentProviders/PayPal/Tests/config_test.yaml
D PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
D Tests/ConfigurationTest.php
8 files changed, 0 insertions(+), 356 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/39/312539/1

diff --git a/PaymentProviders/PayPal/Tests/Data/subscr_payment.json 
b/PaymentProviders/PayPal/Tests/Data/subscr_payment.json
deleted file mode 100644
index f4bafc6..0000000
--- a/PaymentProviders/PayPal/Tests/Data/subscr_payment.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
-    "mc_gross": "1.03",
-    "protection_eligibility": "Eligible",
-    "address_status": "confirmed",
-    "payer_id": "XXXXXXXXXXXXX",
-    "address_street": "123 Only Kidding",
-    "payment_date": "16:03:13 Sep 21, 2016 PDT",
-    "payment_status": "Completed",
-    "charset": "UTF-8",
-    "address_zip": "99999",
-    "first_name": "Joe",
-    "mc_fee": "0.27",
-    "address_country_code": "US",
-    "address_name": "Joe Camel",
-    "notify_version": "3.8",
-    "subscr_id": "S-XXXXXXXXXXXXXXXXX",
-    "custom": "7373",
-    "payer_status": "verified",
-    "business": "nob...@wikimedia.org",
-    "address_country": "United States",
-    "address_city": "Maynardsville",
-    "verify_sign": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-    "payer_email": "i...@google.net",
-    "txn_id": "77777777777777777",
-    "payment_type": "instant",
-    "payer_business_name": "Joe Camel",
-    "last_name": "Camel",
-    "address_state": "CA",
-    "receiver_email": "nob...@wikimedia.org",
-    "payment_fee": "0.27",
-    "receiver_id": "7777777777777",
-    "txn_type": "subscr_payment",
-    "item_name": "Donation to the Wikimedia Foundation",
-    "mc_currency": "USD",
-    "item_number": "DONATE",
-    "residence_country": "US",
-    "transaction_subject": "7373",
-    "payment_gross": "1.03",
-    "ipn_track_id": "7777777777777",
-    "date": "",
-    "gateway": "paypal"
-}
diff --git a/PaymentProviders/PayPal/Tests/Data/subscr_signup.json 
b/PaymentProviders/PayPal/Tests/Data/subscr_signup.json
deleted file mode 100644
index 8a3b197..0000000
--- a/PaymentProviders/PayPal/Tests/Data/subscr_signup.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
-    "amount3": "1.03",
-    "address_status": "confirmed",
-    "subscr_date": "16:03:11 Sep 21, 2016 PDT",
-    "payer_id": "XXXXXXXXXXXXX",
-    "address_street": "123 Only Joking",
-    "mc_amount3": "1.03",
-    "charset": "UTF-8",
-    "address_zip": "99999",
-    "first_name": "Joe",
-    "reattempt": "1",
-    "address_country_code": "US",
-    "address_name": "Joe Camel",
-    "notify_version": "3.8",
-    "subscr_id": "S-XXXXXXXXXXXXXXXXX",
-    "custom": "7373",
-    "payer_status": "verified",
-    "business": "nob...@wikimedia.org",
-    "address_country": "United States",
-    "address_city": "Scranton",
-    "verify_sign": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-    "payer_email": "i...@google.net",
-    "payer_business_name": "Joe Camel",
-    "last_name": "Camel",
-    "address_state": "CA",
-    "receiver_email": "nob...@wikimedia.org",
-    "recurring": "1",
-    "txn_type": "subscr_signup",
-    "item_name": "Donation to the Wikimedia Foundation",
-    "mc_currency": "USD",
-    "item_number": "DONATE",
-    "residence_country": "US",
-    "period3": "1 M",
-    "ipn_track_id": "7777777777777",
-    "date": "",
-    "gateway": "paypal"
-}
diff --git a/PaymentProviders/PayPal/Tests/Data/web_accept.json 
b/PaymentProviders/PayPal/Tests/Data/web_accept.json
deleted file mode 100644
index feb5131..0000000
--- a/PaymentProviders/PayPal/Tests/Data/web_accept.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
-    "mc_gross": "7.00",
-    "protection_eligibility": "Eligible",
-    "address_status": "unconfirmed",
-    "payer_id": "AAAAAAAAAAAAA",
-    "tax": "0.00",
-    "address_street": "hell no",
-    "payment_date": "23:28:47 Aug 12, 2016 PDT",
-    "payment_status": "Completed",
-    "charset": "UTF-8",
-    "address_zip": "8032",
-    "first_name": "thanks",
-    "mc_fee": "0.44",
-    "address_country_code": "CH",
-    "address_name": "where indeed",
-    "notify_version": "3.8",
-    "custom": "33333333",
-    "payer_status": "verified",
-    "business": "nob...@wikimedia.org",
-    "address_country": "Switzerland",
-    "address_city": "Zurich",
-    "quantity": "0",
-    "verify_sign": "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
-    "payer_email": "no...@example.com",
-    "txn_id": "JJJJJJJJJJJJJJJJJ",
-    "payment_type": "instant",
-    "payer_business_name": "where indeed",
-    "last_name": "bobby",
-    "address_state": "",
-    "receiver_email": "nob...@wikimedia.org",
-    "payment_fee": "0.44",
-    "receiver_id": "EEEEEEEEEEEEE",
-    "txn_type": "web_accept",
-    "item_name": "Donation to the Wikimedia Foundation",
-    "mc_currency": "USD",
-    "item_number": "DONATE",
-    "residence_country": "CH",
-    "transaction_subject": "33333333",
-    "payment_gross": "7.00",
-    "ipn_track_id": "ddddddddddddd"
-}
diff --git a/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php 
b/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
deleted file mode 100644
index ac0ef67..0000000
--- a/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php namespace SmashPig\PaymentProviders\PayPal\Tests;
-
-use SmashPig\PaymentProviders\PayPal\PayPalPaymentsAPI;
-
-class MockPayPalPaymentsAPI extends PayPalPaymentsAPI {
-       protected function curl ( $ch, $post_fields ) {
-               if ( CaptureIncomingMessageTest::$fail_verification ) {
-                       return 'INVALID';
-               }
-               return 'VERIFIED';
-       }
-}
diff --git a/PaymentProviders/PayPal/Tests/PayPalTestConfiguration.php 
b/PaymentProviders/PayPal/Tests/PayPalTestConfiguration.php
deleted file mode 100644
index e8ea4f7..0000000
--- a/PaymentProviders/PayPal/Tests/PayPalTestConfiguration.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-namespace SmashPig\PaymentProviders\PayPal\Tests;
-
-use SmashPig\Core\Configuration;
-
-class PayPalTestConfiguration extends Configuration {
-
-       public static function get () {
-               return self::createForViewWithOverrideFile(
-                       'paypal',
-                       __DIR__ . '/config_test.yaml'
-               );
-       }
-
-}
diff --git a/PaymentProviders/PayPal/Tests/config_test.yaml 
b/PaymentProviders/PayPal/Tests/config_test.yaml
deleted file mode 100644
index aaa8df9..0000000
--- a/PaymentProviders/PayPal/Tests/config_test.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-paypal:
-    api:
-        class: SmashPig\PaymentProviders\PayPal\Tests\MockPayPalPaymentsAPI
-
-    data-store:
-        verified:
-            class: PHPQueue\Backend\PDO
-            constructor-parameters:
-                -
-                    connection_string: 'sqlite::memory:'
-                    queue: verified
-
-        jobs-paypal:
-            class: PHPQueue\Backend\PDO
-            constructor-parameters:
-                -
-                    connection_string: 'sqlite::memory:'
-                    queue: jobs-paypal
-
-        recurring:
-            class: PHPQueue\Backend\PDO
-            constructor-parameters:
-                -
-                    connection_string: 'sqlite::memory:'
-                    queue: recurring
-
-        refund:
-            class: SmashPig\Tests\MockDataStore
-            constructor-parameters: []
-
-        verified:
-            class: SmashPig\Tests\MockDataStore
-            constructor-parameters: []
-
-        pending-db:
-            class: PDO
-            constructor-parameters:
-                - 'sqlite::memory:'
diff --git 
a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php 
b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
deleted file mode 100644
index 8b7e59f..0000000
--- a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-namespace SmashPig\PaymentProviders\PayPal\Tests;
-
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\Core\QueueConsumers\BaseQueueConsumer;
-use SmashPig\PaymentProviders\PayPal\Listener;
-use SmashPig\PaymentProviders\PayPal\Job;
-use SmashPig\PaymentProviders\PayPal\Tests\PayPalTestConfiguration;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-use SmashPig\Core\Http\Response;
-use SmashPig\Core\Http\Request;
-use SmashPig\Core\DataStores\KeyedOpaqueStorableObject;
-
-/**
- * Test the IPN listener which receives messages, stores and processes them.
- */
-class CaptureIncomingMessageTest extends BaseSmashPigUnitTestCase {
-
-       /**
-        * @var Configuration
-        */
-       public $config;
-
-       static $fail_verification = false;
-
-       static $message_locations = array(
-               'verified' => 'web_accept.json',
-               'recurring' => 'subscr_signup.json',
-               'recurring' => 'subscr_payment.json'
-       );
-
-       static $messages = array();
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = PayPalTestConfiguration::get();
-               Context::initWithLogger( $this->config );
-               foreach ( self::$message_locations as $type => $file ) {
-                       self::$messages[$type] = json_decode(
-                               file_get_contents( __DIR__ . '/../Data/' . 
$file ),
-                               true
-                       );
-               }
-       }
-
-       private function capture ( $msg ) {
-               $request = new Request( $msg );
-               $response = new Response;
-               $listener = new Listener;
-               $listener->execute( $request, $response );
-       }
-
-       public function testCapture() {
-               foreach ( self::$messages as $type => $msg ) {
-
-                       $this->capture( $msg );
-
-                       $jobQueue = $this->config->object( 
'data-store/jobs-paypal' );
-                       $jobMessage = $jobQueue->pop();
-
-                       $this->assertEquals( $jobMessage['php-message-class'],
-                               'SmashPig\PaymentProviders\PayPal\Job' );
-
-                       $this->assertEquals( $jobMessage['payload'], $msg );
-
-               }
-       }
-
-       public function testConsume () {
-               foreach ( self::$messages as $type => $msg ) {
-                       $this->capture( $msg );
-
-                       $jobQueue = $this->config->object( 
'data-store/jobs-paypal' );
-                       $jobMessage = $jobQueue->pop();
-
-                       $job = KeyedOpaqueStorableObject::fromJsonProxy(
-                               $jobMessage['php-message-class'],
-                               json_encode( $jobMessage )
-                       );
-
-                       $job->execute();
-
-                       $queue = $this->config->object( 'data-store/' . $type );
-                       $message = $queue->pop();
-
-                       $this->assertNotEmpty( $message );
-
-               }
-       }
-
-       public function testFailedConsume () {
-               self::$fail_verification = true;
-               $jobMessage = array( 'txn_type' => 'fail' );
-               $jobClass = 'SmashPig\PaymentProviders\PayPal\Job';
-               $job = KeyedOpaqueStorableObject::fromJsonProxy(
-                       $jobClass,
-                       json_encode( $jobMessage )
-               );
-
-               try {
-                       $job->execute();
-               } catch ( \Exception $e ) {
-                       // TODO I think this can throw a special exception to 
move to
-                       // damaged queue or some other stuff
-                       $this->assertEquals(
-                               
\SmashPig\PaymentProviders\PayPal\Job::$verifyFailedMsg,
-                               $e->getMessage()
-                       );
-               }
-
-       }
-}
diff --git a/Tests/ConfigurationTest.php b/Tests/ConfigurationTest.php
deleted file mode 100644
index 1952590..0000000
--- a/Tests/ConfigurationTest.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<<<<<<< HEAD   (8ac116 Merge branch 'master' into deployment)
-=======
-<?php
-namespace SmashPig\Tests;
-
-/**
- */
-class ConfigurationTest extends BaseSmashPigUnitTestCase {
-
-       public function testOverride() {
-               $config = $this->setConfig();
-
-               $this->assertEquals( 'SmashPig', $config->val( 
'logging/root-context' ),
-                       'Default config was as expected.' );
-               $config->override( array(
-                       'logging' => array(
-                               'root-context' => 'FOO',
-                       ),
-               ) );
-               $this->assertEquals( 'FOO', $config->val( 
'logging/root-context' ),
-                       'Config was overridden.' );
-       }
-
-       /**
-        * Check that sparsely populated deep structures override one another
-        * additively, and we don't lose branches from half of the union.
-        * TODO: Provide more cases using a dataProvider.
-        */
-       public function testOverrideDeep() {
-               $config = $this->setConfig();
-
-               $config->override( array(
-                       'endpoints' => array(
-                               'listener' => array(
-                                       'class' => 'SmashPig\Ham',
-                                       'postback-url' => 'http://Salad',
-                               ),
-                       ),
-               ) );
-
-               $config->override( array(
-                       'endpoints' => array(
-                               'listener' => array(
-                                       'postback-url' => 'http://Rice',
-                               ),
-                       ),
-               ) );
-
-               $expected = array(
-                       'class' => 'SmashPig\Ham',
-                       'postback-url' => 'http://Rice',
-               );
-
-               $this->assertEquals( $expected, $config->val( 
'endpoints/listener' ),
-                       'Deep merge went as hoped' );
-       }
-}
->>>>>>> BRANCH (d0ecdd Add placeholder class for NotificationOfFraud messages)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c9a3c9a6012d808197313d26bf3e2fefda2c74f
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

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

Reply via email to