Eileen has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/392553 )
Change subject: Align whitespace to drupal std. ...................................................................... Align whitespace to drupal std. I simply ran phpstorm code formatter over the offline2civicrm/tests dir with code formatting set to drupal standards & then eyeballed the changes as I committed them to see that nothing weird was happening. I thought that doing the files around the one I was about to start work on made sense Change-Id: Ic13a06b65f85fb007c9938dccf838cf59eb2ea61 --- M sites/all/modules/offline2civicrm/tests/BenevityTest.php M sites/all/modules/offline2civicrm/tests/ChecksFileTest.php M sites/all/modules/offline2civicrm/tests/CoinBaseTest.php M sites/all/modules/offline2civicrm/tests/ContributionConversionTest.php M sites/all/modules/offline2civicrm/tests/EngageChecksFileTest.php M sites/all/modules/offline2civicrm/tests/ForeignChecksFileTest.php M sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php M sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php M sites/all/modules/offline2civicrm/tests/SquareFileTest.php M sites/all/modules/offline2civicrm/tests/WmfImportTest.php M sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php M sites/all/modules/offline2civicrm/tests/includes/ChecksFileProbe.php M sites/all/modules/offline2civicrm/tests/includes/EngageChecksFileProbe.php M sites/all/modules/offline2civicrm/tests/includes/ForeignChecksFileProbe.php M sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php M sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php M sites/all/modules/offline2civicrm/tests/includes/SquareFileProbe.php 17 files changed, 973 insertions(+), 774 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm refs/changes/53/392553/1 diff --git a/sites/all/modules/offline2civicrm/tests/BenevityTest.php b/sites/all/modules/offline2civicrm/tests/BenevityTest.php index 78487a5..4d87605 100644 --- a/sites/all/modules/offline2civicrm/tests/BenevityTest.php +++ b/sites/all/modules/offline2civicrm/tests/BenevityTest.php @@ -59,9 +59,15 @@ * Test that all imports fail if the organization has multiple matches. */ function testImportFailOrganizationContactAmbiguous() { - $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Donald Duck Inc', 'contact_type' => 'Organization')); - $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Donald Duck Inc', 'contact_type' => 'Organization')); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Donald Duck Inc', + 'contact_type' => 'Organization' + )); + $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Donald Duck Inc', + 'contact_type' => 'Organization' + )); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('0 out of 4 rows were imported.', $messages['Result']); @@ -71,7 +77,7 @@ * Test that all imports fail if the organization does not pre-exist. */ function testImportFailNoOrganizationContactExists() { - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('0 out of 4 rows were imported.', $messages['Result']); @@ -81,8 +87,11 @@ * Test that import passes for the contact if a single match is found. */ function testImportSucceedOrganizationSingleContactExists() { - $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Donald Duck Inc', 'contact_type' => 'Organization')); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Donald Duck Inc', + 'contact_type' => 'Organization' + )); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); @@ -92,17 +101,26 @@ * Test that import passes for the Individual contact if a single match is found. */ function testImportSucceedIndividualSingleContactExists() { - $thaMouseMeister = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); - $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + $thaMouseMeister = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $minnie = $this->callAPISuccess('Contact', 'create', array( + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', + )); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $minnie['id'])); $this->assertEquals(1, $contributions['count']); - $relationships = $this->callAPISuccess('Relationship', 'get', array('contact_id_a' => $minnie['id'], 'contact_id_b' => $thaMouseMeister['id'])); + $relationships = $this->callAPISuccess('Relationship', 'get', array( + 'contact_id_a' => $minnie['id'], + 'contact_id_b' => $thaMouseMeister['id'] + )); $this->assertEquals(1, $relationships['count']); } @@ -113,19 +131,26 @@ * matched, however the individual does not exist & should be created. */ function testImportSucceedIndividualNoExistingMatch() { - $thaMouseMeister = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $thaMouseMeister = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); $contribution = $this->callAPISuccessGetSingle('Contribution', array('trxn_id' => 'BENEVITY TRXN-SQUEAK')); $this->assertEquals('Benevity', $contribution['financial_type']); $relationships = $this->callAPISuccess('Relationship', 'get', array( - 'contact_id_a' => $contribution['contact_id'], - 'contact_id_b' => $thaMouseMeister['id']) + 'contact_id_a' => $contribution['contact_id'], + 'contact_id_b' => $thaMouseMeister['id'] + ) ); $this->assertEquals(1, $relationships['count']); - $minnie = $this->callAPISuccessGetSingle('Contact', array('id' => $contribution['contact_id'], 'return' => 'email')); + $minnie = $this->callAPISuccessGetSingle('Contact', array( + 'id' => $contribution['contact_id'], + 'return' => 'email' + )); $this->assertEquals('min...@mouse.org', $minnie['email']); } @@ -136,21 +161,26 @@ * not make a donation but is soft credited the organisation's donation. */ function testImportSucceedIndividualNoExistingMatchOnlyMatchingGift() { - $thaMouseMeister = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $thaMouseMeister = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $relationships = $this->callAPISuccess('Relationship', 'get', array( - 'contact_id_b' => $thaMouseMeister['id']) + 'contact_id_b' => $thaMouseMeister['id'] + ) ); $this->assertEquals(0, $relationships['count']); - $importer = new BenevityFile( __DIR__ . "/data/benevity_only_match.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity_only_match.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('All rows were imported', $messages['Result']); $contribution = $this->callAPISuccessGetSingle('Contribution', array('trxn_id' => 'BENEVITY TRXN-SQUEAK_MATCHED')); $relationship = $this->callAPISuccessGetSingle('Relationship', array( - 'contact_id_b' => $thaMouseMeister['id']) + 'contact_id_b' => $thaMouseMeister['id'] + ) ); - $this->assertEquals( $relationship['contact_id_a'], $contribution['soft_credit_to']); + $this->assertEquals($relationship['contact_id_a'], $contribution['soft_credit_to']); } /** @@ -164,9 +194,15 @@ * We are checking the relationship is created. */ function testImportSucceedIndividualSofCreditMatchMatchingGiftNoDonorGift() { - $thaMouseMeister = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $thaMouseMeister = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'minnie@mouse_home.org' + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'minnie@mouse_home.org' )); // Create a contribution on the organisation, soft credited to Better Minnie. $this->callAPISuccess('Contribution', 'create', array( @@ -176,29 +212,40 @@ 'contact_id' => $thaMouseMeister['id'], )); - $importer = new BenevityFile( __DIR__ . "/data/benevity_only_match.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity_only_match.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('All rows were imported', $messages['Result']); $contribution = $this->callAPISuccessGetSingle('Contribution', array('trxn_id' => 'BENEVITY TRXN-SQUEAK_MATCHED')); $relationship = $this->callAPISuccessGetSingle('Relationship', array( - 'contact_id_b' => $thaMouseMeister['id']) + 'contact_id_b' => $thaMouseMeister['id'] + ) ); - $this->assertEquals( $relationship['contact_id_a'], $contribution['soft_credit_to']); + $this->assertEquals($relationship['contact_id_a'], $contribution['soft_credit_to']); } /** * Test that import resolves ambiguous individuals by choosing based on the employer. */ function testImportSucceedIndividualDismabiguateByEmployer() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); $betterMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', 'employer_id' => $organization['id'], + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', + 'employer_id' => $organization['id'], )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); @@ -207,7 +254,10 @@ $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $betterMinnie['id'])); $this->assertEquals(1, $contributions['count']); - $relationships = $this->callAPISuccess('Relationship', 'get', array('contact_id_a' => $betterMinnie['id'], 'contact_id_b' => $organization['id'])); + $relationships = $this->callAPISuccess('Relationship', 'get', array( + 'contact_id_a' => $betterMinnie['id'], + 'contact_id_b' => $organization['id'] + )); $this->assertEquals(1, $relationships['count']); } @@ -215,14 +265,22 @@ * Test that import resolves ambiguous individuals by choosing based on the employer. */ function testImportSucceedIndividualDisambiguateByEmployerEmailAdded() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', )); $betterMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'employer_id' => $organization['id'], + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'employer_id' => $organization['id'], )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); @@ -231,7 +289,10 @@ $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $betterMinnie['id'])); $this->assertEquals(1, $contributions['count']); - $relationships = $this->callAPISuccess('Relationship', 'get', array('contact_id_a' => $betterMinnie['id'], 'contact_id_b' => $organization['id'])); + $relationships = $this->callAPISuccess('Relationship', 'get', array( + 'contact_id_a' => $betterMinnie['id'], + 'contact_id_b' => $organization['id'] + )); $this->assertEquals(1, $relationships['count']); $this->callAPISuccessGetSingle('Email', array('email' => 'min...@mouse.org')); } @@ -240,14 +301,23 @@ * Test that import creates new contacts when it can't resolve to a single contact. */ function testImportSucceedIndividualTooManyChoicesCantDecideSpamTheDB() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); $doppelgangerMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); - $importer = new BenevityFile( __DIR__ . "/data/benevity_mice_no_email.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity_mice_no_email.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('All rows were imported', $messages['Result']); @@ -271,14 +341,25 @@ * Test that import resolves ambiguous individuals by choosing based on the employer where nick_name match in play. */ function testImportSucceedIndividualDismabiguateByEmployerNickName() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Micey', 'nick_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Micey', + 'nick_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); $betterMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', 'employer_id' => $organization['id'], + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', + 'employer_id' => $organization['id'], )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); @@ -298,12 +379,21 @@ * Probably longer term the employment relationships will exist and this will be redundant. */ function testImportSucceedIndividualDismabiguateByPreviousSoftCredit() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); $betterMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); // Create a contribution on the organisation, soft credited to Better Minnie. $this->callAPISuccess('Contribution', 'create', array( @@ -312,7 +402,7 @@ 'soft_credit_to' => $betterMinnie['id'], 'contact_id' => $organization['id'], )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); @@ -321,7 +411,10 @@ $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $betterMinnie['id'])); $this->assertEquals(1, $contributions['count']); - $relationships = $this->callAPISuccess('Relationship', 'get', array('contact_id_a' => $betterMinnie['id'], 'contact_id_b' => $organization['id'])); + $relationships = $this->callAPISuccess('Relationship', 'get', array( + 'contact_id_a' => $betterMinnie['id'], + 'contact_id_b' => $organization['id'] + )); $this->assertEquals(1, $relationships['count']); } @@ -333,12 +426,21 @@ * as it will have an employee relationship. */ function testImportSucceedIndividualCreateIfAmbiguousPreviousSoftCredit() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); $betterMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); foreach (array($minnie, $betterMinnie) as $mouse) { // Create a contribution on the organisation, soft credited to each mouse.. @@ -350,11 +452,18 @@ )); } - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); - $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => array('IN' => array($minnie['id'], $betterMinnie['id'])))); + $contributions = $this->callAPISuccess('Contribution', 'get', array( + 'contact_id' => array( + 'IN' => array( + $minnie['id'], + $betterMinnie['id'] + ) + ) + )); $this->assertEquals(0, $contributions['count']); $newestMouse = $this->callAPISuccessGetSingle('Contact', array( @@ -364,7 +473,10 @@ )); $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $newestMouse['id'])); $this->assertEquals(1, $contributions['count']); - $relationships = $this->callAPISuccess('Relationship', 'get', array('contact_id_a' => $newestMouse['id'], 'contact_id_b' => $organization['id'])); + $relationships = $this->callAPISuccess('Relationship', 'get', array( + 'contact_id_a' => $newestMouse['id'], + 'contact_id_b' => $organization['id'] + )); $this->assertEquals(1, $relationships['count']); } @@ -376,12 +488,22 @@ * soft credited' then we prefer the one with an employee relationship. */ function testImportSucceedIndividualPreferRelationshipOverPreviousSoftCredit() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); $betterMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', 'employer_id' => $organization['id'], + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', + 'employer_id' => $organization['id'], )); // Create a contribution on the organisation, soft credited to each minne. @@ -394,7 +516,7 @@ // But betterMinnie has a relationship, she wins. - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); @@ -413,20 +535,33 @@ * soft credit) we should accept them. */ function testImportSucceedIndividualMatchToEmployerDisregardingEmail() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); - $betterMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'minnie@mouse_home.org', 'employer_id' => $organization['id'], + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $betterMinnie = $this->callAPISuccess('Contact', 'create', array( + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'minnie@mouse_home.org', + 'employer_id' => $organization['id'], + )); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); $contributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $betterMinnie['id'])); $this->assertEquals(1, $contributions['count']); - $relationships = $this->callAPISuccess('Relationship', 'get', array('contact_id_a' => $betterMinnie['id'], 'contact_id_b' => $organization['id'])); + $relationships = $this->callAPISuccess('Relationship', 'get', array( + 'contact_id_a' => $betterMinnie['id'], + 'contact_id_b' => $organization['id'] + )); $this->assertEquals(1, $relationships['count']); - $emails = $this->callAPISuccess('Email', 'get', array('contact_id' => $betterMinnie['id'], 'sequential' => 1)); + $emails = $this->callAPISuccess('Email', 'get', array( + 'contact_id' => $betterMinnie['id'], + 'sequential' => 1 + )); $this->assertEquals(2, $emails['count']); $this->assertEquals(1, $emails['values'][0]['is_primary']); $this->assertEquals('minnie@mouse_home.org', $emails['values'][0]['email']); @@ -439,17 +574,26 @@ * */ function testImportSucceedIndividualOneMatchNoEmailEmployerMatch() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); $betterMinnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', - 'email' => 'min...@mouse.org', 'employer_id' => $organization['id'], + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', + 'employer_id' => $organization['id'], )); - $importer = new BenevityFile( __DIR__ . "/data/benevity_mice_no_email.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity_mice_no_email.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('All rows were imported', $messages['Result']); @@ -500,12 +644,18 @@ * If there is no employer connection a new contact should be created. */ function testImportSucceedIndividualOneMatchNoEmailNoEmployerMatch() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); $minnie = $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', )); - $importer = new BenevityFile( __DIR__ . "/data/benevity_mice_no_email.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity_mice_no_email.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('All rows were imported', $messages['Result']); @@ -531,7 +681,10 @@ * contribution have also been rolled back. */ function testImportDuplicateFullRollback() { - $organization = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); + $organization = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); // This will clash with the second transaction causing it to fail. $this->callAPISuccess('Contribution', 'create', array( @@ -540,13 +693,16 @@ 'total_amount' => 5, 'contact_id' => $organization['id'], )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('0 out of 4 rows were imported.', $messages['Result']); $contribution = $this->callAPISuccess('Contribution', 'get', array('trxn_id' => 'BENEVITY TRXN-SQUEAK')); $this->assertEquals(0, $contribution['count'], 'This contribution should have been rolled back'); - $minnie = $this->callAPISuccess('Contact', 'get', array('first_name' => 'Minnie', 'last_name' => 'Mouse')); + $minnie = $this->callAPISuccess('Contact', 'get', array( + 'first_name' => 'Minnie', + 'last_name' => 'Mouse' + )); $this->assertEquals(0, $minnie['count'], 'This contact should have been rolled back'); } @@ -557,18 +713,31 @@ * should not be a problem. */ function testImportSucceedOrganizationDisambiguatedBySingleNickName() { - $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Donald Duck Inc', 'contact_type' => 'Organization')); - $theRealDuck = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Donald Duck', 'nick_name' => 'Donald Duck Inc', 'contact_type' => 'Organization')); - $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Donald Duck Inc', 'contact_type' => 'Organization')); + $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Donald Duck Inc', + 'contact_type' => 'Organization' + )); + $theRealDuck = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Donald Duck', + 'nick_name' => 'Donald Duck Inc', + 'contact_type' => 'Organization' + )); + $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Donald Duck Inc', + 'contact_type' => 'Organization' + )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']); $contribution = $this->callAPISuccessGetSingle('Contribution', array('trxn_id' => 'BENEVITY TRXN-QUACK')); $this->assertEquals(200, $contribution['total_amount']); - $address = $this->callAPISuccess('Address', 'get', array('contact_id' => $contribution['contact_id'], 'sequential' => TRUE)); + $address = $this->callAPISuccess('Address', 'get', array( + 'contact_id' => $contribution['contact_id'], + 'sequential' => TRUE + )); $this->assertEquals('2 Quacker Road', $address['values'][0]['street_address']); $this->assertEquals('Duckville', $address['values'][0]['city']); $this->assertEquals(90210, $address['values'][0]['postal_code']); @@ -583,16 +752,32 @@ * Test a successful import run. */ function testImportSucceedAll() { - $mouseOrg = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 'Organization')); - $dogOrg = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Goofy Inc', 'contact_type' => 'Organization')); - $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Donald Duck Inc', 'contact_type' => 'Organization')); - $stingyOrg = $this->callAPISuccess('Contact', 'create', array('organization_name' => 'Uncle Scrooge Inc', 'contact_type' => 'Organization')); - + $mouseOrg = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Mickey Mouse Inc', + 'contact_type' => 'Organization' + )); + $dogOrg = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Goofy Inc', + 'contact_type' => 'Organization' + )); $this->callAPISuccess('Contact', 'create', array( - 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 'Individual', 'email' => 'min...@mouse.org', 'employer_id' => $mouseOrg['id'], + 'organization_name' => 'Donald Duck Inc', + 'contact_type' => 'Organization' + )); + $stingyOrg = $this->callAPISuccess('Contact', 'create', array( + 'organization_name' => 'Uncle Scrooge Inc', + 'contact_type' => 'Organization' )); - $importer = new BenevityFile( __DIR__ . "/data/benevity.csv" ); + $this->callAPISuccess('Contact', 'create', array( + 'first_name' => 'Minnie', + 'last_name' => 'Mouse', + 'contact_type' => 'Individual', + 'email' => 'min...@mouse.org', + 'employer_id' => $mouseOrg['id'], + )); + + $importer = new BenevityFile(__DIR__ . "/data/benevity.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('All rows were imported', $messages['Result']); @@ -607,7 +792,10 @@ $dogContributions = $this->callAPISuccess('Contribution', 'get', array('contact_id' => $dogContact['id'])); $this->assertEquals(1, $dogContributions['count']); $this->assertTrue(empty($dogContributions['values'][$dogContributions['id']]['soft_credit'])); - $dogHouse = $this->callAPISuccess('Address', 'get', array('contact_id' => $dogContact['id'], 'sequential' => 1)); + $dogHouse = $this->callAPISuccess('Address', 'get', array( + 'contact_id' => $dogContact['id'], + 'sequential' => 1 + )); $this->assertEquals(1, $dogHouse['count']); $relationships = $this->callAPISuccess('Relationship', 'get', array('contact_id_a' => $dogContact['id'])); $this->assertEquals(1, $relationships['count']); @@ -629,7 +817,8 @@ // No address should have been created for the organization. $organizationAddress = $this->callAPISuccess('Address', 'get', array( - 'contact_id' => $orgContributions['values'][$orgContributions['id']]['contact_id']) + 'contact_id' => $orgContributions['values'][$orgContributions['id']]['contact_id'] + ) ); $this->assertEquals(0, $organizationAddress['count']); @@ -641,7 +830,10 @@ $relationships = $this->callAPISuccess('Relationship', 'get', array('contact_id_a' => $anonymousContact['id'])); $this->assertEquals(0, $relationships['count']); - $mice = $this->callAPISuccess('Contact', 'get', array('first_name' => 'Minnie', 'last_name' => 'Mouse')); + $mice = $this->callAPISuccess('Contact', 'get', array( + 'first_name' => 'Minnie', + 'last_name' => 'Mouse' + )); $minnie = $mice['values'][$mice['id']]; $this->assertEquals('2 Cheesey Place', $minnie['street_address']); $this->assertEquals('Mickey Mouse Inc', $minnie['current_employer']); diff --git a/sites/all/modules/offline2civicrm/tests/ChecksFileTest.php b/sites/all/modules/offline2civicrm/tests/ChecksFileTest.php index 460c6a8..95ba935 100644 --- a/sites/all/modules/offline2civicrm/tests/ChecksFileTest.php +++ b/sites/all/modules/offline2civicrm/tests/ChecksFileTest.php @@ -5,63 +5,63 @@ * @group Offline2Civicrm */ class ChecksFileTest extends BaseChecksFileTest { - function setUp() { - parent::setUp(); + function setUp() { + parent::setUp(); - require_once __DIR__ . "/includes/ChecksFileProbe.php"; - } + require_once __DIR__ . "/includes/ChecksFileProbe.php"; + } - /** - * @expectedException EmptyRowException - */ - function testEmptyRow() { - // A few kinds of empty. - $data = array( - 'Orignal Currency' => '', - '' => '700', - '' => '', - ); + /** + * @expectedException EmptyRowException + */ + function testEmptyRow() { + // A few kinds of empty. + $data = array( + 'Orignal Currency' => '', + '' => '700', + '' => '', + ); - $importer = new ChecksFileProbe( "no URI" ); - $output = $importer->_parseRow( $data ); - } + $importer = new ChecksFileProbe("no URI"); + $output = $importer->_parseRow($data); + } - /** - * Populate contribution_tracking.country - */ - function testImportCountry() { - // A few kinds of empty. - $data = array( - 'Check Number' => mt_rand(), - 'City' => 'blah city', - 'Country' => 'AR', - 'Email' => 'em...@phony.com', - 'External Batch Number' => mt_rand(), - 'First Name' => 'Test_first_name', - 'Gift Source' => 'Community GIft', - 'Last Name' => 'Test_last_name', - 'Original Amount' => '123', - 'Original Currency' => 'USD', - 'Payment Instrument' => 'Trilogy', - 'Postal Code' => '90210', - 'Postmark Date' => '2012-02-02', - 'Received Date' => '2017-07-07', - 'State' => 'CA', - 'Street Address' => '123 Sunset Boulevard', - 'Transaction ID' => mt_rand(), - ); + /** + * Populate contribution_tracking.country + */ + function testImportCountry() { + // A few kinds of empty. + $data = array( + 'Check Number' => mt_rand(), + 'City' => 'blah city', + 'Country' => 'AR', + 'Email' => 'em...@phony.com', + 'External Batch Number' => mt_rand(), + 'First Name' => 'Test_first_name', + 'Gift Source' => 'Community GIft', + 'Last Name' => 'Test_last_name', + 'Original Amount' => '123', + 'Original Currency' => 'USD', + 'Payment Instrument' => 'Trilogy', + 'Postal Code' => '90210', + 'Postmark Date' => '2012-02-02', + 'Received Date' => '2017-07-07', + 'State' => 'CA', + 'Street Address' => '123 Sunset Boulevard', + 'Transaction ID' => mt_rand(), + ); - $importer = new ChecksFileProbe( "no URI" ); - $message = $importer->_parseRow( $data ); - $importer->doImport( $message ); - $contribution = $this->callAPISuccessGetSingle( - 'Contribution', array( 'trxn_id' => "GENERIC_IMPORT {$data['Transaction ID']}" ) - ); - $ct = db_select( 'contribution_tracking', 'contribution_tracking' ) - ->fields( 'contribution_tracking' ) - ->condition( 'contribution_id', $contribution['id'] ) - ->execute() - ->fetchAssoc(); - $this->assertEquals( 'AR', $ct['country'] ); - } + $importer = new ChecksFileProbe("no URI"); + $message = $importer->_parseRow($data); + $importer->doImport($message); + $contribution = $this->callAPISuccessGetSingle( + 'Contribution', array('trxn_id' => "GENERIC_IMPORT {$data['Transaction ID']}") + ); + $ct = db_select('contribution_tracking', 'contribution_tracking') + ->fields('contribution_tracking') + ->condition('contribution_id', $contribution['id']) + ->execute() + ->fetchAssoc(); + $this->assertEquals('AR', $ct['country']); + } } diff --git a/sites/all/modules/offline2civicrm/tests/CoinBaseTest.php b/sites/all/modules/offline2civicrm/tests/CoinBaseTest.php index e7f9f78..1977270 100644 --- a/sites/all/modules/offline2civicrm/tests/CoinBaseTest.php +++ b/sites/all/modules/offline2civicrm/tests/CoinBaseTest.php @@ -5,28 +5,28 @@ * @group Offline2Civicrm */ class CoinBaseTest extends BaseChecksFileTest { - protected $epochtime; + protected $epochtime; - function setUp() { - parent::setUp(); + function setUp() { + parent::setUp(); - $this->epochtime = wmf_common_date_parse_string('2016-09-15'); - $this->setExchangeRates($this->epochtime, array('USD' => 1, 'BTC' => 3)); - $this->gateway = 'coinbase'; - } + $this->epochtime = wmf_common_date_parse_string('2016-09-15'); + $this->setExchangeRates($this->epochtime, array('USD' => 1, 'BTC' => 3)); + $this->gateway = 'coinbase'; + } - function testImport() { - civicrm_initialize(); - $this->trxn_id = 'Pluto'; - $this->doCleanUp(); + function testImport() { + civicrm_initialize(); + $this->trxn_id = 'Pluto'; + $this->doCleanUp(); - $importer = new CoinbaseFile( __DIR__ . "/data/coinbase.csv" ); - $importer->import(); + $importer = new CoinbaseFile(__DIR__ . "/data/coinbase.csv"); + $importer->import(); - $contribution = wmf_civicrm_get_contributions_from_gateway_id($this->gateway, $this->trxn_id); - $this->assertEquals(1, count($contribution)); - $this->assertEquals('COINBASE PLUTO', $contribution[0]['trxn_id']); - $this->assertEquals('online', db_query("SELECT {utm_medium} from {contribution_tracking} WHERE contribution_id = {$contribution[0]['id']}")->fetchField()); - } + $contribution = wmf_civicrm_get_contributions_from_gateway_id($this->gateway, $this->trxn_id); + $this->assertEquals(1, count($contribution)); + $this->assertEquals('COINBASE PLUTO', $contribution[0]['trxn_id']); + $this->assertEquals('online', db_query("SELECT {utm_medium} from {contribution_tracking} WHERE contribution_id = {$contribution[0]['id']}")->fetchField()); + } } diff --git a/sites/all/modules/offline2civicrm/tests/ContributionConversionTest.php b/sites/all/modules/offline2civicrm/tests/ContributionConversionTest.php index d6a91a0..4b06c09 100644 --- a/sites/all/modules/offline2civicrm/tests/ContributionConversionTest.php +++ b/sites/all/modules/offline2civicrm/tests/ContributionConversionTest.php @@ -2,61 +2,61 @@ class ContributionConversionTest extends BaseChecksFileTest { - public function setUp() { - parent::setUp(); - civicrm_initialize(); - // I'm slightly confused why this is required. phpunit is blowing away GLOBALS, - // including the one holding the DB connection but civicrm_initialize is not - // calling this on the second run due to the static being set. - // The reason this is confusing is logically, but not in practice, - // this test should be no more affected than other tests. - CRM_Core_Config::singleton(TRUE, TRUE); + public function setUp() { + parent::setUp(); + civicrm_initialize(); + // I'm slightly confused why this is required. phpunit is blowing away GLOBALS, + // including the one holding the DB connection but civicrm_initialize is not + // calling this on the second run due to the static being set. + // The reason this is confusing is logically, but not in practice, + // this test should be no more affected than other tests. + CRM_Core_Config::singleton(TRUE, TRUE); - $result = $this->callAPISuccess('Contact', 'create', array( - 'contact_type' => 'Individual', - 'email' => 'f...@example.com', - )); - $this->contact_id = $result['id']; + $result = $this->callAPISuccess('Contact', 'create', array( + 'contact_type' => 'Individual', + 'email' => 'f...@example.com', + )); + $this->contact_id = $result['id']; - $this->gateway_txn_id = "NaN-" . mt_rand(); - $this->transaction = WmfTransaction::from_unique_id( "GLOBALCOLLECT {$this->gateway_txn_id}" ); + $this->gateway_txn_id = "NaN-" . mt_rand(); + $this->transaction = WmfTransaction::from_unique_id("GLOBALCOLLECT {$this->gateway_txn_id}"); - $contributionResult = $this->callAPISuccess('Contribution', 'create', array( - 'contact_id' => $this->contact_id, - 'trxn_id' => $this->transaction->get_unique_id(), - 'contribution_type' => 'Cash', - 'total_amount' => '20.01', - 'receive_date' => wmf_common_date_unix_to_sql( time() ), - )); - $this->contribution_id = $contributionResult['id']; + $contributionResult = $this->callAPISuccess('Contribution', 'create', array( + 'contact_id' => $this->contact_id, + 'trxn_id' => $this->transaction->get_unique_id(), + 'contribution_type' => 'Cash', + 'total_amount' => '20.01', + 'receive_date' => wmf_common_date_unix_to_sql(time()), + )); + $this->contribution_id = $contributionResult['id']; - wmf_civicrm_set_custom_field_values($this->contribution_id, array( - 'original_amount' => '20.01', - 'original_currency' => 'USD', - )); - } + wmf_civicrm_set_custom_field_values($this->contribution_id, array( + 'original_amount' => '20.01', + 'original_currency' => 'USD', + )); + } - public function tearDown() { - parent::tearDown(); - $this->callAPISuccess('Contribution', 'delete', array('id' => $this->contribution_id)); - $this->callAPISuccess('Contact', 'delete', array('id' => $this->contact_id)); - } + public function tearDown() { + parent::tearDown(); + $this->callAPISuccess('Contribution', 'delete', array('id' => $this->contribution_id)); + $this->callAPISuccess('Contact', 'delete', array('id' => $this->contact_id)); + } - public function testMakeRecurring() { - ContributionConversion::makeRecurring( $this->transaction ); + public function testMakeRecurring() { + ContributionConversion::makeRecurring($this->transaction); - $contributions = wmf_civicrm_get_contributions_from_gateway_id( $this->transaction->gateway, $this->transaction->gateway_txn_id ); - $this->assertNotNull( $contributions[0]['contribution_recur_id'], - "Became a recurring contribution" ); - } + $contributions = wmf_civicrm_get_contributions_from_gateway_id($this->transaction->gateway, $this->transaction->gateway_txn_id); + $this->assertNotNull($contributions[0]['contribution_recur_id'], + "Became a recurring contribution"); + } - public function testMakeRecurringCancelled() { - ContributionConversion::makeRecurring( $this->transaction, true ); + public function testMakeRecurringCancelled() { + ContributionConversion::makeRecurring($this->transaction, TRUE); - $contributions = wmf_civicrm_get_contributions_from_gateway_id( $this->transaction->gateway, $this->transaction->gateway_txn_id ); + $contributions = wmf_civicrm_get_contributions_from_gateway_id($this->transaction->gateway, $this->transaction->gateway_txn_id); - $contribution_recur = $this->callAPISuccessGetSingle('ContributionRecur', array('id' => $contributions[0]['contribution_recur_id'])); - $this->assertNotNull( $contribution_recur['cancel_date'], - "Marked as cancelled" ); - } + $contribution_recur = $this->callAPISuccessGetSingle('ContributionRecur', array('id' => $contributions[0]['contribution_recur_id'])); + $this->assertNotNull($contribution_recur['cancel_date'], + "Marked as cancelled"); + } } diff --git a/sites/all/modules/offline2civicrm/tests/EngageChecksFileTest.php b/sites/all/modules/offline2civicrm/tests/EngageChecksFileTest.php index d5287ad..6e3386b 100644 --- a/sites/all/modules/offline2civicrm/tests/EngageChecksFileTest.php +++ b/sites/all/modules/offline2civicrm/tests/EngageChecksFileTest.php @@ -6,135 +6,136 @@ */ class EngageChecksFileTest extends BaseChecksFileTest { - protected $sourceFileUri = ''; - function setUp() { - parent::setUp(); + protected $sourceFileUri = ''; - require_once __DIR__ . "/includes/EngageChecksFileProbe.php"; - } + function setUp() { + parent::setUp(); - function testParseRow_Individual() { - $data = array( - 'Batch' => '1234', - 'Contribution Type' => 'Engage', - 'Total Amount' => '50', - 'Source' => 'USD 50.00', - 'Postmark Date' => '', - 'Received Date' => '4/1/14', - 'Payment Instrument' => 'Check', - 'Check Number' => '2020', - 'Restrictions' => 'Unrestricted - General', - 'Gift Source' => 'Community Gift', - 'Direct Mail Appeal' => 'White Mail', - 'Prefix' => 'Mrs.', - 'First Name' => 'Sub', - 'Last Name' => 'Tell', - 'Suffix' => '', - 'Street Address' => '1000 Markdown Markov', - 'Additional Address 1' => '', - 'Additional Address 2' => '', - 'City' => 'Best St. Louis', - 'State' => 'MA', - 'Postal Code' => '2468', - 'Country' => '', - 'Phone' => '(123) 456-0000', - 'Email' => '', - 'Thank You Letter Date' => '5/1/14', - 'AC Flag' => 'Y', - ); - $expected_normal = array( - 'check_number' => '2020', - 'city' => 'Best St. Louis', - 'contact_source' => 'check', - 'contact_type' => 'Individual', - 'contribution_source' => 'USD 50.00', - 'contribution_type' => 'engage', - 'country' => 'US', - 'currency' => 'USD', - 'date' => 1396310400, - 'direct_mail_appeal' => 'White Mail', - 'first_name' => 'Sub', - 'gateway' => 'engage', - 'gateway_txn_id' => 'e59ed825ea04516fb2abf1c130d47525', - 'gift_source' => 'Community Gift', - 'gross' => '50', - 'import_batch_number' => '1234', - 'last_name' => 'Tell', - 'name_prefix' => 'Mrs.', - 'payment_method' => 'Check', - 'postal_code' => '02468', - 'raw_contribution_type' => 'Engage', - 'restrictions' => 'Unrestricted - General', - 'state_province' => 'MA', - 'street_address' => '1000 Markdown Markov', - 'thankyou_date' => 1398902400, - ); + require_once __DIR__ . "/includes/EngageChecksFileProbe.php"; + } - $importer = new EngageChecksFileProbe( "null URI" ); - $output = $importer->_parseRow( $data ); + function testParseRow_Individual() { + $data = array( + 'Batch' => '1234', + 'Contribution Type' => 'Engage', + 'Total Amount' => '50', + 'Source' => 'USD 50.00', + 'Postmark Date' => '', + 'Received Date' => '4/1/14', + 'Payment Instrument' => 'Check', + 'Check Number' => '2020', + 'Restrictions' => 'Unrestricted - General', + 'Gift Source' => 'Community Gift', + 'Direct Mail Appeal' => 'White Mail', + 'Prefix' => 'Mrs.', + 'First Name' => 'Sub', + 'Last Name' => 'Tell', + 'Suffix' => '', + 'Street Address' => '1000 Markdown Markov', + 'Additional Address 1' => '', + 'Additional Address 2' => '', + 'City' => 'Best St. Louis', + 'State' => 'MA', + 'Postal Code' => '2468', + 'Country' => '', + 'Phone' => '(123) 456-0000', + 'Email' => '', + 'Thank You Letter Date' => '5/1/14', + 'AC Flag' => 'Y', + ); + $expected_normal = array( + 'check_number' => '2020', + 'city' => 'Best St. Louis', + 'contact_source' => 'check', + 'contact_type' => 'Individual', + 'contribution_source' => 'USD 50.00', + 'contribution_type' => 'engage', + 'country' => 'US', + 'currency' => 'USD', + 'date' => 1396310400, + 'direct_mail_appeal' => 'White Mail', + 'first_name' => 'Sub', + 'gateway' => 'engage', + 'gateway_txn_id' => 'e59ed825ea04516fb2abf1c130d47525', + 'gift_source' => 'Community Gift', + 'gross' => '50', + 'import_batch_number' => '1234', + 'last_name' => 'Tell', + 'name_prefix' => 'Mrs.', + 'payment_method' => 'Check', + 'postal_code' => '02468', + 'raw_contribution_type' => 'Engage', + 'restrictions' => 'Unrestricted - General', + 'state_province' => 'MA', + 'street_address' => '1000 Markdown Markov', + 'thankyou_date' => 1398902400, + ); - $this->stripSourceData( $output ); - $this->assertEquals( $expected_normal, $output ); - } + $importer = new EngageChecksFileProbe("null URI"); + $output = $importer->_parseRow($data); - function testParseRow_Organization() { - $data = array( - 'Batch' => '1235', - 'Contribution Type' => 'Engage', - 'Total Amount' => '51.23', - 'Source' => 'USD 51.23', - 'Postmark Date' => '', - 'Received Date' => '4/1/14', - 'Payment Instrument' => 'Check', - 'Check Number' => '202000001', - 'Restrictions' => 'Restricted-Foundation', - 'Gift Source' => 'Foundation Gift', - 'Direct Mail Appeal' => 'White Mail', - 'Organization Name' => 'One Pacific Entitlement', - 'Street Address' => '1000 Markdown Markov', - 'Additional Address 1' => '', - 'Additional Address 2' => '', - 'City' => 'Best St. Louis', - 'State' => 'MA', - 'Postal Code' => '123-LAX', - 'Country' => 'FR', - 'Phone' => '+357 (123) 456-0000', - 'Email' => '', - 'Thank You Letter Date' => '5/1/14', - 'AC Flag' => '', - ); - $expected_normal = array( - 'check_number' => '202000001', - 'city' => 'Best St. Louis', - 'contact_source' => 'check', - 'contact_type' => 'Organization', - 'contribution_source' => 'USD 51.23', - 'contribution_type' => 'engage', - 'country' => 'FR', - 'currency' => 'USD', - 'date' => 1396310400, - 'direct_mail_appeal' => 'White Mail', - 'gateway' => 'engage', - 'gateway_txn_id' => '6dbb8d844c7509076e2a275fb76d0130', - 'gift_source' => 'Foundation Gift', - 'gross' => 51.23, - 'import_batch_number' => '1235', - 'organization_name' => 'One Pacific Entitlement', - 'payment_method' => 'Check', - 'postal_code' => '123-LAX', - 'raw_contribution_type' => 'Engage', - 'restrictions' => 'Restricted-Foundation', - 'state_province' => 'MA', - 'street_address' => '1000 Markdown Markov', - 'thankyou_date' => 1398902400, - ); + $this->stripSourceData($output); + $this->assertEquals($expected_normal, $output); + } - $importer = new EngageChecksFileProbe( "null URI" ); - $output = $importer->_parseRow( $data ); + function testParseRow_Organization() { + $data = array( + 'Batch' => '1235', + 'Contribution Type' => 'Engage', + 'Total Amount' => '51.23', + 'Source' => 'USD 51.23', + 'Postmark Date' => '', + 'Received Date' => '4/1/14', + 'Payment Instrument' => 'Check', + 'Check Number' => '202000001', + 'Restrictions' => 'Restricted-Foundation', + 'Gift Source' => 'Foundation Gift', + 'Direct Mail Appeal' => 'White Mail', + 'Organization Name' => 'One Pacific Entitlement', + 'Street Address' => '1000 Markdown Markov', + 'Additional Address 1' => '', + 'Additional Address 2' => '', + 'City' => 'Best St. Louis', + 'State' => 'MA', + 'Postal Code' => '123-LAX', + 'Country' => 'FR', + 'Phone' => '+357 (123) 456-0000', + 'Email' => '', + 'Thank You Letter Date' => '5/1/14', + 'AC Flag' => '', + ); + $expected_normal = array( + 'check_number' => '202000001', + 'city' => 'Best St. Louis', + 'contact_source' => 'check', + 'contact_type' => 'Organization', + 'contribution_source' => 'USD 51.23', + 'contribution_type' => 'engage', + 'country' => 'FR', + 'currency' => 'USD', + 'date' => 1396310400, + 'direct_mail_appeal' => 'White Mail', + 'gateway' => 'engage', + 'gateway_txn_id' => '6dbb8d844c7509076e2a275fb76d0130', + 'gift_source' => 'Foundation Gift', + 'gross' => 51.23, + 'import_batch_number' => '1235', + 'organization_name' => 'One Pacific Entitlement', + 'payment_method' => 'Check', + 'postal_code' => '123-LAX', + 'raw_contribution_type' => 'Engage', + 'restrictions' => 'Restricted-Foundation', + 'state_province' => 'MA', + 'street_address' => '1000 Markdown Markov', + 'thankyou_date' => 1398902400, + ); - $this->stripSourceData( $output ); - $this->assertEquals( $expected_normal, $output ); - } + $importer = new EngageChecksFileProbe("null URI"); + $output = $importer->_parseRow($data); + + $this->stripSourceData($output); + $this->assertEquals($expected_normal, $output); + } public function testImporterFormatsPostal() { civicrm_initialize(); @@ -142,7 +143,10 @@ $importer = new EngageChecksFile($fileUri); $importer->import(); - $contact = $this->callAPISuccess('Contact', 'get', array('email' => 'rsimps...@unblog.fr', 'sequential' => 1)); + $contact = $this->callAPISuccess('Contact', 'get', array( + 'email' => 'rsimps...@unblog.fr', + 'sequential' => 1 + )); $this->assertEquals('07065', $contact['values'][0]['postal_code']); $this->assertEquals(5, strlen($contact['values'][0]['postal_code'])); } @@ -159,57 +163,56 @@ try { $importer = new EngageChecksFile($fileUri); $importer->import(); - } - catch (Exception $e) { + } catch (Exception $e) { $this->assertTrue(strpos($e->getMessage(), 'Import aborted due to 10 consecutive errors, last error was at row 12: \'Invalid Name\'') === 0, 'Actual error was ' . $e->getMessage()); return; } $this->fail('An exception should have been thrown'); } - public function testImporterCreatesOutputFiles() { - civicrm_initialize(); - $this->sourceFileUri = __DIR__ . '/../tests/data/engage_reduced.csv'; - $fileUri = $this->setupFile('engage_reduced.csv'); + public function testImporterCreatesOutputFiles() { + civicrm_initialize(); + $this->sourceFileUri = __DIR__ . '/../tests/data/engage_reduced.csv'; + $fileUri = $this->setupFile('engage_reduced.csv'); - $importer = new EngageChecksFile($fileUri); - $messages = $importer->import(); - global $user; - $this->assertEquals( - array ( - 0 => 'Successful import!', - 'Result' => '14 out of 18 rows were imported.', - 'not imported' => '4 not imported rows logged to <a href=\'/import_output/' . substr(str_replace('.csv', '_all_missed.' . $user->uid, $fileUri), 12) ."'> file</a>.", - 'Duplicate' => '1 Duplicate row logged to <a href=\'/import_output/' . substr(str_replace('.csv', '_skipped.' . $user->uid, $fileUri), 12) ."'> file</a>.", - 'Error' => '3 Error rows logged to <a href=\'/import_output/'. substr(str_replace('.csv', '_errors.' . $user->uid, $fileUri), 12) ."'> file</a>.", - ) - , $messages); + $importer = new EngageChecksFile($fileUri); + $messages = $importer->import(); + global $user; + $this->assertEquals( + array( + 0 => 'Successful import!', + 'Result' => '14 out of 18 rows were imported.', + 'not imported' => '4 not imported rows logged to <a href=\'/import_output/' . substr(str_replace('.csv', '_all_missed.' . $user->uid, $fileUri), 12) . "'> file</a>.", + 'Duplicate' => '1 Duplicate row logged to <a href=\'/import_output/' . substr(str_replace('.csv', '_skipped.' . $user->uid, $fileUri), 12) . "'> file</a>.", + 'Error' => '3 Error rows logged to <a href=\'/import_output/' . substr(str_replace('.csv', '_errors.' . $user->uid, $fileUri), 12) . "'> file</a>.", + ) + , $messages); - $errorsURI = str_replace('.csv', '_errors.' . $user->uid . '.csv', $fileUri); - $this->assertTrue(file_exists($errorsURI)); - $errors = file($errorsURI); + $errorsURI = str_replace('.csv', '_errors.' . $user->uid . '.csv', $fileUri); + $this->assertTrue(file_exists($errorsURI)); + $errors = file($errorsURI); - // Header row - $this->assertEquals('Error,Banner,Campaign,Medium,Batch,"Contribution Type","Total Amount",Source,"Postmark Date","Received Date","Payment Instrument","Check Number",Restrictions,"Gift Source","Direct Mail Appeal","Organization Name","Street Address",City,Country,"Postal Code",Email,State,"Thank You Letter Date","AC Flag",Notes,"Do Not Email","Do Not Phone","Do Not Mail","Do Not SMS","Is Opt Out"', trim($errors[0])); - unset($errors[0]); + // Header row + $this->assertEquals('Error,Banner,Campaign,Medium,Batch,"Contribution Type","Total Amount",Source,"Postmark Date","Received Date","Payment Instrument","Check Number",Restrictions,"Gift Source","Direct Mail Appeal","Organization Name","Street Address",City,Country,"Postal Code",Email,State,"Thank You Letter Date","AC Flag",Notes,"Do Not Email","Do Not Phone","Do Not Mail","Do Not SMS","Is Opt Out"', trim($errors[0])); + unset($errors[0]); - $this->assertEquals(3, count($errors)); - $this->assertEquals('"\'Unrstricted - General\' is not a valid option for field ' . wmf_civicrm_get_custom_field_name('Fund') . '",B15_0601_enlvroskLVROSK_dsk_lg_nag_sd.no-LP.cc,C15_mlWW_mob_lw_FR,sitenotice,10563,Engage,24,"USD 24.00",5/9/2015,5/9/2015,Cash,1,"Unrstricted - General","Corporate Gift","Carl TEST Perry",Roombo,"53 International Circle",Nowe,Poland,,cper...@salon.com,,12/21/2014,,,,,,, + $this->assertEquals(3, count($errors)); + $this->assertEquals('"\'Unrstricted - General\' is not a valid option for field ' . wmf_civicrm_get_custom_field_name('Fund') . '",B15_0601_enlvroskLVROSK_dsk_lg_nag_sd.no-LP.cc,C15_mlWW_mob_lw_FR,sitenotice,10563,Engage,24,"USD 24.00",5/9/2015,5/9/2015,Cash,1,"Unrstricted - General","Corporate Gift","Carl TEST Perry",Roombo,"53 International Circle",Nowe,Poland,,cper...@salon.com,,12/21/2014,,,,,,, ', $errors[1]); - $skippedURI = str_replace('.csv', '_skipped.' . $user->uid . '.csv', $fileUri); - $this->assertTrue(file_exists($skippedURI)); - $skipped = file($skippedURI); - // 1 + 1 header row - $this->assertEquals(2, count($skipped)); + $skippedURI = str_replace('.csv', '_skipped.' . $user->uid . '.csv', $fileUri); + $this->assertTrue(file_exists($skippedURI)); + $skipped = file($skippedURI); + // 1 + 1 header row + $this->assertEquals(2, count($skipped)); - $allURI = str_replace('.csv', '_all_missed.' . $user->uid . '.csv', $fileUri); - $this->assertTrue(file_exists($allURI)); - $all = file($allURI); - // 1 header row, 1 skipped, 3 errors. - $this->assertEquals(5, count($all)); + $allURI = str_replace('.csv', '_all_missed.' . $user->uid . '.csv', $fileUri); + $this->assertTrue(file_exists($allURI)); + $all = file($allURI); + // 1 header row, 1 skipped, 3 errors. + $this->assertEquals(5, count($all)); - } + } /** * Clean up transactions from previous test runs. @@ -226,39 +229,39 @@ CRM_Core_DAO::executeQuery('DELETE FROM civicrm_contact WHERE organization_name = "Jaloo"'); } - /** - * Get the gateway IDS from the source file. - */ - public function getGatewayIDs() { - $gatewayIDs = array(); - $data = $this->getParsedData(); - foreach ($data as $record) { - $gatewayIDs[] = $record['gateway_txn_id']; - } - return $gatewayIDs; + /** + * Get the gateway IDS from the source file. + */ + public function getGatewayIDs() { + $gatewayIDs = array(); + $data = $this->getParsedData(); + foreach ($data as $record) { + $gatewayIDs[] = $record['gateway_txn_id']; } + return $gatewayIDs; + } - /** - * Get parsed data from the source file. - * - * @return array - */ - public function getParsedData() { - $file = fopen($this->sourceFileUri, 'r'); - $result = array(); - $importer = new EngageChecksFileProbe( "null URI" ); - while(($row = fgetcsv( $file, 0, ',', '"', '\\')) !== FALSE) { - if ($row[0] == 'Banner') { - // Header row. - $headers = _load_headers($row); - continue; - } - $data = array_combine(array_keys($headers), array_slice($row, 0, count($headers))); - $result[] = $importer->_parseRow($data); - + /** + * Get parsed data from the source file. + * + * @return array + */ + public function getParsedData() { + $file = fopen($this->sourceFileUri, 'r'); + $result = array(); + $importer = new EngageChecksFileProbe("null URI"); + while (($row = fgetcsv($file, 0, ',', '"', '\\')) !== FALSE) { + if ($row[0] == 'Banner') { + // Header row. + $headers = _load_headers($row); + continue; } - return $result; + $data = array_combine(array_keys($headers), array_slice($row, 0, count($headers))); + $result[] = $importer->_parseRow($data); + } + return $result; + } /** * Set up the file for import. diff --git a/sites/all/modules/offline2civicrm/tests/ForeignChecksFileTest.php b/sites/all/modules/offline2civicrm/tests/ForeignChecksFileTest.php index 566b9fc..f65745c 100644 --- a/sites/all/modules/offline2civicrm/tests/ForeignChecksFileTest.php +++ b/sites/all/modules/offline2civicrm/tests/ForeignChecksFileTest.php @@ -7,72 +7,72 @@ * @group Offline2Civicrm */ class ForeignChecksFileTest extends BaseChecksFileTest { - function setUp() { - parent::setUp(); - civicrm_initialize(); - $this->epochtime = wmf_common_date_parse_string('2017-02-28'); - $this->setExchangeRates($this->epochtime, array('USD' => 1, 'GBP' => 2)); + function setUp() { + parent::setUp(); + civicrm_initialize(); + $this->epochtime = wmf_common_date_parse_string('2017-02-28'); + $this->setExchangeRates($this->epochtime, array('USD' => 1, 'GBP' => 2)); - require_once __DIR__ . "/includes/ForeignChecksFileProbe.php"; - } + require_once __DIR__ . "/includes/ForeignChecksFileProbe.php"; + } - function testParseRow() { - $data = array( - 'Batch Number' => '1234', - 'Original Amount' => '50.00', - 'Original Currency' => 'GBP', - 'Received Date' => '4/1/14', - 'Payment Instrument' => 'Check', - 'Check Number' => '2020', - 'First Name' => 'Gen', - 'Last Name' => 'Russ', - 'Street Address' => '1000 Markdown Markov', - 'Additional Address' => '', - 'City' => 'Chocolate City', - 'State' => 'ND', - 'Postal Code' => '13131', - 'Country' => 'Nonexistent Rock Candy Country', - 'Email' => '', - 'Phone' => '', - 'Thank You Letter Date' => '', - 'No Thank You' => '', - 'Direct Mail Appeal' => '', - 'AC Flag' => '', - 'Restrictions' => '', - 'Gift Source' => '', - 'Notes' => '', - ); - $expected_normal = array( - 'check_number' => '2020', - 'city' => 'Chocolate City', - 'country' => 'Nonexistent Rock Candy Country', - 'first_name' => 'Gen', - 'last_name' => 'Russ', - 'gateway' => 'check', - 'gross' => '50.00', - 'currency' => 'GBP', - 'payment_method' => 'Check', - 'postal_code' => '13131', - 'date' => 1396310400, - 'state_province' => 'ND', - 'street_address' => '1000 Markdown Markov', - 'contact_source' => 'check', - 'contact_type' => 'Individual', - 'gateway_txn_id' => '3333f8fd5703c6a319c4a9d2b5a2d8c6', - ); + function testParseRow() { + $data = array( + 'Batch Number' => '1234', + 'Original Amount' => '50.00', + 'Original Currency' => 'GBP', + 'Received Date' => '4/1/14', + 'Payment Instrument' => 'Check', + 'Check Number' => '2020', + 'First Name' => 'Gen', + 'Last Name' => 'Russ', + 'Street Address' => '1000 Markdown Markov', + 'Additional Address' => '', + 'City' => 'Chocolate City', + 'State' => 'ND', + 'Postal Code' => '13131', + 'Country' => 'Nonexistent Rock Candy Country', + 'Email' => '', + 'Phone' => '', + 'Thank You Letter Date' => '', + 'No Thank You' => '', + 'Direct Mail Appeal' => '', + 'AC Flag' => '', + 'Restrictions' => '', + 'Gift Source' => '', + 'Notes' => '', + ); + $expected_normal = array( + 'check_number' => '2020', + 'city' => 'Chocolate City', + 'country' => 'Nonexistent Rock Candy Country', + 'first_name' => 'Gen', + 'last_name' => 'Russ', + 'gateway' => 'check', + 'gross' => '50.00', + 'currency' => 'GBP', + 'payment_method' => 'Check', + 'postal_code' => '13131', + 'date' => 1396310400, + 'state_province' => 'ND', + 'street_address' => '1000 Markdown Markov', + 'contact_source' => 'check', + 'contact_type' => 'Individual', + 'gateway_txn_id' => '3333f8fd5703c6a319c4a9d2b5a2d8c6', + ); - $importer = new ForeignChecksFileProbe( "null URI" ); - $output = $importer->_parseRow( $data ); + $importer = new ForeignChecksFileProbe("null URI"); + $output = $importer->_parseRow($data); - $this->stripSourceData( $output ); - $this->assertEquals( $expected_normal, $output ); - } + $this->stripSourceData($output); + $this->assertEquals($expected_normal, $output); + } /** * Test that all imports fail if the organization does not pre-exist. */ function testImportForeignCheckes() { - $importer = new ForeignChecksFile( __DIR__ . "/data/foreign_checks_trilogy.csv" ); + $importer = new ForeignChecksFile(__DIR__ . "/data/foreign_checks_trilogy.csv"); $importer->import(); $messages = $importer->getMessages(); $this->assertEquals('All rows were imported', $messages['Result']); diff --git a/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php b/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php index c949e77..ff31e4b 100644 --- a/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php +++ b/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php @@ -5,86 +5,89 @@ * @group Offline2Civicrm */ class JpMorganFileTest extends BaseChecksFileTest { - protected $epochtime; - protected $strtime; + protected $epochtime; + protected $strtime; - function setUp() { - parent::setUp(); + function setUp() { + parent::setUp(); - require_once __DIR__ . "/includes/JpMorganFileProbe.php"; + require_once __DIR__ . "/includes/JpMorganFileProbe.php"; - $this->strtime = '04/02/2000'; - $this->epochtime = wmf_common_date_parse_string('2000-04-02'); - $this->setExchangeRates( $this->epochtime, array( 'USD' => 1, 'EUR' => 3 ) ); - $this->gateway = 'jpmorgan'; - } + $this->strtime = '04/02/2000'; + $this->epochtime = wmf_common_date_parse_string('2000-04-02'); + $this->setExchangeRates($this->epochtime, array('USD' => 1, 'EUR' => 3)); + $this->gateway = 'jpmorgan'; + } - function testParseRow() { - $data = array( - 'Account Name' => 'Testes EUR_Public', - 'Currency' => 'EUR', - 'Customer Reference' => 'UNAVAILABLE', - 'Bank Reference' => '1234TEST', - 'Transaction Date' => '04/01/2000', - 'Description' => 'FOO CREDIT RECEIVED', - 'Value Date' => $this->strtime, - 'Credit Amount' => '5.50', - ); - $expected_normal = array( - 'contact_source' => 'check', - 'contact_type' => 'Individual', - 'country' => 'US', - 'currency' => 'EUR', - 'date' => 954547200, - 'direct_mail_appeal' => 'White Mail', - 'email' => 'nob...@wikimedia.org', - 'gateway_account' => 'Testes EUR_Public', - 'gateway' => 'jpmorgan', - 'gateway_txn_id' => '1234TEST', - 'gift_source' => 'Community Gift', - 'gross' => '5.50', - 'no_thank_you' => 'No Contact Details', - 'payment_instrument' => 'JP Morgan EUR', - 'restrictions' => 'Unrestricted - General', - 'settlement_date' => $this->epochtime, - ); + function testParseRow() { + $data = array( + 'Account Name' => 'Testes EUR_Public', + 'Currency' => 'EUR', + 'Customer Reference' => 'UNAVAILABLE', + 'Bank Reference' => '1234TEST', + 'Transaction Date' => '04/01/2000', + 'Description' => 'FOO CREDIT RECEIVED', + 'Value Date' => $this->strtime, + 'Credit Amount' => '5.50', + ); + $expected_normal = array( + 'contact_source' => 'check', + 'contact_type' => 'Individual', + 'country' => 'US', + 'currency' => 'EUR', + 'date' => 954547200, + 'direct_mail_appeal' => 'White Mail', + 'email' => 'nob...@wikimedia.org', + 'gateway_account' => 'Testes EUR_Public', + 'gateway' => 'jpmorgan', + 'gateway_txn_id' => '1234TEST', + 'gift_source' => 'Community Gift', + 'gross' => '5.50', + 'no_thank_you' => 'No Contact Details', + 'payment_instrument' => 'JP Morgan EUR', + 'restrictions' => 'Unrestricted - General', + 'settlement_date' => $this->epochtime, + ); - $importer = new JpMorganFileProbe( "no URI" ); - $output = $importer->_parseRow( $data ); + $importer = new JpMorganFileProbe("no URI"); + $output = $importer->_parseRow($data); - $this->stripSourceData( $output ); - $this->assertEquals( $expected_normal, $output ); - } + $this->stripSourceData($output); + $this->assertEquals($expected_normal, $output); + } - function testImport() { - //FIXME - $_GET['q'] = ''; - civicrm_initialize(); - $this->trxn_id = '1234TEST'; - $this->doCleanUp(); + function testImport() { + //FIXME + $_GET['q'] = ''; + civicrm_initialize(); + $this->trxn_id = '1234TEST'; + $this->doCleanUp(); - $this->setExchangeRates( wmf_common_date_parse_string( '2000-04-01' ), array( 'USD' => 1, 'EUR' => 3 ) ); + $this->setExchangeRates(wmf_common_date_parse_string('2000-04-01'), array( + 'USD' => 1, + 'EUR' => 3 + )); - $importer = new JpMorganFileProbe( __DIR__ . "/data/jpmorgan.csv" ); - $importer->import(); + $importer = new JpMorganFileProbe(__DIR__ . "/data/jpmorgan.csv"); + $importer->import(); - $contribution = wmf_civicrm_get_contributions_from_gateway_id( 'jpmorgan', '1234TEST' ); - $this->assertEquals( 1, count( $contribution ) ); - $this->assertEquals( 'JPMORGAN 1234TEST', $contribution[0]['trxn_id'] ); - } + $contribution = wmf_civicrm_get_contributions_from_gateway_id('jpmorgan', '1234TEST'); + $this->assertEquals(1, count($contribution)); + $this->assertEquals('JPMORGAN 1234TEST', $contribution[0]['trxn_id']); + } - /** - * @expectedException WmfException - * @expectedExceptionCode WmfException::INVALID_FILE_FORMAT - * @expectedExceptionMessage Duplicate column headers: CURRENCY, reference - */ - function testImportDuplicateHeaders() { - //FIXME - $_GET['q'] = ''; - //FIXME - civicrm_initialize(); + /** + * @expectedException WmfException + * @expectedExceptionCode WmfException::INVALID_FILE_FORMAT + * @expectedExceptionMessage Duplicate column headers: CURRENCY, reference + */ + function testImportDuplicateHeaders() { + //FIXME + $_GET['q'] = ''; + //FIXME + civicrm_initialize(); - $importer = new JpMorganFileProbe( __DIR__ . "/data/duplicate_header.csv" ); - $importer->import(); - } + $importer = new JpMorganFileProbe(__DIR__ . "/data/duplicate_header.csv"); + $importer->import(); + } } diff --git a/sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php b/sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php index 8535bca..5a06dfb 100644 --- a/sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php +++ b/sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php @@ -5,60 +5,60 @@ * @group Offline2Civicrm */ class PayPalChecksFileTest extends BaseChecksFileTest { - function setUp() { - parent::setUp(); + function setUp() { + parent::setUp(); - require_once __DIR__ . "/includes/PayPalChecksFileProbe.php"; - } + require_once __DIR__ . "/includes/PayPalChecksFileProbe.php"; + } - function testParseRow() { - $data = array( - 'Contribution Type' => 'Cash', - 'Total Amount' => '$10.00', - 'Source' => 'USD 10.00', - 'Received Date' => '1/27/13', - 'Payment Instrument' => 'EFT', - 'Restrictions' => 'Unrestricted - General', - 'Gift Source' => 'Community Gift', - 'Direct Mail Appeal' => 'MissionFish (PayPal)', - 'Prefix' => '', - 'First Name' => 'Diz and', - 'Last Name' => 'Bird', - 'Suffix' => '', - 'Street Address' => '', - 'Additional Address 1' => '', - 'Additional Address 2' => '', - 'City' => '', - 'State' => '', - 'Postal Code' => '', - 'Country' => '', - 'Phone' => '', - 'Email' => '', - 'No Thank You' => 'no reas', - ); - $expected_normal = array( - 'contact_source' => 'check', - 'contact_type' => 'Individual', - 'contribution_source' => 'USD 10.00', - 'country' => 'US', - 'currency' => 'USD', - 'date' => '1/27/13', - 'direct_mail_appeal' => 'MissionFish (PayPal)', - 'first_name' => 'Diz and', - 'gateway' => 'paypal', - 'gift_source' => 'Community Gift', - 'gross' => '$10.00', - 'last_name' => 'Bird', - 'no_thank_you' => 'no reas', - 'payment_method' => 'EFT', - 'raw_contribution_type' => 'Cash', - 'restrictions' => 'Unrestricted - General', - ); + function testParseRow() { + $data = array( + 'Contribution Type' => 'Cash', + 'Total Amount' => '$10.00', + 'Source' => 'USD 10.00', + 'Received Date' => '1/27/13', + 'Payment Instrument' => 'EFT', + 'Restrictions' => 'Unrestricted - General', + 'Gift Source' => 'Community Gift', + 'Direct Mail Appeal' => 'MissionFish (PayPal)', + 'Prefix' => '', + 'First Name' => 'Diz and', + 'Last Name' => 'Bird', + 'Suffix' => '', + 'Street Address' => '', + 'Additional Address 1' => '', + 'Additional Address 2' => '', + 'City' => '', + 'State' => '', + 'Postal Code' => '', + 'Country' => '', + 'Phone' => '', + 'Email' => '', + 'No Thank You' => 'no reas', + ); + $expected_normal = array( + 'contact_source' => 'check', + 'contact_type' => 'Individual', + 'contribution_source' => 'USD 10.00', + 'country' => 'US', + 'currency' => 'USD', + 'date' => '1/27/13', + 'direct_mail_appeal' => 'MissionFish (PayPal)', + 'first_name' => 'Diz and', + 'gateway' => 'paypal', + 'gift_source' => 'Community Gift', + 'gross' => '$10.00', + 'last_name' => 'Bird', + 'no_thank_you' => 'no reas', + 'payment_method' => 'EFT', + 'raw_contribution_type' => 'Cash', + 'restrictions' => 'Unrestricted - General', + ); - $importer = new PayPalChecksFileProbe( "no URI" ); - $output = $importer->_parseRow( $data ); + $importer = new PayPalChecksFileProbe("no URI"); + $output = $importer->_parseRow($data); - $this->stripSourceData( $output ); - $this->assertEquals( $expected_normal, $output ); - } + $this->stripSourceData($output); + $this->assertEquals($expected_normal, $output); + } } diff --git a/sites/all/modules/offline2civicrm/tests/SquareFileTest.php b/sites/all/modules/offline2civicrm/tests/SquareFileTest.php index 0f201fc..964b83e 100644 --- a/sites/all/modules/offline2civicrm/tests/SquareFileTest.php +++ b/sites/all/modules/offline2civicrm/tests/SquareFileTest.php @@ -5,89 +5,89 @@ * @group Offline2Civicrm */ class SquareFileTest extends BaseChecksFileTest { - function setUp() { - parent::setUp(); + function setUp() { + parent::setUp(); - require_once __DIR__ . "/includes/SquareFileProbe.php"; - } + require_once __DIR__ . "/includes/SquareFileProbe.php"; + } - function testParseRow() { - $data = array( - 'Currency' => 'USD', - 'Email Address' => 'm...@gmail.com', - 'Gross Amount' => '$35.00', - 'Name' => 'Max Normal', - 'Net Amount' => '$35.00', - 'Payment ID' => 'abc123', - 'Phone Number' => '3333333333', - 'Status' => 'Completed', - 'Timestamp' => 1426129877, - 'Zip Code' => '94103', - ); - $expected_normal = array( - 'contact_source' => 'check', - 'contact_type' => 'Individual', - 'contribution_type' => 'cash', - 'country' => 'US', - 'currency' => 'USD', - 'date' => 1426129877, - 'email' => 'm...@gmail.com', - 'first_name' => 'Max', - 'full_name' => 'Max Normal', - 'gateway' => 'square', - 'gateway_status_raw' => 'Completed', - 'gateway_txn_id' => 'abc123', - 'gross' => '35.00', - 'last_name' => 'Normal', - 'net' => '35.00', - 'phone' => '3333333333', - 'postal_code' => '94103', - ); + function testParseRow() { + $data = array( + 'Currency' => 'USD', + 'Email Address' => 'm...@gmail.com', + 'Gross Amount' => '$35.00', + 'Name' => 'Max Normal', + 'Net Amount' => '$35.00', + 'Payment ID' => 'abc123', + 'Phone Number' => '3333333333', + 'Status' => 'Completed', + 'Timestamp' => 1426129877, + 'Zip Code' => '94103', + ); + $expected_normal = array( + 'contact_source' => 'check', + 'contact_type' => 'Individual', + 'contribution_type' => 'cash', + 'country' => 'US', + 'currency' => 'USD', + 'date' => 1426129877, + 'email' => 'm...@gmail.com', + 'first_name' => 'Max', + 'full_name' => 'Max Normal', + 'gateway' => 'square', + 'gateway_status_raw' => 'Completed', + 'gateway_txn_id' => 'abc123', + 'gross' => '35.00', + 'last_name' => 'Normal', + 'net' => '35.00', + 'phone' => '3333333333', + 'postal_code' => '94103', + ); - $importer = new SquareFileProbe( "no URI" ); - $output = $importer->_parseRow( $data ); + $importer = new SquareFileProbe("no URI"); + $output = $importer->_parseRow($data); - $this->stripSourceData( $output ); - $this->assertEquals( $expected_normal, $output ); - } + $this->stripSourceData($output); + $this->assertEquals($expected_normal, $output); + } - function testParseRow_Refund() { - $data = array( - 'Currency' => 'USD', - 'Email Address' => 'm...@gmail.com', - 'Gross Amount' => '$35.00', - 'Name' => 'Max Normal', - 'Net Amount' => '$0', - 'Payment ID' => 'abc123', - 'Phone Number' => '3333333333', - 'Status' => 'Refunded', - 'Timestamp' => 1426129877, - 'Zip Code' => '94103', - ); - $expected_normal = array( - 'contact_source' => 'check', - 'contact_type' => 'Individual', - 'contribution_type' => 'cash', - 'country' => 'US', - 'currency' => 'USD', - 'date' => 1426129877, - 'email' => 'm...@gmail.com', - 'first_name' => 'Max', - 'full_name' => 'Max Normal', - 'gateway' => 'square', - 'gateway_status_raw' => 'Refunded', - 'gateway_txn_id' => 'abc123', - 'gross' => '35.00', - 'last_name' => 'Normal', - 'net' => '35.00', - 'phone' => '3333333333', - 'postal_code' => '94103', - ); + function testParseRow_Refund() { + $data = array( + 'Currency' => 'USD', + 'Email Address' => 'm...@gmail.com', + 'Gross Amount' => '$35.00', + 'Name' => 'Max Normal', + 'Net Amount' => '$0', + 'Payment ID' => 'abc123', + 'Phone Number' => '3333333333', + 'Status' => 'Refunded', + 'Timestamp' => 1426129877, + 'Zip Code' => '94103', + ); + $expected_normal = array( + 'contact_source' => 'check', + 'contact_type' => 'Individual', + 'contribution_type' => 'cash', + 'country' => 'US', + 'currency' => 'USD', + 'date' => 1426129877, + 'email' => 'm...@gmail.com', + 'first_name' => 'Max', + 'full_name' => 'Max Normal', + 'gateway' => 'square', + 'gateway_status_raw' => 'Refunded', + 'gateway_txn_id' => 'abc123', + 'gross' => '35.00', + 'last_name' => 'Normal', + 'net' => '35.00', + 'phone' => '3333333333', + 'postal_code' => '94103', + ); - $importer = new SquareFileProbe( "no URI" ); - $output = $importer->_parseRow( $data ); + $importer = new SquareFileProbe("no URI"); + $output = $importer->_parseRow($data); - $this->stripSourceData( $output ); - $this->assertEquals( $expected_normal, $output ); - } + $this->stripSourceData($output); + $this->assertEquals($expected_normal, $output); + } } diff --git a/sites/all/modules/offline2civicrm/tests/WmfImportTest.php b/sites/all/modules/offline2civicrm/tests/WmfImportTest.php index b1f480c..ab38ca4 100644 --- a/sites/all/modules/offline2civicrm/tests/WmfImportTest.php +++ b/sites/all/modules/offline2civicrm/tests/WmfImportTest.php @@ -8,56 +8,56 @@ */ class WmfImportTest extends BaseChecksFileTest { - /** - * Existing contribution_tracking row is updated with contribution_id - */ - function testImportExistingTracking() { - $contribution_tracking_id = wmf_civicrm_insert_contribution_tracking( array( - 'utm_source' => 'Blah_source', - 'utm_medium' => 'civicrm', - 'utm_campaign' => 'test_campaign', - 'ts' => wmf_common_date_unix_to_sql( time() ) - ) ); + /** + * Existing contribution_tracking row is updated with contribution_id + */ + function testImportExistingTracking() { + $contribution_tracking_id = wmf_civicrm_insert_contribution_tracking(array( + 'utm_source' => 'Blah_source', + 'utm_medium' => 'civicrm', + 'utm_campaign' => 'test_campaign', + 'ts' => wmf_common_date_unix_to_sql(time()) + )); - $this->trxn_id = mt_rand(); - $this->gateway = 'globalcollect'; - $data = array( - 'City' => 'blah city', - 'Contribution Tracking ID' => $contribution_tracking_id, - 'Country' => 'AR', - 'Email' => 'em...@phony.com', - 'External Batch Number' => mt_rand(), - 'First Name' => 'Test_first_name', - 'Gift Source' => 'Community GIft', - 'Last Name' => 'Test_last_name', - 'Original Amount' => '123', - 'Original Currency' => 'USD', - 'Payment Gateway' => $this->gateway, - 'Payment Instrument' => 'Cash', - 'Postal Code' => '90210', - 'Postmark Date' => '2012-02-02', - 'Received Date' => '2017-07-07', - 'State' => 'CA', - 'Street Address' => '123 Sunset Boulevard', - 'Transaction ID' => $this->trxn_id, - ); - $importer = new WmfImportFile( "no URI" ); - $exposed = TestingAccessWrapper::newFromObject( $importer ); - $message = $exposed->parseRow( $data ); - $exposed->doImport( $message ); - $contributions = wmf_civicrm_get_contributions_from_gateway_id( - $this->gateway, $this->trxn_id - ); - $this->assertEquals( 1, count( $contributions ) ); - $contribution = $contributions[0]; - $this->assertEquals( $this->gateway, $contribution['gateway'] ); - $ct = db_select( 'contribution_tracking', 'contribution_tracking' ) - ->fields( 'contribution_tracking' ) - ->condition( 'id', $contribution_tracking_id ) - ->execute() - ->fetchAssoc(); - $this->assertEquals( $contribution['id'], $ct['contribution_id'] ); - // TODO: should update existing c_t row with country! - // $this->assertEquals( 'AR', $ct['country'] ); - } + $this->trxn_id = mt_rand(); + $this->gateway = 'globalcollect'; + $data = array( + 'City' => 'blah city', + 'Contribution Tracking ID' => $contribution_tracking_id, + 'Country' => 'AR', + 'Email' => 'em...@phony.com', + 'External Batch Number' => mt_rand(), + 'First Name' => 'Test_first_name', + 'Gift Source' => 'Community GIft', + 'Last Name' => 'Test_last_name', + 'Original Amount' => '123', + 'Original Currency' => 'USD', + 'Payment Gateway' => $this->gateway, + 'Payment Instrument' => 'Cash', + 'Postal Code' => '90210', + 'Postmark Date' => '2012-02-02', + 'Received Date' => '2017-07-07', + 'State' => 'CA', + 'Street Address' => '123 Sunset Boulevard', + 'Transaction ID' => $this->trxn_id, + ); + $importer = new WmfImportFile("no URI"); + $exposed = TestingAccessWrapper::newFromObject($importer); + $message = $exposed->parseRow($data); + $exposed->doImport($message); + $contributions = wmf_civicrm_get_contributions_from_gateway_id( + $this->gateway, $this->trxn_id + ); + $this->assertEquals(1, count($contributions)); + $contribution = $contributions[0]; + $this->assertEquals($this->gateway, $contribution['gateway']); + $ct = db_select('contribution_tracking', 'contribution_tracking') + ->fields('contribution_tracking') + ->condition('id', $contribution_tracking_id) + ->execute() + ->fetchAssoc(); + $this->assertEquals($contribution['id'], $ct['contribution_id']); + // TODO: should update existing c_t row with country! + // $this->assertEquals( 'AR', $ct['country'] ); + } } diff --git a/sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php b/sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php index 57ee4d2..1243136 100644 --- a/sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php +++ b/sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php @@ -8,63 +8,64 @@ * * @var string */ - protected $gateway; + protected $gateway; /** * Transaction id being worked with. This is combined with the gateway for the civi trxn_id. * * @var string */ - protected $trxn_id; - /** - * Test and remove some dynamic fields, to simplify test fixtures. - */ - function stripSourceData( &$msg ) { - $this->assertEquals( 'direct', $msg['source_type'] ); - $importerClass = str_replace( 'Test', 'Probe', get_class( $this ) ); - $this->assertEquals( "Offline importer: {$importerClass}", $msg['source_name'] ); - $this->assertNotNull( $msg['source_host'] ); - $this->assertGreaterThan( 0, $msg['source_run_id'] ); - $this->assertNotNull( $msg['source_version'] ); - $this->assertGreaterThan( 0, $msg['source_enqueued_time'] ); + protected $trxn_id; - unset( $msg['source_type'] ); - unset( $msg['source_name'] ); - unset( $msg['source_host'] ); - unset( $msg['source_run_id'] ); - unset( $msg['source_version'] ); - unset( $msg['source_enqueued_time'] ); - } + /** + * Test and remove some dynamic fields, to simplify test fixtures. + */ + function stripSourceData(&$msg) { + $this->assertEquals('direct', $msg['source_type']); + $importerClass = str_replace('Test', 'Probe', get_class($this)); + $this->assertEquals("Offline importer: {$importerClass}", $msg['source_name']); + $this->assertNotNull($msg['source_host']); + $this->assertGreaterThan(0, $msg['source_run_id']); + $this->assertNotNull($msg['source_version']); + $this->assertGreaterThan(0, $msg['source_enqueued_time']); + + unset($msg['source_type']); + unset($msg['source_name']); + unset($msg['source_host']); + unset($msg['source_run_id']); + unset($msg['source_version']); + unset($msg['source_enqueued_time']); + } /** * Clean up after test runs. */ - public function tearDown() { - $this->doCleanUp(); - } + public function tearDown() { + $this->doCleanUp(); + } - /** - * Clean up transactions from previous test runs. - */ - function doCleanUp() { - if ($this->trxn_id) { - $contributions = wmf_civicrm_get_contributions_from_gateway_id($this->gateway, $this->trxn_id); - if ($contributions) { - foreach ($contributions as $contribution) { - $this->callAPISuccess('Contribution', 'delete', array('id' => $contribution['id'])); - } + /** + * Clean up transactions from previous test runs. + */ + function doCleanUp() { + if ($this->trxn_id) { + $contributions = wmf_civicrm_get_contributions_from_gateway_id($this->gateway, $this->trxn_id); + if ($contributions) { + foreach ($contributions as $contribution) { + $this->callAPISuccess('Contribution', 'delete', array('id' => $contribution['id'])); } } - $this->doMouseHunt(); } + $this->doMouseHunt(); + } - /** - * Clean up previous runs. - * - * Also get rid of the nest. - */ - protected function doMouseHunt() { - CRM_Core_DAO::executeQuery('DELETE FROM civicrm_contact WHERE display_name = "Mickey Mouse"'); - CRM_Core_DAO::executeQuery('DELETE FROM civicrm_prevnext_cache'); - } + /** + * Clean up previous runs. + * + * Also get rid of the nest. + */ + protected function doMouseHunt() { + CRM_Core_DAO::executeQuery('DELETE FROM civicrm_contact WHERE display_name = "Mickey Mouse"'); + CRM_Core_DAO::executeQuery('DELETE FROM civicrm_prevnext_cache'); + } } diff --git a/sites/all/modules/offline2civicrm/tests/includes/ChecksFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/ChecksFileProbe.php index cbf8be7..92084af 100644 --- a/sites/all/modules/offline2civicrm/tests/includes/ChecksFileProbe.php +++ b/sites/all/modules/offline2civicrm/tests/includes/ChecksFileProbe.php @@ -2,15 +2,15 @@ /** TODO: Use a generalized access wrapper instead. */ class ChecksFileProbe extends ChecksFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } + function _parseRow($data) { + return $this->parseRow($data); + } - protected function getRequiredColumns() { - return array(); - } + protected function getRequiredColumns() { + return array(); + } - protected function getRequiredData() { - return array(); - } + protected function getRequiredData() { + return array(); + } } diff --git a/sites/all/modules/offline2civicrm/tests/includes/EngageChecksFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/EngageChecksFileProbe.php index 5e9765b..319b041 100644 --- a/sites/all/modules/offline2civicrm/tests/includes/EngageChecksFileProbe.php +++ b/sites/all/modules/offline2civicrm/tests/includes/EngageChecksFileProbe.php @@ -1,7 +1,7 @@ <?php class EngageChecksFileProbe extends EngageChecksFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } + function _parseRow($data) { + return $this->parseRow($data); + } } diff --git a/sites/all/modules/offline2civicrm/tests/includes/ForeignChecksFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/ForeignChecksFileProbe.php index 153e96a..ad3cef2 100644 --- a/sites/all/modules/offline2civicrm/tests/includes/ForeignChecksFileProbe.php +++ b/sites/all/modules/offline2civicrm/tests/includes/ForeignChecksFileProbe.php @@ -1,7 +1,7 @@ <?php class ForeignChecksFileProbe extends ForeignChecksFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } + function _parseRow($data) { + return $this->parseRow($data); + } } diff --git a/sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php index 7dac60d..6c0bd42 100644 --- a/sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php +++ b/sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php @@ -1,7 +1,7 @@ <?php class JpMorganFileProbe extends JpMorganFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } + function _parseRow($data) { + return $this->parseRow($data); + } } diff --git a/sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php index c35352f..d001957 100644 --- a/sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php +++ b/sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php @@ -1,7 +1,7 @@ <?php class PayPalChecksFileProbe extends PayPalChecksFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } + function _parseRow($data) { + return $this->parseRow($data); + } } diff --git a/sites/all/modules/offline2civicrm/tests/includes/SquareFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/SquareFileProbe.php index 7d61b26..09996ab 100644 --- a/sites/all/modules/offline2civicrm/tests/includes/SquareFileProbe.php +++ b/sites/all/modules/offline2civicrm/tests/includes/SquareFileProbe.php @@ -1,7 +1,7 @@ <?php class SquareFileProbe extends SquareFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } + function _parseRow($data) { + return $this->parseRow($data); + } } -- To view, visit https://gerrit.wikimedia.org/r/392553 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic13a06b65f85fb007c9938dccf838cf59eb2ea61 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits