Ejegg has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/349116 )
Change subject: Merge branch 'master' into deployment ...................................................................... Merge branch 'master' into deployment 3dbf36b Remove deprecated key-value interfaces ffcf2e9 Get rid of queue mirroring 171da59 Form should not validate if manual errors are present Change-Id: Ibb465a68a0b85291757176405565c0bf8ff5ec40 --- D tests/phpunit/DonationQueueTest.php D tests/phpunit/includes/TestingQueue.php 2 files changed, 0 insertions(+), 192 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/16/349116/1 diff --git a/tests/phpunit/DonationQueueTest.php b/tests/phpunit/DonationQueueTest.php deleted file mode 100644 index d8b467a..0000000 --- a/tests/phpunit/DonationQueueTest.php +++ /dev/null @@ -1,124 +0,0 @@ -<<<<<<< HEAD (9b82ca Merge branch 'master' into deployment) -======= -<?php -/** - * Wikimedia Foundation - * - * LICENSE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -/** - * @group DonationInterface - * @group QueueHandling - * - * @category UnitTesting - * @package Fundraising_QueueHandling - */ -class DonationQueueTest extends DonationInterfaceTestCase { - protected $transaction; - protected $queue_name; - protected $expected_message; - - public function setUp() { - parent::setUp(); - - $this->queue_name = 'test-' . mt_rand(); - - $this->setMwGlobals( array( - 'wgDonationInterfaceQueues' => array( - $this->queue_name => array(), - ), - ) ); - - $this->transaction = array( - 'amount' => '1.24', - 'city' => 'Dunburger', - 'contribution_tracking_id' => mt_rand(), - // FIXME: err, we're cheating normalization here. - 'correlation-id' => 'testgateway-' . mt_rand(), - 'country' => 'US', - 'currency_code' => 'USD', - 'date' => time(), - 'email' => 'nob...@wikimedia.org', - 'fname' => 'Jen', - 'gateway_account' => 'default', - 'gateway' => 'testgateway', - 'gateway_txn_id' => mt_rand(), - 'order_id' => mt_rand(), - 'language' => 'en', - 'lname' => 'Russ', - 'payment_method' => 'cc', - 'payment_submethod' => 'visa', - 'php-message-class' => 'SmashPig\CrmLink\Messages\DonationInterfaceMessage', - 'response' => 'Gateway response something', - 'state' => 'AK', - 'street' => '1 Fake St.', - 'user_ip' => '127.0.0.1', - 'utm_source' => 'testing', - 'postal_code' => '12345', - ); - - $this->expected_message = array( - 'contribution_tracking_id' => $this->transaction['contribution_tracking_id'], - 'utm_source' => 'testing', - 'language' => 'en', - 'email' => 'nob...@wikimedia.org', - 'first_name' => 'Jen', - 'last_name' => 'Russ', - 'street_address' => '1 Fake St.', - 'city' => 'Dunburger', - 'state_province' => 'AK', - 'country' => 'US', - 'postal_code' => '12345', - 'gateway' => 'testgateway', - 'gateway_account' => 'default', - 'gateway_txn_id' => $this->transaction['gateway_txn_id'], - 'order_id' => $this->transaction['order_id'], - 'payment_method' => 'cc', - 'payment_submethod' => 'visa', - 'response' => 'Gateway response something', - 'currency' => 'USD', - 'fee' => '0', - 'gross' => '1.24', - 'user_ip' => '127.0.0.1', - 'date' => (int)$this->transaction['date'], - 'source_host' => WmfFramework::getHostname(), - 'source_name' => 'DonationInterface', - 'source_run_id' => getmypid(), - 'source_type' => 'payments', - 'source_version' => DonationQueue::getVersionStamp(), - ); - } - - public function testPushMessage() { - DonationQueue::instance()->push( $this->transaction, $this->queue_name ); - - $this->assertEquals( $this->expected_message, - DonationQueue::instance()->pop( $this->queue_name ) ); - } - - /** - * After pushing 2, pop should return the first. - */ - public function testIsFifoQueue() { - DonationQueue::instance()->push( $this->transaction, $this->queue_name ); - - $transaction2 = $this->transaction; - $transaction2['correlation-id'] = mt_rand(); - - $this->assertEquals( $this->expected_message, - DonationQueue::instance()->pop( $this->queue_name ) ); - } -} ->>>>>>> BRANCH (171da5 Form should not validate if manual errors are present) diff --git a/tests/phpunit/includes/TestingQueue.php b/tests/phpunit/includes/TestingQueue.php deleted file mode 100644 index 0e1eead..0000000 --- a/tests/phpunit/includes/TestingQueue.php +++ /dev/null @@ -1,68 +0,0 @@ -<<<<<<< HEAD (9b82ca Merge branch 'master' into deployment) -======= -<?php -/** - * Wikimedia Foundation - * - * LICENSE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -/* -FIXME: We can't reference the actual classes until vendor/ is provisioned for tests. - -use PHPQueue\Backend\Base; -*/ - -/** - * Queue backend that uses a simple static variable. Supports all operations - * and multiple queues, but (obviously) data is destroyed on application - * shutdown. - */ -class TestingQueue /* extends Base implements FifoQueueStore */ { - protected $queue_name; - protected $queue; - - public static $queues = array(); - - public function __construct( $options=array() ) { - //parent::__construct(); - if ( !empty($options['queue'] ) ) { - $this->queue_name = $options['queue']; - } else { - $this->queue_name = 'default'; - } - // Make me specific. - if ( !array_key_exists( $this->queue_name, self::$queues ) ) { - self::$queues[$this->queue_name] = array(); - } - $this->queue = &self::$queues[$this->queue_name]; - } - - public static function clearAll() { - self::$queues = array(); - } - - public function push( $data ) { - $this->queue[] = json_encode( $data ); - return count( $this->queue ) - 1; - } - - public function pop() { - if ( !count( $this->queue ) ) { - return null; - } - return json_decode( array_shift( $this->queue ), true ); - } -} ->>>>>>> BRANCH (171da5 Form should not validate if manual errors are present) -- To view, visit https://gerrit.wikimedia.org/r/349116 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibb465a68a0b85291757176405565c0bf8ff5ec40 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface 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