Cdentinger has uploaded a new change for review.

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

Change subject: Add test for retry exception
......................................................................

Add test for retry exception

Change-Id: I37f6426ec46c7885e68acfc93e2e442ebef8e793
---
A PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php
1 file changed, 32 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/97/315897/1

diff --git a/PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php
new file mode 100644
index 0000000..2bf0bd5
--- /dev/null
+++ b/PaymentProviders/Adyen/Tests/phpunit/RequeueMessageTest.php
@@ -0,0 +1,32 @@
+<?php namespace SmashPig\PaymentProviders\Adyen\Test;
+
+use SmashPig\Core\DataStores\KeyedOpaqueStorableObject;
+use SmashPig\PaymentProviders\Adyen\Jobs\ProcessCaptureRequestJob;
+use SmashPig\Tests\BaseSmashPigUnitTestCase;
+use SmashPig\Core\RetryableException;
+
+/**
+ * Make sure a message that arrives before the pending databases entry gets
+ * written is properly requeued for retry.
+ */
+class RequeueMessageTest extends BaseSmashPigUnitTestCase {
+
+       public function testRequeueMessage() {
+
+               $auth = KeyedOpaqueStorableObject::fromJsonProxy(
+                       
'SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\Authorisation',
+                       file_get_contents( __DIR__ . '/../Data/auth.json' )
+               );
+
+               try {
+                       $job = ProcessCaptureRequestJob::factory( $auth );
+                       $job->execute();
+               } catch ( RetryableException $e ) {
+                       // "got here"
+                       $this->assertTrue( true,
+                               'Got a RetryableException with an empty pending 
queue.' );
+               }
+
+       }
+
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37f6426ec46c7885e68acfc93e2e442ebef8e793
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Cdentinger <cdentin...@wikimedia.org>

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

Reply via email to