Katie Horn has uploaded a new change for review.

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

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

Merge branch 'master' into deploy

Conflicts:
        tests/Adapter/WorldPay/WorldPayTest.php
        tests/Gateway_FormTest.php

Change-Id: I2f893639b44a85d4ba697647c138b2a96377737a
---
D tests/Adapter/WorldPay/WorldPayTest.php
D tests/Gateway_FormTest.php
2 files changed, 0 insertions(+), 665 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/82/174882/1

diff --git a/tests/Adapter/WorldPay/WorldPayTest.php 
b/tests/Adapter/WorldPay/WorldPayTest.php
deleted file mode 100644
index 8a9234c..0000000
--- a/tests/Adapter/WorldPay/WorldPayTest.php
+++ /dev/null
@@ -1,414 +0,0 @@
-<<<<<<< HEAD   (995562 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 Fundraising
- * @group DonationInterface
- * @group WorldPay
- */
-class DonationInterface_Adapter_WorldPay_WorldPayTest extends 
DonationInterfaceTestCase {
-
-       /**
-        * @param $name string The name of the test case
-        * @param $data array Any parameters read from a dataProvider
-        * @param $dataName string|int The name or index of the data set
-        */
-       function __construct( $name = null, array $data = array(), $dataName = 
'' ) {
-               parent::__construct( $name, $data, $dataName );
-               $this->testAdapterClass = 'TestingWorldPayAdapter';
-       }
-
-       /**
-        * Just making sure we can instantiate the thing without blowing up 
completely
-        */
-       function testConstruct() {
-               $options = $this->getDonorTestData();
-               $class = $this->testAdapterClass;
-
-               $_SERVER['REQUEST_URI'] = 
GatewayFormChooser::buildPaymentsFormURL( 'testytest', array ( 'gateway' => 
$class::getIdentifier() ) );
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $this->assertInstanceOf( 'TestingWorldPayAdapter', $gateway );
-       }
-
-       /**
-        * Test the AntiFraud hooks
-        */
-       function testAntiFraudHooks() {
-               $options = $this->getDonorTestData( 'US' );
-               $options['utm_source'] = "somethingmedia";
-               $options['email'] = "[email protected]";
-
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $gateway->runAntifraudHooks();
-
-               $this->assertEquals( 'reject', $gateway->getValidationAction(), 
'Validation action is not as expected' );
-               $this->assertEquals( 113, $gateway->getRiskScore(), 'RiskScore 
is not as expected' );
-       }
-
-       /**
-        * Just making sure we can instantiate the thing without blowing up 
completely
-        */
-       function testNeverLog() {
-               $options = $this->getDonorTestData();
-               $options['cvv'] = '123';
-               $class = $this->testAdapterClass;
-
-               $_SERVER['REQUEST_URI'] = 
GatewayFormChooser::buildPaymentsFormURL( 'testytest', array ( 'gateway' => 
$class::getIdentifier() ) );
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $this->assertInstanceOf( 'TestingWorldPayAdapter', $gateway );
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               $logline = $this->getGatewayLogMatches( $gateway, LOG_INFO, 
'/Request XML/' );
-
-               $this->assertType( 'string', $logline, "We did not receive 
exactly one logline back that contains request XML" );
-               $this->assertEquals( '1', preg_match( '/Cleaned/', $logline ), 
'The logline did not come back marked as "Cleaned".' );
-               $this->assertEquals( '0', preg_match( '/CNV/', $logline ), 'The 
"Cleaned" logline contained CVN data!' );
-       }
-
-       function testWorldPayFormLoad() {
-               $init = $this->getDonorTestData();
-               unset( $init['order_id'] );
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['ffname'] = 'worldpay';
-               $init['currency_code'] = 'EUR';
-
-               $assertNodes = array (
-                       'selected-amount' => array (
-                               'nodename' => 'span',
-                               'innerhtml' => '€1.55',
-                       ),
-                       'fname' => array(
-                               'nodename' => 'input',
-                               'value' => 'Firstname',
-                       ),
-                       'lname' => array(
-                               'nodename' => 'input',
-                               'value' => 'Surname',
-                       ),
-                       'street' => array(
-                               'nodename' => 'input',
-                               'value' => '123 Fake Street',
-                       ),
-                       'city' => array(
-                               'nodename' => 'input',
-                               'value' => 'San Francisco',
-                       ),
-                       'zip' => array(
-                               'nodename' => 'input',
-                               'value' => '94105',
-                       ),
-                       'country' => array(
-                               'nodename' => 'input',
-                               'value' => 'US',
-                       ),
-                       'emailAdd' => array(
-                               'nodename' => 'input',
-                               'value' => '',
-                       ),
-                       'language' => array(
-                               'nodename' => 'input',
-                               'value' => 'en',
-                       ),
-                       'state' => array(
-                               'nodename' => 'select',
-                               'selected' => 'CA',
-                       ),
-                       'informationsharing' => array (
-                               'nodename' => 'p',
-                               'innerhtml' => "By donating, you agree to share 
your personal information with the Wikimedia Foundation, the nonprofit 
organization that hosts Wikipedia and other Wikimedia projects, and its service 
providers pursuant to our <a 
href=\"//wikimediafoundation.org/wiki/Donor_policy\">donor policy</a>. 
Wikimedia Foundation and its service providers are located in the United States 
and in other countries whose privacy laws may not be equivalent to your own. We 
do not sell or trade your information to anyone. For more information please 
read our <a href=\"//wikimediafoundation.org/wiki/Donor_policy\">donor 
policy</a>."
-                       ),
-               );
-
-               $this->verifyFormOutput( 'TestingWorldPayGateway', $init, 
$assertNodes, true );
-       }
-
-       function testPaymentFormSubmit() {
-               $init = $this->getDonorTestData( 'FR' );
-               unset( $init['order_id'] );
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['ffname'] = 'worldpay';
-               $init['currency_code'] = 'EUR';
-               $init['email'] = '[email protected]';
-
-               $init['OTT'] = 'SALT123456789';
-
-               $assertNodes = array(
-                       'headers' => array(
-                               'Location' => 
'https://wikimediafoundation.org/wiki/Thank_You/fr',
-                       ),
-               );
-
-               $this->verifyFormOutput( 'TestingWorldPayGateway', $init, 
$assertNodes, true );
-       }
-
-       function testWorldPayFormLoad_FR() {
-               $init = $this->getDonorTestData( 'FR' );
-               unset( $init['order_id'] );
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['ffname'] = 'worldpay';
-
-               $assertNodes = array (
-                       'selected-amount' => array (
-                               'nodename' => 'span',
-                               'innerhtml' => '€1.55',
-                       ),
-                       'fname' => array (
-                               'nodename' => 'input',
-                               'value' => 'Prénom',
-                       ),
-                       'lname' => array (
-                               'nodename' => 'input',
-                               'value' => 'Nom',
-                       ),
-                       'informationsharing' => array (
-                               'nodename' => 'p',
-                               'innerhtml' => "En faisant ce don, vous 
acceptez notre politique de confidentialité en matière de donation ainsi que de 
partager vos données personnelles avec la <a 
href=\"https://wikimediafoundation.org/wiki/Special:LandingCheck?basic=true&amp;landing_page=Tax_Deductibility&amp;country=FR&amp;language=fr&amp;uselang=fr\";>Fondation
 Wikimédia</a> et ses prestataires de services situés aux Etats-Unis et 
ailleurs.",
-                       ),
-                       'country' => array (
-                               'nodename' => 'input',
-                               'value' => 'FR',
-                       ),
-               );
-
-               $this->verifyFormOutput( 'TestingWorldPayGateway', $init, 
$assertNodes, true );
-       }
-
-       /**
-        * Make sure Belgian form loads in all of that country's supported 
languages
-        * @dataProvider belgiumLanguageProvider
-        */
-       public function testWorldPayFormLoad_BE( $language ) {
-               $init = $this->getDonorTestData( 'BE' );
-               unset( $init['order_id'] );
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['ffname'] = 'worldpay';
-               $init['language'] = $language;
-
-               $assertNodes = array (
-                       'selected-amount' => array (
-                               'nodename' => 'span',
-                               'innerhtml' => '€1.55',
-                       ),
-                       'fname-label' => array (
-                               'nodename' => 'label',
-                               'innerhtml' => wfMessage( 
'donate_interface-donor-fname' )->inLanguage( $language )->text(),
-                       ),
-                       'lname-label' => array (
-                               'nodename' => 'label',
-                               'innerhtml' => wfMessage( 
'donate_interface-donor-lname' )->inLanguage( $language )->text(),
-                       ),
-                       'emailAdd-label' => array (
-                               'nodename' => 'label',
-                               'innerhtml' => wfMessage( 
'donate_interface-donor-email' )->inLanguage( $language )->text(),
-                       ),
-                       'informationsharing' => array (
-                               'nodename' => 'p',
-                               'innerhtml' => wfMessage( 
'donate_interface-informationsharing', '.*' )->inLanguage( $language )->text(),
-                       ),
-               );
-
-               $this->verifyFormOutput( 'TestingWorldPayGateway', $init, 
$assertNodes, true );
-       }
-
-       /**
-        * Testing that we can retrieve the cvv_match value and run antifraud 
on it correctly
-        */
-       function testAntifraudCVVMatch() {
-               $options = $this->getDonorTestData(); //don't really care: 
We'll be using the dummy response directly.
-               $class = $this->testAdapterClass;
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               $this->assertEquals( '1', $gateway->getData_Unstaged_Escaped( 
'cvv_result' ), 'cvv_result was not set after AuthorizePaymentForFraud' );
-               $this->assertTrue( $gateway->getCVVResult(), 'getCVVResult not 
passing somebody with a match.' );
-
-               //and now, for fun, test a wrong code.
-               $gateway->addData( array ( 'cvv_result' => '2' ), 'response' );
-               $this->assertFalse( $gateway->getCVVResult(), 'getCVVResult not 
failing somebody with garbage.' );
-       }
-
-       /**
-        * Ensure we don't give too high a risk score when AVS address / zip 
match was not performed
-        */
-       function testAntifraudAllowsAvsNotPerformed() {
-               $options = $this->getDonorTestData('FR'); //don't really care: 
We'll be using the dummy response directly.
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->setDummyGatewayResponseCode( 9000 );
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               $this->assertEquals( '9', $gateway->getData_Unstaged_Escaped( 
'avs_address' ), 'avs_address was not set after AuthorizePaymentForFraud' );
-               $this->assertEquals( '9', $gateway->getData_Unstaged_Escaped( 
'avs_zip' ), 'avs_zip was not set after AuthorizePaymentForFraud' );
-               $this->assertTrue( $gateway->getAVSResult() < 25, 'getAVSResult 
returning too high a score for AVS not performed.' );
-       }
-
-       /**
-        * Check to make sure we don't run antifraud filters (and burn a 
minfraud query) when we know the transaction has already failed
-        */
-       function testAntifraudNotPerformedOnGatewayError() {
-               $options = $this->getDonorTestData( 'FR' ); //don't really 
care: We'll be using the dummy response directly.
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->setDummyGatewayResponseCode( 2208 ); //account 
problems
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               //assert that:
-               //#1 - the gateway object has an appropriate transaction error 
set
-               //#2 - antifraud checks were not performed.
-
-               //check for the error code that corresponds to the transaction 
coming back with a failure, rather than the one that we use for fraud fail.
-               $errors = $gateway->getTransactionErrors();
-               $this->assertTrue( !empty( $errors ), 'No errors in 
getTransactionErrors after a bad "AuthorizePaymentForFraud"' );
-               $this->assertTrue( array_key_exists( 'internal-0001', $errors 
), 'Unexpected error code' );
-
-               //check more things to make sure we didn't run any fraud filters
-               $logline = $this->getGatewayLogMatches( $gateway, LOG_INFO, 
'/Preparing to run custom filters/' );
-               $this->assertFalse( $logline, 'According to the logs, we ran 
antifraud filters and should not have' );
-               $this->assertEquals( 'process', 
$gateway->getValidationAction(), 'Validation action is not as expected' );
-               $this->assertEquals( 0, $gateway->getRiskScore(), 'RiskScore is 
not as expected' );
-
-       }
-
-       /**
-        * Check to make sure we do run antifraud filters when we know the 
transaction is okay to go
-        */
-       function testAntifraudPerformedOnGatewayNoError() {
-               $options = $this->getDonorTestData( 'FR' ); //don't really 
care: We'll be using the dummy response directly.
-               $options['email'] = '[email protected]';
-
-               $gateway = $this->getFreshGatewayObject( $options );
-//             $gateway->setDummyGatewayResponseCode( 2208 ); //account 
problems
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               //assert that:
-               //#1 - the gateway object has no errors set
-               //#2 - antifraud checks were performed.
-               $errors = $gateway->getTransactionErrors();
-               $this->assertTrue( empty( $errors ), 'Errors assigned in 
getTransactionErrors after a good "AuthorizePaymentForFraud"' );
-               //check more things to make sure we did run the fraud filters
-               $logline = $this->getGatewayLogMatches( $gateway, LOG_INFO, 
'/CustomFiltersScores/' );
-               $this->assertType( 'string', $logline, 'No antifraud filters 
were run, according to the logs' );
-               $this->assertEquals( 'process', 
$gateway->getValidationAction(), 'Validation action is not as expected' );
-               $this->assertEquals( 0, $gateway->getRiskScore(), 'RiskScore is 
not as expected' );
-       }
-
-       /**
-        * Ensure we're staging a punctuation-stripped version of the email 
address in merchant_reference_2
-        */
-       function testMerchantReference2() {
-               $options = $this->getDonorTestData();
-               $options['email'] = '[email protected]';
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->_stageData();
-               $staged = $gateway->_getData_Staged( 'merchant_reference_2' );
-               $this->assertEquals( 'little teapot short stout com', $staged );
-       }
-
-       function testTransliterateUtf8forEurocentricProcessor() {
-               $options = $this->getDonorTestData();
-               $options['fname'] = 'Barnabáš';
-               $options['lname'] = 'Voříšek';
-               $options['street'] = 'Truhlářská 320/62';
-               $options['city'] = 'České Budějovice';
-               $class = $this->testAdapterClass;
-
-               $_SERVER['REQUEST_URI'] = 
GatewayFormChooser::buildPaymentsFormURL( 'testytest', array ( 'gateway' => 
$class::getIdentifier() ) );
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $gateway->_stageData();
-               $gateway->do_transaction( 'AuthorizeAndDepositPayment' );
-               $xml = new SimpleXMLElement( preg_replace( '/StringIn=/', '', 
$gateway->curled ) );
-               $this->assertEquals( 'Barnabás', $xml->FirstName );
-               $this->assertEquals( 'Vorísek', $xml->LastName );
-               $this->assertEquals( 'Truhlárská 320/62', $xml->Address1 );
-               $this->assertEquals( 'Ceské Budejovice', $xml->City );
-       }
-
-       /**
-        * Check that whacky #.# format orderid is unmolested by order_id_meta 
validation.
-        */
-       function testWackyOrderIdPassedValidation() {
-               $init = $this->initial_vars;
-
-        $init['order_id'] = '2143.0';
-        unset( $_POST['order_id'] );
-        unset( $_SESSION['Donor']['order_id'] );
-        $gateway = $this->getFreshGatewayObject( $init, array( 'batch_mode' => 
TRUE, ) );
-        $this->assertEquals( $init['order_id'], 
$gateway->getData_Unstaged_Escaped( 'order_id' ),
-                       'Decimal Order ID is allowed by orderIdMeta validation' 
);
-       }
-
-       /**
-        * Check that order_id is built from contribution_tracking id.
-        */
-       function testWackyOrderIdBasedOnContributionTracking() {
-               $init = $this->initial_vars;
-
-        $init['contribution_tracking_id'] = mt_rand();
-        $_SESSION['numAttempt'] = 2;
-        unset( $_POST['order_id'] );
-        $gateway = $this->getFreshGatewayObject( $init, array( 'batch_mode' => 
TRUE, ) );
-               $expected_order_id = 
"{$init['contribution_tracking_id']}.{$_SESSION['numAttempt']}";
-        $this->assertEquals( $expected_order_id, 
$gateway->getData_Unstaged_Escaped( 'order_id' ),
-                       'Decimal Order ID is correctly built from Contribution 
Tracking ID.' );
-       }
-
-       /**
-        * Ensure processResponse doesn't fail trxn for special accounts when 
AVS
-        * nodes are missing.
-        */
-       function testProcessResponseAllowsSnowflakeAVSMissing() {
-               $options = $this->getDonorTestData( 'FJ' ); // 'FJ' store ID is 
set up as a special exception
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->setDummyGatewayResponseCode( 'snowflake' );
-               $results = $gateway->do_transaction( 'AuthorizePaymentForFraud' 
);
-
-               // internal-0001 is the error code processRespose adds for 
missing nodes
-               $this->assertFalse( array_key_exists( 'internal-0001', 
$results['errors'] ),
-                       'processResponse is failing a special snowflake account 
with a response missing AVS nodes' );
-       }
-
-       /**
-        * Ensure we don't give too high a risk score for special accounts when
-        * AVS address / zip match was not performed and CVV reports failure
-        */
-       function testAntifraudAllowsSnowflakeAVSMissingAndCVVMismatch() {
-               $options = $this->getDonorTestData( 'FJ' ); // 'FJ' store ID is 
set up as a special exception
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->setDummyGatewayResponseCode( 'snowflake' );
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               $this->assertTrue( $gateway->getCVVResult(), 'getCVVResult 
failing snowflake account' );
-
-               $this->assertTrue( $gateway->getAVSResult() < 25, 'getAVSResult 
giving snowflake account too high a risk score' );
-       }
-}
->>>>>>> BRANCH (7fbd62 Changing legal text in en)
diff --git a/tests/Gateway_FormTest.php b/tests/Gateway_FormTest.php
deleted file mode 100644
index 5b1af56..0000000
--- a/tests/Gateway_FormTest.php
+++ /dev/null
@@ -1,251 +0,0 @@
-<<<<<<< HEAD   (995562 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.
- *
- * @author Mark Holmquist <[email protected]>
- */
-
-/**
- * Only here so we can run unit tests.
- */
-class TestGatewayForm extends Gateway_Form {
-       public function getForm() {
-               return '';
-       }
-}
-
-/**
- * @group Fundraising
- * @group Splunge
- * @group Gateways
- * @group DonationInterface
- * @author Mark Holmquist <[email protected]>
- */
-class DonationInterface_Gateway_FormTest extends DonationInterfaceTestCase {
-       protected $adapter;
-       protected $form;
-
-       protected function setUp() {
-               $this->adapter = new TestingGlobalCollectAdapter();
-               $this->form = new TestGatewayForm( $this->adapter );
-               parent::setUp();
-       }
-
-       /**
-        * @covers Gateway_Form::__construct
-        */
-       public function testConstruct() {
-               $this->assertThat(
-                       $this->form,
-                       $this->isInstanceOf( 'TestGatewayForm' )
-               );
-       }
-
-       /**
-        * @covers Gateway_Form::generateDonationFooter
-        */
-       public function testGenerateDonationFooter() {
-               global $wgExtensionAssetsPath;
-
-               $expected  = '<div class="payflow-cc-form-section" 
id="payflowpro_gateway-donate-addl-info">';
-               $expected .=    '<div 
id="payflowpro_gateway-donate-addl-info-secure-logos">';
-               $expected .=            '<p class="">';
-               $expected .=                    '<img src="' . 
$wgExtensionAssetsPath . 
'/DonationInterface/gateway_forms/includes/rapidssl_ssl_certificate-nonanimated.png">';
-               $expected .=            '</p>';
-               $expected .=    '</div>';
-               $expected .=    '<div 
id="payflowpro_gateway-donate-addl-info-text">';
-               $expected .=            '<p class="">';
-               $expected .=                    wfMessage( 
'donate_interface-otherways-short' )->text();
-               $expected .=            '</p>';
-               $expected .=            '<p class="">';
-               $expected .=                    wfMessage( 
'donate_interface-informationsharing' )->text();
-               $expected .=            '</p>';
-               $expected .=            '<p class="">';
-               $expected .=                    wfMessage( 
'donate_interface-question-comment' )->text();
-               $expected .=            '</p>';
-               $expected .=    '</div>';
-               $expected .= '</div>';
-
-               $this->assertEquals(
-                       $expected,
-                       $this->form->generateDonationFooter()
-               );
-       }
-
-       /**
-        * @covers Gateway_Form::generateCountryDropdown
-        */
-       public function testGenerateCountryDropdown() {
-               // Most of this is taken from the method itself - we tear out 
some things
-               // If it was straight HTML, we'd have an insanely long test 
file, and I don't
-               // really feel like dealing with that mess.
-               $country_options = '';
-
-               // create a new array of countries with potentially translated 
country names for alphabetizing later
-               foreach ( GatewayPage::getCountries() as $iso_value => 
$full_name ) {
-                       $countries[$iso_value] = wfMessage( 
'donate_interface-country-dropdown-' . $iso_value )->text();
-               }
-
-               // alphabetically sort the country names
-               asort( $countries, SORT_STRING );
-
-               // generate a dropdown option for each country
-               foreach ( $countries as $iso_value => $full_name ) {
-                       $country_options .= Xml::option( $full_name, $iso_value 
);
-               }
-
-               // build the actual select
-               $expected = Xml::openElement(
-                       'select',
-                       array(
-                               'name' => 'country',
-                               'id' => 'country'
-                       ) );
-               $expected .= Xml::option( wfMessage( 
'donate_interface-select-country' )->text(), '', false );
-               $expected .= $country_options;
-               $expected .= Xml::closeElement( 'select' );
-
-               $this->assertEquals(
-                       $expected,
-                       $this->form->generateCountryDropdown()
-               );
-       }
-
-       /**
-        * @covers Gateway_Form::generateCardDropdown
-        */
-       public function testGenerateCardDropdown() {
-               $expected = (
-                       '<select name="card" id="card">' .
-                               '<option value="visa">' .
-                                       wfMessage( 
'donate_interface-card-name-visa' )->text() .
-                               '</option>' .
-                               '<option value="mc">' .
-                                       wfMessage( 
'donate_interface-card-name-mc' )->text() .
-                               '</option>' .
-                               '<option value="amex">' .
-                                       wfMessage( 
'donate_interface-card-name-amex' )->text() .
-                               '</option>' .
-                               '<option value="discover">' .
-                                       wfMessage( 
'donate_interface-card-name-discover' )->text() .
-                               '</option>' .
-                       '</select>'
-               );
-
-               $this->assertEquals(
-                       $expected,
-                       $this->form->generateCardDropdown()
-               );
-       }
-
-       /**
-        * @covers Gateway_Form::generateExpiryMonthDropdown
-        */
-       public function testGenerateExpiryMonthDropdown() {
-               global $wgLang;
-
-               $expected = '<select name="mos" id="expiration">';
-
-               foreach ( range( 1, 12 ) as $mon ) {
-                       // Rawr, I'm a monstr!
-                       $monstr = str_pad( $mon, 2, '0', STR_PAD_LEFT );
-                       $expected .= '<option value="' . $monstr . '">';
-                       $expected .= wfMessage( 'donate_interface-month', $mon, 
$wgLang->getMonthName( $mon ) )->text();
-                       $expected .= '</option>';
-               }
-
-               $expected .= '</select>';
-
-               $this->assertEquals(
-                       $expected,
-                       $this->form->generateExpiryMonthDropdown()
-               );
-       }
-
-       /**
-        * @covers Gateway_Form::generateExpiryYearDropdown
-        */
-       public function testGenerateExpiryYearDropdown() {
-               $expected = '<select name="year" id="year">';
-               $start = date( 'Y' );
-
-               foreach ( range( $start, $start + 10 ) as $year ) {
-                       $expected .= '<option value="' . $year . '">';
-                       $expected .= $year;
-                       $expected .= '</option>';
-               }
-
-               $expected .= '</select>';
-
-               $this->assertEquals(
-                       $expected,
-                       $this->form->generateExpiryYearDropdown()
-               );
-       }
-
-       /**
-        * @covers Gateway_Form::generateStateDropdown
-        */
-       public function testGenerateStateDropdown() {
-               $states = StateAbbreviations::statesMenuXML();
-               $expected = '<select name="state" id="state">';
-
-               foreach ( $states as $val => $state ) {
-                       $expected .= '<option value="' . $val;
-                       $expected .= '">';
-                       $expected .= wfMessage( 
'donate_interface-state-dropdown-' . $val )->text();
-                       $expected .= '</option>';
-               }
-
-               $expected .= '</select>';
-
-               $this->assertEquals(
-                       $expected,
-                       $this->form->generateStateDropdown()
-               );
-       }
-
-       /**
-        * @covers Gateway_Form::generateCurrencyDropdown
-        */
-       public function testGenerateCurrencyDropdown(){
-               $currencies = array_flip( $this->form->gateway->getCurrencies() 
);
-
-               $dom_thingy = new DOMDocument();
-
-               $dom_thingy->encoding = 'UTF-8';
-               $dom_thingy->loadHTML( '<?xml encoding="UTF-8">' . 
$this->form->generateCurrencyDropdown() );
-
-               $select_node = $dom_thingy->getElementById( 
'input_currency_code' );
-               $this->assertEquals( 'currency_code', 
$select_node->getAttribute( 'name' ) );
-
-               foreach ( $select_node->childNodes as $option ) {
-                       $currency = $option->getAttribute( 'value' );
-                       $this->assertNotNull( $currencies[$currency], 'Currency 
node generated for non-existent ' . $currency );
-                       $msg = wfMessage( 'donate_interface-' . $currency );
-                       if ( ! $msg->inContentLanguage()->isBlank() ) {
-                               $this->assertEquals( $msg, $option->nodeValue, 
'Option text wrong for currency ' . $currency );
-                       }
-                       if ( $currency === 'USD' ) {
-                               $this->assertNotNull( $option->getAttribute( 
'selected' ) );
-                       }
-                       unset( $currencies[$currency] );
-               }
-               $this->assertEmpty( $currencies, 'Did not generate options for 
all currencies!' );
-       }
-}
->>>>>>> BRANCH (7fbd62 Changing legal text in en)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f893639b44a85d4ba697647c138b2a96377737a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: deployment
Gerrit-Owner: Katie Horn <[email protected]>

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

Reply via email to