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

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

Merge branch 'master' into deployment

65487c9 QueueWrapper for pushing messages
357c077 Allow overriding source name, type, and version
3aa2737 DRY up logic to remove source_ fields
9d06410 phpunit tags - @group Adyen
9c1f018 Route all config access through Context

Change-Id: I340f796851e1d3730801ff4fedc4d8adf100ad4c
---
D PaymentProviders/Adyen/Tests/AdyenTestConfiguration.php
D PaymentProviders/Adyen/Tests/phpunit/AuditTest.php
D PaymentProviders/Adyen/Tests/phpunit/CaptureJobTest.php
D PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php
D PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php
D PaymentProviders/Adyen/Tests/phpunit/RecordCaptureJobTest.php
D PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php
D PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php
D PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php
D PaymentProviders/AstroPay/Tests/phpunit/NormalizeTest.php
D PaymentProviders/PayPal/Tests/Data/express_checkout_transformed.json
D 
PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
D PaymentProviders/PayPal/Tests/Data/recurring_payment_transformed.json
D PaymentProviders/PayPal/Tests/Data/refund_ec_transformed.json
D PaymentProviders/PayPal/Tests/Data/refund_recurring_ec_transformed.json
D PaymentProviders/PayPal/Tests/Data/refund_transformed.json
D PaymentProviders/PayPal/Tests/Data/subscr_payment_transformed.json
D PaymentProviders/PayPal/Tests/Data/subscr_signup_transformed.json
D PaymentProviders/PayPal/Tests/Data/web_accept_transformed.json
D PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
D Tests/BaseSmashPigUnitTestCase.php
D Tests/FileDumperTest.php
D Tests/QueueConsumerTest.php
D Tests/TestingConfiguration.php
24 files changed, 0 insertions(+), 1,553 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/57/356657/1

diff --git a/PaymentProviders/Adyen/Tests/AdyenTestConfiguration.php 
b/PaymentProviders/Adyen/Tests/AdyenTestConfiguration.php
deleted file mode 100644
index e1a507f..0000000
--- a/PaymentProviders/Adyen/Tests/AdyenTestConfiguration.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php namespace SmashPig\PaymentProviders\Adyen\Tests;
-
-use SmashPig\Core\Configuration;
-use SmashPig\Core\DataStores\PendingDatabase;
-
-class AdyenTestConfiguration extends Configuration {
-
-       public static function instance( $overrides = array() ) {
-               $config = self::createForViewWithOverrideFile(
-                       'adyen',
-                       __DIR__ . '/config_test.yaml'
-               );
-               $config->override( $overrides );
-
-               return $config;
-       }
-
-       public static function createWithSuccessfulApi() {
-               $override = array( 'payment-provider' =>
-                       array( 'adyen' =>
-                               array( 'api' =>
-                                       array( 'constructor-parameters' =>
-                                               array( 'Success!' )
-                                       )
-                               )
-                       )
-               );
-               return self::instance( $override );
-       }
-
-       public static function createWithUnsuccessfulApi() {
-               $override = array( 'payment-provider' =>
-                       array( 'adyen' =>
-                               array( 'api' =>
-                                       array( 'constructor-parameters' =>
-                                               // FIXME: Really?  or boolean 
`false` as it would be if
-                                               // we parsed "false" from yaml?
-                                               array( 'false' )
-                                       )
-                               )
-                       )
-               );
-               return self::instance( $override );
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/Adyen/Tests/phpunit/AuditTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/AuditTest.php
deleted file mode 100644
index ed91d17..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/AuditTest.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-namespace SmashPig\PaymentProviders\Adyen\Test;
-
-use SmashPig\PaymentProviders\Adyen\Audit\AdyenAudit;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * Verify Adyen audit file processor functions
- *
- * @group Adyen
- */
-class AuditTest extends BaseSmashPigUnitTestCase {
-       /**
-        * Normal donation
-        */
-       public function testProcessDonation() {
-               $processor = new AdyenAudit();
-               $output = $processor->parseFile( __DIR__ . 
'/../Data/donation.csv' );
-               $this->assertEquals( 1, count( $output ), 'Should have found 
one donation' );
-               $actual = $output[0];
-               $expected = array(
-                       'gateway' => 'adyen',
-                       'gross' => '1.00',
-                       'contribution_tracking_id' => '33992337',
-                       'currency' => 'USD',
-                       'gateway_txn_id' => '5364893193133131',
-                       'log_id' => '33992337.0',
-                       'payment_method' => 'cc',
-                       'payment_submethod' => 'visa-debit',
-                       'date' => 1455840651,
-                       'settled_currency' => 'USD',
-                       'fee' => '0.24',
-                       'settled_gross' => '0.76',
-                       'settled_fee' => '0.24',
-               );
-               $this->assertEquals( $expected, $actual, 'Did not parse 
donation correctly' );
-       }
-
-       /**
-        * Now try a refund
-        */
-       public function testProcessRefund() {
-               $processor = new AdyenAudit();
-               $output = $processor->parseFile( __DIR__ . 
'/../Data/refund.csv' );
-               $this->assertEquals( 1, count( $output ), 'Should have found 
one refund' );
-               $actual = $output[0];
-               $expected = array(
-                       'gateway' => 'adyen',
-                       'contribution_tracking_id' => '92598312',
-                       'date' => 1455128736,
-                       'gross' => '1.00',
-                       'gateway_parent_id' => '4522268860022701',
-                       'gateway_refund_id' => '4522268869855336',
-                       'gross_currency' => 'USD',
-                       'log_id' => '92598312.0',
-                       'type' => 'refund',
-               );
-               $this->assertEquals( $expected, $actual, 'Did not parse refund 
correctly' );
-       }
-
-       /**
-        * And a chargeback
-        */
-       public function testProcessChargeback() {
-               $processor = new AdyenAudit();
-               $output = $processor->parseFile( __DIR__ . 
'/../Data/chargeback.csv' );
-               $this->assertEquals( 1, count( $output ), 'Should have found 
one chargeback' );
-               $actual = $output[0];
-               $expected = array(
-                       'gateway' => 'adyen',
-                       'contribution_tracking_id' => '92598318',
-                       'date' => 1455128736,
-                       'gross' => '1.00',
-                       'gateway_parent_id' => '4555568860022701',
-                       'gateway_refund_id' => '4555568869855336',
-                       'gross_currency' => 'USD',
-                       'log_id' => '92598318.0',
-                       'type' => 'chargeback',
-               );
-               $this->assertEquals( $expected, $actual, 'Did not parse 
chargeback correctly' );
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/Adyen/Tests/phpunit/CaptureJobTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/CaptureJobTest.php
deleted file mode 100644
index 3358514..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/CaptureJobTest.php
+++ /dev/null
@@ -1,241 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php namespace SmashPig\PaymentProviders\Adyen\Test;
-
-use PHPQueue\Backend\PDO;
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\Core\DataStores\JsonSerializableObject;
-use SmashPig\Core\DataStores\PendingDatabase;
-use SmashPig\Core\DataStores\QueueWrapper;
-use SmashPig\PaymentProviders\Adyen\Jobs\ProcessCaptureRequestJob;
-use SmashPig\PaymentProviders\Adyen\Tests\AdyenTestConfiguration;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * Verify Adyen Capture job functions
- *
- * @group Adyen
- */
-class CaptureJobTest extends BaseSmashPigUnitTestCase {
-
-       /**
-        * @var Configuration
-        */
-       public $config;
-       /**
-        * @var PendingDatabase
-        */
-       protected $pendingDatabase;
-       protected $pendingMessage;
-       /**
-        * @var PDO
-        */
-       protected $antifraudQueue;
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = 
AdyenTestConfiguration::createWithSuccessfulApi();
-               Context::initWithLogger( $this->config );
-               $this->pendingDatabase = PendingDatabase::get();
-               $this->pendingDatabase->createTable();
-               $this->pendingMessage = json_decode(
-                       file_get_contents( __DIR__ . '/../Data/pending.json' ) 
, true
-               );
-               $this->pendingDatabase->storeMessage( $this->pendingMessage );
-               $this->antifraudQueue = QueueWrapper::getQueue( 
'payments-antifraud' );
-       }
-
-       public function tearDown() {
-               $this->pendingDatabase->deleteMessage( $this->pendingMessage );
-               parent::tearDown();
-       }
-
-       /**
-        * For a legit donation, ProcessCaptureJob should leave donor data
-        * in the pending database, add an antifraud message, and return true.
-        */
-       public function testSuccessfulCapture() {
-               $api = $this->config->object( 'payment-provider/adyen/api', 
true );
-
-               $auth = JsonSerializableObject::fromJsonProxy(
-                       
'SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation',
-                       file_get_contents( __DIR__ . '/../Data/auth.json' )
-               );
-
-               $job = ProcessCaptureRequestJob::factory( $auth );
-               $this->assertTrue( $job->execute() );
-
-               $donorData = 
$this->pendingDatabase->fetchMessageByGatewayOrderId(
-                       'adyen', $auth->merchantReference
-               );
-
-               $this->assertNotNull(
-                       $donorData,
-                       'RequestCaptureJob did not leave donor data on pending 
queue'
-               );
-               $this->assertTrue(
-                       $donorData['captured'],
-                       'RequestCaptureJob did not mark donor data as captured'
-               );
-
-               $this->assertEquals(
-                       array(
-                               'currency' => 'USD',
-                               'amount' => 10,
-                               'pspReference' => '762895314225',
-                       ),
-                       $api->captured[0],
-                       'RequestCaptureJob did not make the right capture call'
-               );
-
-               $antifraudMessage = $this->antifraudQueue->pop();
-               $this->assertNotNull(
-                       $antifraudMessage,
-                       'RequestCaptureJob did not send antifraud message'
-               );
-               $this->assertEquals(
-                       'process',
-                       $antifraudMessage['validation_action'],
-                       'Successful capture should get "process" validation 
action'
-               );
-       }
-
-       /**
-        * When AVS and CVV scores push the donation over the review threshold,
-        * we should not capture the payment, but leave the donor details.
-        */
-       public function testReviewThreshold() {
-               $api = $this->config->object( 'payment-provider/adyen/api', 
true );
-
-               $auth = JsonSerializableObject::fromJsonProxy(
-                       
'SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation',
-                       file_get_contents( __DIR__ . '/../Data/auth.json' )
-               );
-
-               $auth->avsResult = '1'; // Bad zip code pushes us over review
-
-               $job = ProcessCaptureRequestJob::factory( $auth );
-               $this->assertTrue( $job->execute() );
-
-               $donorData = 
$this->pendingDatabase->fetchMessageByGatewayOrderId(
-                       'adyen', $auth->merchantReference
-               );
-               $this->assertNotNull(
-                       $donorData,
-                       'RequestCaptureJob did not leave donor data for review'
-               );
-               $this->assertTrue(
-                       empty( $donorData['captured'] ),
-                       'RequestCaptureJob marked donor data above review 
threshold as captured'
-               );
-
-               $this->assertEmpty(
-                       $api->captured,
-                       'RequestCaptureJob tried to capture above review 
threshold'
-               );
-
-               $antifraudMessage = $this->antifraudQueue->pop();
-               $this->assertNotNull(
-                       $antifraudMessage,
-                       'RequestCaptureJob did not send antifraud message'
-               );
-               $this->assertEquals(
-                       'review',
-                       $antifraudMessage['validation_action'],
-                       'Suspicious auth should get "review" validation action'
-               );
-       }
-
-       /**
-        * When AVS and CVV scores push the donation over the reject threshold,
-        * we should cancel the authorization and delete the donor details.
-        */
-       public function testRejectThreshold() {
-               $api = $this->config->object( 'payment-provider/adyen/api', 
true );
-
-               $auth = JsonSerializableObject::fromJsonProxy(
-                       
'SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation',
-                       file_get_contents( __DIR__ . '/../Data/auth.json' )
-               );
-
-               $auth->avsResult = '2'; // No match at all
-               $auth->cvvResult = '2'; // CVV is also wrong
-
-               $job = ProcessCaptureRequestJob::factory( $auth );
-               $this->assertTrue( $job->execute() );
-
-               $donorData = 
$this->pendingDatabase->fetchMessageByGatewayOrderId(
-                       'adyen', $auth->merchantReference
-               );
-               $this->assertNull(
-                       $donorData,
-                       'RequestCaptureJob should delete fraudy donor data'
-               );
-
-               $this->assertEmpty(
-                       $api->captured,
-                       'RequestCaptureJob tried to capture above reject 
threshold'
-               );
-               $this->assertEquals(
-                       $auth->pspReference,
-                       $api->cancelled[0],
-                       'Did not cancel the fraudulent authorization'
-               );
-
-               $antifraudMessage = $this->antifraudQueue->pop();
-               $this->assertNotNull(
-                       $antifraudMessage,
-                       'RequestCaptureJob did not send antifraud message'
-               );
-               $this->assertEquals(
-                       'reject',
-                       $antifraudMessage['validation_action'],
-                       'Obvious fraud should get "reject" validation action'
-               );
-       }
-
-       /**
-        * When two authorizations come in with the same merchant reference, we
-        * should cancel the second one and leave the donor details in pending.
-        */
-       public function testDuplicateAuthorisation() {
-               $api = $this->config->object( 'payment-provider/adyen/api', 
true );
-
-               $auth1 = JsonSerializableObject::fromJsonProxy(
-                       
'SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation',
-                       file_get_contents( __DIR__ . '/../Data/auth.json' )
-               );
-               $job1 = ProcessCaptureRequestJob::factory( $auth1 );
-               $job1->execute();
-
-               $this->assertEquals( 1, count( $api->captured ), 'Set up 
failed' );
-
-               $auth2 = JsonSerializableObject::fromJsonProxy(
-                       
'SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation',
-                       file_get_contents( __DIR__ . '/../Data/auth.json' )
-               );
-               $auth2->pspReference = mt_rand( 1000000000, 10000000000 );
-               $job2 = ProcessCaptureRequestJob::factory( $auth2 );
-               $this->assertTrue(
-                       $job2->execute(),
-                       'Duplicate auths should not clutter damage queue'
-               );
-
-               $this->assertEquals( 1, count( $api->captured ), 'Captured a 
duplicate!' );
-               $this->assertEquals(
-                       $auth2->pspReference,
-                       $api->cancelled[0],
-                       'Did not cancel the right authorization'
-               );
-
-               $this->assertNotNull(
-                       $this->pendingDatabase->fetchMessageByGatewayOrderId(
-                               'adyen', $auth1->merchantReference
-                       ),
-                       'Capture job should leave donor details in database'
-               );
-       }
-
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php
deleted file mode 100644
index c120c40..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/CaptureResponseActionTest.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-namespace SmashPig\PaymentProviders\Adyen\Tests;
-
-use PHPQueue\Interfaces\FifoQueueStore;
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\PaymentProviders\Adyen\Actions\CaptureResponseAction;
-use SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Capture;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * @group Adyen
- */
-class CaptureResponseActionTest extends BaseSmashPigUnitTestCase {
-       /**
-        * @var Configuration
-        */
-       protected $config;
-
-       /**
-        * @var FifoQueueStore
-        */
-       protected $jobQueue;
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = 
AdyenTestConfiguration::createWithSuccessfulApi();
-
-               Context::initWithLogger( $this->config );
-               $this->jobQueue = $this->config->object( 
'data-store/jobs-adyen' );
-               $this->jobQueue->createTable( 'jobs-adyen' );
-       }
-
-       public function testSuccessfulCapture() {
-               $capture = new Capture();
-               $capture->success = true;
-
-               $capture->merchantAccountCode = 'WikimediaTest';
-               $capture->currency = 'USD';
-               $capture->amount = 10.00;
-               $capture->originalReference = mt_rand();
-               $capture->merchantReference = mt_rand();
-
-               $action = new CaptureResponseAction();
-               $action->execute( $capture );
-
-               $job = $this->jobQueue->pop();
-
-               $this->assertEquals(
-                       'SmashPig\PaymentProviders\Adyen\Jobs\RecordCaptureJob',
-                       $job['php-message-class']
-               );
-               $sameProps = array(
-                       'currency', 'amount', 'originalReference', 
'merchantReference'
-               );
-               foreach ( $sameProps as $prop ) {
-                       $this->assertEquals(
-                               $capture->$prop,
-                               $job[$prop],
-                               "Job property $prop does not match capture"
-                       );
-               }
-       }
-
-       public function testFailedCapture() {
-               $capture = new Capture();
-               $capture->success = false;
-
-               $action = new CaptureResponseAction();
-               $action->execute( $capture );
-
-               $job = $this->jobQueue->pop();
-
-               $this->assertNull( $job, 'Should not have queued a job' );
-       }
-
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php
deleted file mode 100644
index a73ff6a..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/PaymentCaptureActionTest.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-namespace SmashPig\PaymentProviders\Adyen\Tests;
-
-use PHPQueue\Interfaces\FifoQueueStore;
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\PaymentProviders\Adyen\Actions\PaymentCaptureAction;
-use SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * @group Adyen
- */
-class PaymentCaptureActionTest extends BaseSmashPigUnitTestCase  {
-       /**
-        * @var Configuration
-        */
-       protected $config;
-
-       /**
-        * @var FifoQueueStore
-        */
-       protected $jobQueue;
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = 
AdyenTestConfiguration::createWithSuccessfulApi();
-               Context::initWithLogger( $this->config );
-               $this->jobQueue = $this->config->object( 
'data-store/jobs-adyen' );
-               $this->jobQueue->createTable( 'jobs-adyen' );
-       }
-
-       public function testSuccessfulAuth() {
-               $auth = new Authorisation();
-               $auth->success = true;
-               $auth->merchantAccountCode = 'WikimediaTest' ;
-               $auth->currency = 'USD';
-               $auth->amount = '10';
-               $auth->merchantReference = mt_rand();
-               $auth->pspReference = mt_rand();
-               $auth->cvvResult = 1;
-               $auth->avsResult = 19;
-
-               $action = new PaymentCaptureAction();
-               $action->execute( $auth );
-
-               $job = $this->jobQueue->pop();
-
-               $this->assertEquals(
-                       
'SmashPig\PaymentProviders\Adyen\Jobs\ProcessCaptureRequestJob',
-                       $job['php-message-class']
-               );
-               $sameProps = array(
-                       'currency', 'amount', 'pspReference', 
'merchantReference',
-                       'avsResult', 'cvvResult',
-
-               );
-               foreach ( $sameProps as $prop ) {
-                       $this->assertEquals(
-                               $auth->$prop,
-                               $job[$prop],
-                               "Job property $prop does not match capture"
-                       );
-               }
-       }
-
-       public function testFailedAuth() {
-               $auth = new Authorisation();
-               $auth->success = false;
-               $auth->merchantAccountCode = 'WikimediaTest' ;
-               $auth->merchantReference = mt_rand();
-
-               $action = new PaymentCaptureAction();
-               $action->execute( $auth );
-
-               $job = $this->jobQueue->pop();
-
-               $this->assertEquals(
-                       'SmashPig\Core\Jobs\DeletePendingJob',
-                       $job['php-message-class']
-               );
-               $this->assertEquals(
-                       $auth->merchantReference,
-                       $job['order_id']
-               );
-               $this->assertEquals( 'adyen', $job['gateway'] );
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/Adyen/Tests/phpunit/RecordCaptureJobTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/RecordCaptureJobTest.php
deleted file mode 100644
index a79c3b1..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/RecordCaptureJobTest.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php namespace SmashPig\PaymentProviders\Adyen\Test;
-
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\Core\DataStores\JsonSerializableObject;
-use SmashPig\Core\DataStores\PendingDatabase;
-use SmashPig\Core\DataStores\QueueWrapper;
-use SmashPig\PaymentProviders\Adyen\Jobs\RecordCaptureJob;
-use SmashPig\PaymentProviders\Adyen\Tests\AdyenTestConfiguration;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * Verify Adyen RecordCapture job functions
- *
- * @group Adyen
- */
-class RecordCaptureJobTest extends BaseSmashPigUnitTestCase {
-
-       /**
-        * @var Configuration
-        */
-       public $config;
-       /**
-        * @var PendingDatabase
-        */
-       protected $pendingDatabase;
-       protected $pendingMessage;
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = 
AdyenTestConfiguration::createWithSuccessfulApi();
-               Context::initWithLogger( $this->config );
-               $this->pendingDatabase = PendingDatabase::get();
-               $this->pendingDatabase->createTable();
-               $this->pendingMessage = json_decode(
-                       file_get_contents( __DIR__ . '/../Data/pending.json' ) 
, true
-               );
-               $this->pendingMessage['captured'] = true;
-               $this->pendingDatabase->storeMessage( $this->pendingMessage );
-       }
-
-       public function tearDown() {
-               $this->pendingDatabase->deleteMessage( $this->pendingMessage );
-               parent::tearDown();
-       }
-
-       public function testRecordCapture() {
-               $donationsQueue = QueueWrapper::getQueue( 'donations' );
-               $donationsQueue->createTable( 'donations' );
-
-               $capture = JsonSerializableObject::fromJsonProxy(
-                       
'SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Capture',
-                       file_get_contents( __DIR__ . '/../Data/capture.json' )
-               );
-
-               $job = RecordCaptureJob::factory( $capture );
-               $this->assertTrue( $job->execute() );
-
-               $donorData = 
$this->pendingDatabase->fetchMessageByGatewayOrderId(
-                       'adyen', $capture->merchantReference
-               );
-
-               $this->assertNull(
-                       $donorData,
-                       'RecordCaptureJob left donor data on pending queue'
-               );
-
-               $donationMessage = $donationsQueue->pop();
-               $this->assertNotNull(
-                       $donationMessage,
-                       'RecordCaptureJob did not send donation message'
-               );
-               // can we use arraySubset yet?
-               $sameKeys = array_intersect(
-                       array_keys( $donationMessage ),
-                       array_keys( $this->pendingMessage )
-               );
-               foreach ( $sameKeys as $key ) {
-                       if ( $key === 'gateway_txn_id' ) {
-                               $this->assertEquals(
-                                       $capture->originalReference, 
$donationMessage[$key],
-                                       'RecordCaptureJob should have set 
gateway_txn_id'
-                               );
-                       } else {
-                               $this->assertEquals(
-                                       $this->pendingMessage[$key],
-                                       $donationMessage[$key],
-                                       "Value of key $key mutated"
-                               );
-                       }
-               }
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php
deleted file mode 100644
index 29bfc83..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-namespace SmashPig\PaymentProviders\Adyen\Tests;
-
-use PHPQueue\Interfaces\FifoQueueStore;
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\Core\DataStores\QueueWrapper;
-use SmashPig\Core\UtcDate;
-use SmashPig\CrmLink\Messages\SourceFields;
-use SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\ReportAvailable;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * @group Adyen
- */
-class ReportAvailableTest extends BaseSmashPigUnitTestCase {
-       /**
-        * @var Configuration
-        */
-       protected $config;
-
-       /**
-        * @var FifoQueueStore
-        */
-       protected $jobQueue;
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = 
AdyenTestConfiguration::createWithSuccessfulApi();
-               Context::initWithLogger( $this->config );
-               $this->jobQueue = QueueWrapper::getQueue( 'jobs-adyen' );
-               $this->jobQueue->createTable( 'jobs-adyen' );
-       }
-
-       public function testReportAvailable() {
-               $filename = 'settlement_detail_report_2016_10_13.csv';
-               $account = 'WikimediaTest';
-               $url = 
"https://example.com/reports/download/MerchantAccount/$account/$filename";;
-               $reportAvailable = new ReportAvailable();
-
-               $reportAvailable->merchantAccountCode = $account;
-               $reportAvailable->merchantReference = mt_rand();
-               $reportAvailable->pspReference = $filename;
-               $reportAvailable->reason = $url;
-               $reportAvailable->eventDate = '2016-10-14T12:06:20.496+02:00';
-
-               $reportAvailable->runActionChain();
-
-               $job = $this->jobQueue->pop();
-
-               $now = UtcDate::getUtcTimestamp();
-               $diff = abs( $job['source_enqueued_time'] ) - $now;
-               $this->assertTrue( $diff < 60, 'Odd enqueued time' );
-               SourceFields::removeFromMessage( $job );
-               unset( $job['propertiesExcludedFromExport'] );
-               $expected = array(
-                       'php-message-class' => 
'SmashPig\PaymentProviders\Adyen\Jobs\DownloadReportJob',
-                       'reportUrl' => $url,
-                       'account' => $account,
-                       'gateway' => 'adyen',
-               );
-               $this->assertEquals( $expected, $job );
-       }
-
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php
deleted file mode 100644
index d91e7fe..0000000
--- a/PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php namespace SmashPig\PaymentProviders\Adyen\Test;
-
-use SmashPig\Core\Context;
-use SmashPig\Core\DataStores\JsonSerializableObject;
-use SmashPig\Core\DataStores\PendingDatabase;
-use SmashPig\PaymentProviders\Adyen\Jobs\ProcessCaptureRequestJob;
-use SmashPig\PaymentProviders\Adyen\Tests\AdyenTestConfiguration;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-/**
- * Make sure a message that arrives before the pending databases entry gets
- * written is properly requeued for retry.
- *
- * @group Adyen
- */
-class RequeueMessageTest extends BaseSmashPigUnitTestCase {
-
-       public function setUp() {
-               parent::setUp();
-               $config = AdyenTestConfiguration::createWithSuccessfulApi();
-               Context::initWithLogger( $config );
-               PendingDatabase::get()->createTable();
-       }
-
-       /**
-        * @expectedException \SmashPig\Core\RetryableException
-        */
-       public function testRequeueMessage() {
-
-               $auth = JsonSerializableObject::fromJsonProxy(
-                       
'SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation',
-                       file_get_contents( __DIR__ . '/../Data/auth.json' )
-               );
-
-               $job = ProcessCaptureRequestJob::factory( $auth );
-               $job->execute();
-
-       }
-
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php 
b/PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php
deleted file mode 100644
index e86d7ba..0000000
--- a/PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-namespace SmashPig\PaymentProviders\Amazon\Tests;
-
-use SmashPig\PaymentProviders\Amazon\ExpatriatedMessages\RefundCompleted;
-use SmashPig\PaymentProviders\Amazon\ExpatriatedMessages\CaptureCompleted;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-class NormalizeTest extends BaseSmashPigUnitTestCase {
-       /**
-        * @var CaptureCompleted
-        */
-       protected $captureCompleted;
-
-       /**
-        * @var RefundCompleted
-        */
-       protected $refundCompleted;
-
-       public function setUp() {
-               parent::setUp();
-               $this->captureCompleted = $this->loadJson( __DIR__ . 
"/../Data/IPN/CaptureCompleted.json" );
-               $this->refundCompleted = $this->loadJson( __DIR__ . 
"/../Data/IPN/RefundCompleted.json" );
-       }
-
-       public function testNormalizeCaptureCompleted() {
-               $expected = array(
-                       'completion_message_id' => 'amazon-98765432-1',
-                       'contribution_tracking_id' => '98765432',
-                       'currency' => 'USD',
-                       'date' => 1357002061,
-                       'fee' => '0.0',
-                       'gateway' => 'amazon',
-                       'gateway_status' => 'Completed',
-                       'gateway_txn_id' => 'P01-0000000-0000000-000000',
-                       'gross' => '10.0',
-                       'order_id' => '98765432-1',
-                       'payment_method' => 'amazon',
-               );
-               $message = new CaptureCompleted( $this->captureCompleted );
-               $normalized = $message->normalizeForQueue();
-               $this->assertEquals( $expected, $normalized );
-       }
-
-       public function testNormalizeRefundCompleted() {
-               $id = 'P01-0000000-0000000-C' . mt_rand( 10000, 99999 );
-               $expected = array(
-                       'gross_currency' => 'USD',
-                       'date' => 1357002061,
-                       'gateway' => 'amazon',
-                       'gateway_parent_id' => $id,
-                       'gateway_refund_id' => 'P01-0000000-0000000-R00000',
-                       'gross' => '10.0',
-                       'type' => 'refund',
-               );
-               $message = new RefundCompleted( $this->refundCompleted );
-               $message->setParentId( $id );
-               $normalized = $message->normalizeForQueue();
-               $this->assertEquals( $expected, $normalized );
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/AstroPay/Tests/phpunit/NormalizeTest.php 
b/PaymentProviders/AstroPay/Tests/phpunit/NormalizeTest.php
deleted file mode 100644
index 71a9bf8..0000000
--- a/PaymentProviders/AstroPay/Tests/phpunit/NormalizeTest.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-namespace SmashPig\PaymentProviders\AstroPay\Test;
-
-use SmashPig\PaymentProviders\AstroPay\ExpatriatedMessages\PaymentMessage;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-
-class NormalizeTest extends BaseSmashPigUnitTestCase {
-       /**
-        * @var array
-        */
-       protected $paymentSuccess;
-
-       public function setUp() {
-               parent::setUp();
-               $this->paymentSuccess = $this->loadJson( __DIR__ . 
"/../Data/paid.json" );
-       }
-
-       /**
-        * Check that we produce the right message, including the completion id
-        */
-       public function testNormalizePaymentSuccess() {
-               $expected = array(
-                       'completion_message_id' => 'astropay-32303.1',
-                       'contribution_tracking_id' => '32303',
-                       'currency' => 'BRL',
-                       'gateway' => 'astropay',
-                       'gateway_status' => '9',
-                       'gateway_txn_id' => '31912',
-                       'gross' => '100.00',
-                       'order_id' => '32303.1',
-               );
-               $message = new PaymentMessage();
-               $message->constructFromValues( $this->paymentSuccess );
-               $normalized = $message->normalizeForQueue();
-               unset( $normalized['date'] );
-               $this->assertEquals( $expected, $normalized );
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git 
a/PaymentProviders/PayPal/Tests/Data/express_checkout_transformed.json 
b/PaymentProviders/PayPal/Tests/Data/express_checkout_transformed.json
deleted file mode 100644
index f8becf8..0000000
--- a/PaymentProviders/PayPal/Tests/Data/express_checkout_transformed.json
+++ /dev/null
@@ -1,18 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-       "date": 1481144318,
-       "txn_type": "express_checkout",
-       "gateway_txn_id": "3N2616476S0123456",
-       "currency": "JPY",
-       "contribution_tracking_id": "123456",
-       "email": "[email protected]",
-       "first_name": "Fowl",
-       "last_name": "Pond",
-       "country": "US",
-       "gross": "150",
-       "fee": "43",
-       "order_id": "123456",
-       "gateway": "paypal_ec"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
 
b/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
deleted file mode 100644
index 04a257c..0000000
--- 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
+++ /dev/null
@@ -1,22 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-  "subscr_id": "I-88J1M3DLSF0",
-  "txn_type": "subscr_signup",
-  "contribution_tracking_id": "47017286",
-  "order_id": "47017286",
-  "email": "[email protected]",
-  "first_name": "Fezziwig",
-  "middle_name": "",
-  "last_name": "Fowl",
-  "frequency_interval": "1",
-  "frequency_unit": "month",
-  "installments": 0,
-  "country": "US",
-  "create_date": 1492533928,
-  "start_date": 1492533928,
-  "date": 1492533928,
-  "gateway": "paypal_ec",
-  "recurring": "1"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git 
a/PaymentProviders/PayPal/Tests/Data/recurring_payment_transformed.json 
b/PaymentProviders/PayPal/Tests/Data/recurring_payment_transformed.json
deleted file mode 100644
index df9ad41..0000000
--- a/PaymentProviders/PayPal/Tests/Data/recurring_payment_transformed.json
+++ /dev/null
@@ -1,25 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-  "date": 1474498993,
-  "subscr_id": "12345678",
-  "txn_type": "subscr_payment",
-  "contribution_tracking_id": "7373",
-  "order_id": "7373",
-  "email": "[email protected]",
-  "first_name": "Testy",
-  "middle_name": "",
-  "last_name": "McTesterson",
-  "street_address": "123 Fake St.",
-  "city": "Fakesville",
-  "state_province": "CA",
-  "country": "US",
-  "postal_code": "92777",
-  "gateway_txn_id": "0987654321",
-  "currency": "USD",
-  "gross": "1.50",
-  "fee": "0.10",
-  "gateway": "paypal_ec",
-  "recurring": "1"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/PayPal/Tests/Data/refund_ec_transformed.json 
b/PaymentProviders/PayPal/Tests/Data/refund_ec_transformed.json
deleted file mode 100644
index d9943c0..0000000
--- a/PaymentProviders/PayPal/Tests/Data/refund_ec_transformed.json
+++ /dev/null
@@ -1,21 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-  "date": 1490200499,
-  "gateway_parent_id": "1V551844CE5526421",
-  "gateway_txn_id": "3HD08833MR473623T",
-  "currency": "JPY",
-  "type": "refund",
-  "contribution_tracking_id": "46239229",
-  "email": "[email protected]",
-  "first_name": "Testy",
-  "last_name": "McTesterson",
-  "gross": "-150",
-  "fee": "-43",
-  "order_id": "46239229",
-  "gateway_refund_id": "3HD08833MR473623T",
-  "gross_currency": "JPY",
-  "country": "US",
-  "gateway": "paypal_ec"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git 
a/PaymentProviders/PayPal/Tests/Data/refund_recurring_ec_transformed.json 
b/PaymentProviders/PayPal/Tests/Data/refund_recurring_ec_transformed.json
deleted file mode 100644
index be066de..0000000
--- a/PaymentProviders/PayPal/Tests/Data/refund_recurring_ec_transformed.json
+++ /dev/null
@@ -1,22 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-  "date": 1490200431,
-  "gateway_parent_id": "4GV70894MM323713P",
-  "gateway_txn_id": "4CX17568KP793000L",
-  "currency": "JPY",
-  "type": "refund",
-  "contribution_tracking_id": "45931681",
-  "email": "[email protected]",
-  "first_name": "Testy",
-  "last_name": "McTesterson",
-  "gross": "-150",
-  "fee": "-43",
-  "order_id": "45931681",
-  "gateway_refund_id": "4CX17568KP793000L",
-  "gross_currency": "JPY",
-  "country": "US",
-  "gateway": "paypal_ec",
-  "subscr_id": "I-DD1FNAAAUU22"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/PayPal/Tests/Data/refund_transformed.json 
b/PaymentProviders/PayPal/Tests/Data/refund_transformed.json
deleted file mode 100644
index 8e20a72..0000000
--- a/PaymentProviders/PayPal/Tests/Data/refund_transformed.json
+++ /dev/null
@@ -1,25 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-  "date": 1475088922,
-  "gateway_parent_id": "22b55555YY4499222",
-  "gateway_txn_id": "99E56789RR1234222",
-  "currency": "USD",
-  "type": "refund",
-  "contribution_tracking_id": "93731212",
-  "email": "[email protected]",
-  "first_name": "Clyde",
-  "last_name": "Barrow",
-  "street_address": "1234 Outlaw Ave",
-  "city": "Telico",
-  "state_province": "TX",
-  "country": "US",
-  "postal_code": "75119",
-  "gross": "-1.00",
-  "fee": "-0.27",
-  "order_id": "93731212",
-  "gateway_refund_id": "99E56789RR1234222",
-  "gross_currency": "USD",
-  "gateway": "paypal"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/PayPal/Tests/Data/subscr_payment_transformed.json 
b/PaymentProviders/PayPal/Tests/Data/subscr_payment_transformed.json
deleted file mode 100644
index 4657e7a..0000000
--- a/PaymentProviders/PayPal/Tests/Data/subscr_payment_transformed.json
+++ /dev/null
@@ -1,25 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-    "date": 1474498993,
-    "subscr_id": "S-XXXXXXXXXXXXXXXXX",
-    "txn_type": "subscr_payment",
-    "contribution_tracking_id": "7373",
-    "order_id": "7373",
-    "email": "[email protected]",
-    "first_name": "Gen",
-    "middle_name": "",
-    "last_name": "Russ",
-    "street_address": "123 Only Kidding",
-    "city": "Maynardsville",
-    "state_province": "CA",
-    "country": "US",
-    "postal_code": "99999",
-    "gateway_txn_id": "77777777777777776",
-    "currency": "USD",
-    "gross": "3.00",
-    "fee": "0.27",
-    "gateway": "paypal",
-    "recurring": "1"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/PayPal/Tests/Data/subscr_signup_transformed.json 
b/PaymentProviders/PayPal/Tests/Data/subscr_signup_transformed.json
deleted file mode 100644
index 7b55d39..0000000
--- a/PaymentProviders/PayPal/Tests/Data/subscr_signup_transformed.json
+++ /dev/null
@@ -1,28 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-    "subscr_id": 2048343366,
-    "txn_type": "subscr_signup",
-    "contribution_tracking_id": "7373",
-    "order_id": "7373",
-    "email": "[email protected]",
-    "first_name": "Joe",
-    "middle_name": "",
-    "last_name": "Camel",
-    "street_address": "123 Only Joking",
-    "city": "Scranton",
-    "state_province": "CA",
-    "country": "US",
-    "postal_code": "99999",
-    "frequency_interval": "1",
-    "frequency_unit": "month",
-    "installments": 0,
-    "gross": "1.03",
-    "currency": "USD",
-    "create_date": 1474498991,
-    "start_date": 1474498991,
-    "date": 1474498991,
-    "gateway": "paypal",
-    "recurring": "1"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/PaymentProviders/PayPal/Tests/Data/web_accept_transformed.json 
b/PaymentProviders/PayPal/Tests/Data/web_accept_transformed.json
deleted file mode 100644
index 276cf94..0000000
--- a/PaymentProviders/PayPal/Tests/Data/web_accept_transformed.json
+++ /dev/null
@@ -1,23 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-{
-  "date": 1471069727,
-  "txn_type": "web_accept",
-  "gateway_txn_id": "JJJJJJJJJJJJJJJJJ",
-  "currency": "USD",
-  "contribution_tracking_id": "33333333",
-  "email": "[email protected]",
-  "first_name": "thanks",
-  "last_name": "bobby",
-  "street_address": "hell no",
-  "city": "Zurich",
-  "state_province": "",
-  "country": "CH",
-  "postal_code": "8032",
-  "supplemental_address_1": "where indeed",
-  "gross": "7.00",
-  "fee": "0.44",
-  "order_id": "33333333",
-  "gateway": "paypal"
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git 
a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php 
b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
deleted file mode 100644
index aa91eb6..0000000
--- a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-namespace SmashPig\PaymentProviders\PayPal\Tests;
-
-use SmashPig\Core\Configuration;
-use SmashPig\Core\Context;
-use SmashPig\CrmLink\Messages\SourceFields;
-use SmashPig\PaymentProviders\PayPal\Listener;
-use SmashPig\Tests\BaseSmashPigUnitTestCase;
-use SmashPig\Core\Http\Response;
-use SmashPig\Core\Http\Request;
-use SmashPig\Core\DataStores\JsonSerializableObject;
-
-/**
- * Test the IPN listener which receives messages, stores and processes them.
- * @group PayPal
- */
-class CaptureIncomingMessageTest extends BaseSmashPigUnitTestCase {
-
-       /**
-        * @var Configuration
-        */
-       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',
-               'express_checkout.json' => 'donations',
-               'recurring_payment_profile_created.json' => 'recurring',
-               'subscr_signup.json' => 'recurring',
-               'subscr_payment.json' => 'recurring',
-               'recurring_payment.json' => 'recurring',
-               'refund.json' => 'refund',
-               'refund_ec.json' => 'refund',
-               'refund_recurring_ec.json' => 'refund',
-               'chargeback_settlement.json' => 'refund',
-               // this should not actually get written to
-               // TODO 'new_case.json' => 'no-op',
-       );
-
-       public function setUp() {
-               parent::setUp();
-               $this->config = PayPalTestConfiguration::get();
-
-               // php-queue\PDO complains about pop() from non-existent table
-               $this->config->object( 'data-store/jobs-paypal' )
-                       ->createTable( 'jobs-paypal' );
-
-               Context::initWithLogger( $this->config );
-       }
-
-       public function tearDown() {
-               self::$fail_verification = false;
-               self::$paypal_is_broken = false;
-               parent::tearDown();
-       }
-
-       public function messageProvider() {
-               $messages = array();
-               foreach ( self::$message_data as $file => $type ) {
-                       $payloadFile = __DIR__ . '/../Data/' . $file;
-                       $messageData = array(
-                               'type' => $type,
-                               'payload' => json_decode(
-                                       file_get_contents( $payloadFile ),
-                                       true
-                               )
-                       );
-                       $transformedFile = str_replace( '.json', 
'_transformed.json', $payloadFile );
-                       if ( file_exists( $transformedFile ) ) {
-                               $messageData['transformed'] = json_decode(
-                                       file_get_contents( $transformedFile ),
-                                       true
-                               );
-                       }
-                       $messages[] = array( $messageData );
-               }
-               return $messages;
-       }
-
-       private function capture( $msg ) {
-               $request = new Request( $msg );
-               $response = new Response;
-               $listener = new Listener;
-               return $listener->execute( $request, $response );
-       }
-
-       /**
-        * @dataProvider messageProvider
-        */
-       public function testCapture( $msg ) {
-               $this->capture( $msg['payload'] );
-
-               $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['payload'] );
-       }
-
-       public function testBlankMessage() {
-               $this->capture( array() );
-               $jobQueue = $this->config->object( 'data-store/jobs-paypal' );
-               $this->assertNull( $jobQueue->pop() );
-       }
-
-       /**
-        * @dataProvider messageProvider
-        */
-       public function testConsume( $msg ) {
-               $this->capture( $msg['payload'] );
-
-               $jobQueue = $this->config->object( 'data-store/jobs-paypal' );
-               $jobMessage = $jobQueue->pop();
-
-               $job = JsonSerializableObject::fromJsonProxy(
-                       $jobMessage['php-message-class'],
-                       json_encode( $jobMessage )
-               );
-
-               $job->execute();
-
-               $queue = $this->config->object( 'data-store/' . $msg['type'] );
-               $queue->createTable( $msg['type'] );
-               $message = $queue->pop();
-
-               if ( $job->is_reject() ) {
-                       $this->assertEmpty( $message );
-               } else {
-                       $this->assertNotEmpty( $message );
-                       if ( isset( $message['contribution_tracking_id'] ) ) {
-                               $this->assertEquals( 
$message['contribution_tracking_id'], $message['order_id'] );
-                       }
-
-                       if ( isset( $message['supplemental_address_1'] ) ) {
-                               $this->assertNotEquals(
-                                       $message['supplemental_address_1'],
-                                       "{$message['first_name']} 
{$message['last_name']}"
-                               );
-                       }
-                       if ( isset( $msg['transformed'] ) ) {
-                               SourceFields::removeFromMessage( $message );
-                               $this->assertEquals( $msg['transformed'], 
$message );
-                       }
-               }
-       }
-
-       public function testFailedVerification() {
-               self::$fail_verification = true;
-               $jobMessage = array( 'txn_type' => 'fail' );
-               $this->assertFalse( $this->capture( $jobMessage ) );
-       }
-
-       // 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;
-               $jobMessage = array( 'txn_type' => 'fail' );
-               $this->assertFalse( $this->capture( $jobMessage ) );
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/Tests/BaseSmashPigUnitTestCase.php 
b/Tests/BaseSmashPigUnitTestCase.php
deleted file mode 100644
index d130d07..0000000
--- a/Tests/BaseSmashPigUnitTestCase.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-namespace SmashPig\Tests;
-
-use SmashPig\Core\Context;
-use SmashPig\Core\Configuration;
-
-use PHPUnit_Framework_TestCase;
-
-class BaseSmashPigUnitTestCase extends PHPUnit_Framework_TestCase {
-
-       public function setUp() {
-               parent::setUp();
-
-               require_once __DIR__ . '/../vendor/autoload.php';
-       }
-
-       public function tearDown() {
-               Context::set(); // Nullify the context for next run.
-       }
-
-       protected function loadJson( $path ) {
-               return json_decode( file_get_contents( $path ), true );
-       }
-
-       /**
-        * Set a test configuration and initialize the context
-        *
-        * @param string $configNode node to use for configuration overrides
-        * @param string $configPath path to configuration override file
-        * @return Configuration
-        */
-       protected function setConfig( $configNode = 'default', $configPath = 
null ) {
-               $config = Configuration::createForViewWithOverrideFile( 
$configNode, $configPath );
-               Context::initWithLogger( $config );
-               return $config;
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/Tests/FileDumperTest.php b/Tests/FileDumperTest.php
deleted file mode 100644
index 4d4f953..0000000
--- a/Tests/FileDumperTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-
-namespace SmashPig\Tests;
-
-use SmashPig\Core\Context;
-use SmashPig\Core\DataStores\QueueWrapper;
-use SmashPig\Core\QueueConsumers\QueueFileDumper;
-
-class FileDumperTest extends BaseSmashPigUnitTestCase {
-
-       protected $filename;
-
-       public function setUp() {
-               parent::setUp();
-               Context::initWithLogger( QueueTestConfiguration::instance() );
-               $this->filename = tempnam( '/tmp', 'sptest' );
-       }
-
-       public function tearDown() {
-               parent::tearDown();
-               if ( file_exists( $this->filename ) ) {
-                       unlink( $this->filename );
-               }
-       }
-
-       public function testDump() {
-               $queue = QueueWrapper::getQueue( 'test' );
-               $expected = '';
-               for( $i = 0; $i < 5; $i++ ) {
-                       $message = array(
-                               'psycho' => 'alpha',
-                               'disco' => 'beta',
-                               'bio' => 'aqua',
-                               'dooloop' => mt_rand()
-                       );
-                       $queue->push( $message );
-                       $expected .= json_encode( $message ) . "\n";
-               }
-               $dumper = new QueueFileDumper( 'test', 0, $this->filename );
-               $dumper->dequeueMessages();
-               $this->assertEquals( $expected, file_get_contents( 
$this->filename ) );
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/Tests/QueueConsumerTest.php b/Tests/QueueConsumerTest.php
deleted file mode 100644
index 9b58b39..0000000
--- a/Tests/QueueConsumerTest.php
+++ /dev/null
@@ -1,197 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-
-namespace SmashPig\Tests;
-
-use Exception;
-use PDO;
-use PHPQueue\Interfaces\FifoQueueStore;
-use SmashPig\Core\Context;
-use SmashPig\Core\DataStores\DamagedDatabase;
-use SmashPig\Core\DataStores\QueueWrapper;
-
-class QueueConsumerTest extends BaseSmashPigUnitTestCase {
-
-       /**
-        * @var FifoQueueStore
-        */
-       protected $queue;
-       /**
-        * @var PDO
-        */
-       protected $damaged;
-
-       public function setUp() {
-               parent::setUp();
-               Context::initWithLogger( QueueTestConfiguration::instance() );
-               $this->queue = QueueWrapper::getQueue( 'test' );
-               $this->queue->createTable( 'test' );
-               $damagedDb = DamagedDatabase::get();
-               $damagedDb->createTable();
-               $this->damaged = $damagedDb->getDatabase();
-       }
-
-       public function testEmptyQueue() {
-               $consumer = new TestingQueueConsumer( 'test' );
-               $count = $consumer->dequeueMessages();
-               $this->assertEquals( 0, $count, 'Should report 0 messages 
processed' );
-       }
-
-       public function testOneMessage() {
-               $consumer = new TestingQueueConsumer( 'test' );
-               $payload = array(
-                       'wednesday' => 'addams',
-                       'spookiness' => mt_rand(),
-               );
-               $this->queue->push( $payload );
-               $count = $consumer->dequeueMessages();
-               $this->assertEquals( 1, $count, 'Should report 1 message 
processed' );
-               $this->assertEquals( array( $payload ), $consumer->processed, 
'Bad message' );
-               $this->assertNull( $this->queue->pop(),
-                       'Should delete message when processing is successful'
-               );
-       }
-
-       public function testDamagedQueue() {
-               $payload = array(
-                       'gateway' => 'test',
-                       'date' => time(),
-                       'order_id' => mt_rand(),
-                       'cousin' => 'itt',
-                       'kookiness' => mt_rand(),
-               );
-
-               $consumer = new TestingQueueConsumer( 'test' );
-               $consumer->exception = new Exception( 'kaboom!' );
-
-               $this->queue->push( $payload );
-               try {
-                       $consumer->dequeueMessages();
-               } catch ( Exception $ex ) {
-                       $this->fail(
-                               'Exception should not have bubbled up: ' . 
$ex->getMessage()
-                       );
-               }
-               $this->assertEquals(
-                       array( $payload ),
-                       $consumer->processed,
-                       'Processing snafu'
-               );
-
-               $damaged = $this->getDamagedQueueMessage( $payload );
-               $this->assertEquals(
-                       $payload,
-                       $damaged,
-                       'Should move message to damaged queue when exception is 
thrown'
-               );
-               $this->assertNull(
-                       $this->queue->pop(),
-                       'Should delete message on exception when damaged queue 
exists'
-               );
-       }
-
-       public function testMessageLimit() {
-               $messages = array();
-               for ( $i = 0; $i < 5; $i++ ) {
-                       $message = array(
-                               'gateway' => 'test',
-                               'date' => time(),
-                               'order_id' => mt_rand(),
-                               'box' => 'thing' . $i,
-                               'creepiness' => mt_rand(),
-                       );
-                       $messages[] = $message;
-                       $this->queue->push( $message );
-               }
-               // Should work when you pass in the limits as strings.
-               $consumer = new TestingQueueConsumer( 'test', 0, '3' );
-               $count = $consumer->dequeueMessages();
-               $this->assertEquals(
-                       3, $count, 'dequeueMessages returned wrong count'
-               );
-               $this->assertEquals(
-                       3,
-                       count( $consumer->processed ),
-                       'Called callback wrong number of times'
-               );
-
-               for ( $i = 0; $i < 3; $i++ ) {
-                       $this->assertEquals(
-                               $messages[$i],
-                               $consumer->processed[$i],
-                               'Message mutated'
-                       );
-               }
-               $this->assertEquals(
-                       $messages[3],
-                       $this->queue->pop(),
-                       'Dequeued too many messages'
-               );
-       }
-
-       public function testKeepRunningOnDamage() {
-               $messages = array();
-               for ( $i = 0; $i < 5; $i++ ) {
-                       $message = array(
-                               'gateway' => 'test',
-                               'date' => time(),
-                               'order_id' => mt_rand(),
-                               'box' => 'thing' . $i,
-                               'creepiness' => mt_rand(),
-                       );
-                       $messages[] = $message;
-                       $this->queue->push( $message );
-               }
-
-               $consumer = new TestingQueueConsumer( 'test', 0, 3 );
-               $consumer->exception = new Exception( 'Kaboom!' );
-               $count = 0;
-               try {
-                       $count = $consumer->dequeueMessages();
-               } catch ( Exception $ex ) {
-                       $this->fail(
-                               'Exception should not have bubbled up: ' . 
$ex->getMessage()
-                       );
-               }
-               $this->assertEquals(
-                       3, $count, 'dequeueMessages returned wrong count'
-               );
-               $this->assertEquals(
-                       3,
-                       count( $consumer->processed ),
-                       'Called callback wrong number of times'
-               );
-
-               for ( $i = 0; $i < 3; $i++ ) {
-                       $this->assertEquals(
-                               $messages[$i], $consumer->processed[$i], 
'Message mutated'
-                       );
-                       $damaged = $this->getDamagedQueueMessage( $messages[$i] 
);
-                       $this->assertEquals(
-                               $messages[$i],
-                               $damaged,
-                               'Should move message to damaged queue when 
exception is thrown'
-                       );
-               }
-               $this->assertEquals(
-                       $messages[3],
-                       $this->queue->pop(),
-                       'message 4 should be at the head of the queue'
-               );
-       }
-
-       protected function getDamagedQueueMessage( $message ) {
-               $select = $this->damaged->query( "
-                       SELECT * FROM damaged
-                       WHERE gateway='{$message['gateway']}'
-                       AND order_id = '{$message['order_id']}'" );
-               $msg = $select->fetch( PDO::FETCH_ASSOC );
-               if ( $msg ) {
-                       return json_decode( $msg['message'], true );
-               }
-               return null;
-       }
-
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)
diff --git a/Tests/TestingConfiguration.php b/Tests/TestingConfiguration.php
deleted file mode 100644
index 9084268..0000000
--- a/Tests/TestingConfiguration.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<<<<<<< HEAD   (4f84d8 Update vendor)
-=======
-<?php
-
-namespace SmashPig\Tests;
-
-use ReflectionClass;
-use SmashPig\Core\Configuration;
-
-/**
- * Do trixy things with Configuration
- */
-class TestingConfiguration extends Configuration {
-       /**
-        * Set default search path to skip actual installed configuration like 
/etc
-        *
-        * @implements Configuration::getDefaultSearchPath
-        */
-       public function getDefaultSearchPath() {
-               $searchPath = array(
-                       __DIR__ . "/../SmashPig.yaml",
-               );
-               return $searchPath;
-       }
-
-       public static function loadConfigWithFileOverrides( $paths ) {
-               $config = static::createForViewWithOverrideFile( 'default', 
$paths );
-               return $config;
-       }
-
-       public static function loadConfigWithLiteralOverrides( $data ) {
-               $config = static::createForView( 'default' );
-               $config->override( $data );
-               return $config;
-       }
-}
->>>>>>> BRANCH (9c1f01 Route all config access through Context)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I340f796851e1d3730801ff4fedc4d8adf100ad4c
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: deployment
Gerrit-Owner: Mepps <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to