From 726732bdc752b185b5f52800fb10df7d3e741bc9 Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Mon, 1 Jan 2018 23:27:53 +0530 Subject: [PATCH] test failure fixes --- CRM/Contribute/Form/Contribution.php | 3 +- api/v3/examples/ContributionPage/Submit.php | 4 +- .../CRM/Contribute/BAO/ContributionTest.php | 2 - .../CRM/Contribute/Form/ContributionTest.php | 64 +------------------ .../CRM/Financial/BAO/FinancialItemTest.php | 2 - .../CRM/Financial/Form/PaymentEditTest.php | 5 +- tests/phpunit/api/v3/ContributionPageTest.php | 1 + tests/phpunit/api/v3/ContributionTest.php | 2 - tests/phpunit/api/v3/MembershipTest.php | 2 - 9 files changed, 8 insertions(+), 77 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index fab5b05a94f0..a9c18b80c482 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1288,10 +1288,9 @@ protected function generatePane($type, $defaults) { public function testSubmit($params, $action, $creditCardMode = NULL) { $defaults = array( 'soft_credit_contact_id' => array(), + 'receive_date' => date('Y-m-d H:i:s'), 'receipt_date' => '', - 'receipt_date_time' => '', 'cancel_date' => '', - 'cancel_date_time' => '', 'hidden_Premium' => 1, ); $this->_bltID = 5; diff --git a/api/v3/examples/ContributionPage/Submit.php b/api/v3/examples/ContributionPage/Submit.php index c24c4dbcb393..a1d8932776c8 100644 --- a/api/v3/examples/ContributionPage/Submit.php +++ b/api/v3/examples/ContributionPage/Submit.php @@ -26,8 +26,8 @@ function contribution_page_submit_example() { ), 'cvv2' => 123, 'pledge_id' => '1', - 'cid' => '77', - 'contact_id' => '77', + 'cid' => '83', + 'contact_id' => '83', 'amount' => '100', 'is_pledge' => TRUE, 'pledge_block_id' => 2, diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index 847e710196c3..8ff2a2021e74 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -1203,8 +1203,6 @@ public function createContributionWithTax() { $form->testSubmit(array( 'total_amount' => 100, 'financial_type_id' => $financialType['id'], - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $contactId, 'contribution_status_id' => 1, 'price_set_id' => 0, diff --git a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php index 68d96949e56c..93158c5434bf 100644 --- a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php @@ -149,8 +149,6 @@ public function testSubmit() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -168,8 +166,6 @@ public function testSubmitCreditCard() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -195,8 +191,6 @@ public function testSubmitCreditCardPayPal() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'contribution_status_id' => 1, 'credit_card_number' => 4444333322221111, @@ -267,8 +261,6 @@ public function testSubmitCreditCardWithEmailReceipt() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'contribution_status_id' => 1, 'credit_card_number' => 4444333322221111, @@ -332,8 +324,6 @@ public function testSubmitCreditCardNoReceipt() { $form->testSubmit(array( 'total_amount' => 60, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'contribution_status_id' => 1, 'credit_card_number' => 4444333322221111, @@ -393,8 +383,6 @@ public function testSubmitCreditCardFee() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -446,8 +434,6 @@ public function testSubmitCreditCardFullyDeductible() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -506,8 +492,6 @@ public function testSubmitCreditCardInvalid() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'payment_processor_id' => $this->paymentProcessorID, @@ -546,8 +530,6 @@ public function testSubmitCreditCardWithBillingAddress() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'payment_processor_id' => $this->paymentProcessorID, @@ -572,7 +554,7 @@ public function testSubmitCreditCardWithBillingAddress() { */ public function testSubmitCreditCardWithRecur() { $form = new CRM_Contribute_Form_Contribution(); - $receiveDate = date('m/d/Y', strtotime('+1 month')); + $receiveDate = date('Y-m-d H:i:s', strtotime('+1 month')); $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, @@ -581,7 +563,6 @@ public function testSubmitCreditCardWithRecur() { 'frequency_unit' => 'month', 'installments' => 2, 'receive_date' => $receiveDate, - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'payment_processor_id' => $this->paymentProcessorID, @@ -592,7 +573,7 @@ public function testSubmitCreditCardWithRecur() { 'live' ); $contribution = $this->callAPISuccessGetSingle('Contribution', array('return' => 'receive_date')); - $this->assertEquals(date("m/d/Y", strtotime($contribution['receive_date'])), $receiveDate); + $this->assertEquals($contribution['receive_date'], $receiveDate); } /** @@ -603,8 +584,6 @@ public function testSubmitCreditCardWithNoBillingAddress() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'payment_processor_id' => $this->paymentProcessorID, @@ -630,8 +609,6 @@ public function testSubmitEmailReceipt() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'is_email_receipt' => TRUE, 'from_email_address' => 'test@test.com', @@ -688,8 +665,6 @@ public function testEmailReceiptOnPayLater() { $params = array( 'total_amount' => 100, 'financial_type_id' => $donationFT, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'is_email_receipt' => TRUE, 'from_email_address' => 'test@test.com', @@ -746,8 +721,6 @@ public function testUpdatePledge() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'pledge_payment_id' => $pledgePaymentID, @@ -768,8 +741,6 @@ public function testPremiumUpdate() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -797,8 +768,6 @@ public function testPremiumUpdateCreditCard() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -829,8 +798,6 @@ public function testSubmitWithNote() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -851,8 +818,6 @@ public function testSubmitWithNoteCreditCard() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -876,8 +841,6 @@ public function testEnterNegativeContribution() { $form->testSubmit(array( 'total_amount' => -5, 'financial_type_id' => 1, - 'receive_date' => '04/24/2016', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -900,8 +863,6 @@ public function testSubmitUpdate() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -913,8 +874,6 @@ public function testSubmitUpdate() { 'total_amount' => 45, 'net_amount' => 45, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -943,8 +902,6 @@ public function testSubmitUpdateChangePaymentInstrument() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'check_number' => '123AX', @@ -957,8 +914,6 @@ public function testSubmitUpdateChangePaymentInstrument() { 'total_amount' => 50, 'net_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'card_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Financial_DAO_FinancialTrxn', 'card_type_id', 'Visa'), @@ -1014,8 +969,6 @@ public function testPartialPaymentWithCreditCard() { array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'check_number' => substr(sha1(rand()), 0, 7), @@ -1035,8 +988,6 @@ public function testPartialPaymentWithCreditCard() { 'total_amount' => 50, 'currency' => 'USD', 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit card', $this->paymentInstruments), 'payment_processor_id' => $this->paymentProcessorID, @@ -1066,8 +1017,6 @@ public function testSubmitSaleTax() { $form->testSubmit(array( 'total_amount' => 100, 'financial_type_id' => $this->_financialTypeId, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -1118,8 +1067,6 @@ public function testSubmitWithOutSaleTax() { $form->testSubmit(array( 'total_amount' => 100, 'financial_type_id' => 3, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -1279,8 +1226,7 @@ protected function doInitialSubmit() { $form->testSubmit(array( 'total_amount' => 100, 'financial_type_id' => $this->_financialTypeId, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', + 'receive_date' => '2015-04-21 00:00:00', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -1316,8 +1262,6 @@ public function testCardTypeAndPanTruncation() { array( 'total_amount' => 100, 'financial_type_id' => 3, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), 'contribution_status_id' => 1, @@ -1405,8 +1349,6 @@ public function testCardTypeAndPanTruncationLiveMode() { array( 'total_amount' => 50, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'credit_card_number' => 4444333322221111, 'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments), diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php index a9b56cf00f36..cece2bb61df4 100644 --- a/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php @@ -326,8 +326,6 @@ public function testGetPreviousFinancialItemHavingTax($thousandSeparator) { $form->testSubmit(array( 'total_amount' => 100, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $contactId, 'contribution_status_id' => 1, 'price_set_id' => 0, diff --git a/tests/phpunit/CRM/Financial/Form/PaymentEditTest.php b/tests/phpunit/CRM/Financial/Form/PaymentEditTest.php index e68771d13fdf..bbc8cb47b2ee 100644 --- a/tests/phpunit/CRM/Financial/Form/PaymentEditTest.php +++ b/tests/phpunit/CRM/Financial/Form/PaymentEditTest.php @@ -58,9 +58,8 @@ public function testSubmitOnPaymentInstrumentChange() { $form = new CRM_Contribute_Form_Contribution(); $form->testSubmit(array( 'total_amount' => 50, + 'receive_date' => '2015-04-21 23:27:00', 'financial_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'financial_type_id', 'Donation'), - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualID, 'payment_instrument_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'payment_instrument_id', 'Check'), 'check_number' => '123XA', @@ -131,8 +130,6 @@ public function testSubmitOnCheckNumberChange() { $form->testSubmit(array( 'total_amount' => 50, 'financial_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'financial_type_id', 'Donation'), - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualID, 'payment_instrument_id' => $checkPaymentInstrumentID, 'check_number' => $checkNumber1, diff --git a/tests/phpunit/api/v3/ContributionPageTest.php b/tests/phpunit/api/v3/ContributionPageTest.php index ecaca1a1ddfa..6d462ab2ca08 100644 --- a/tests/phpunit/api/v3/ContributionPageTest.php +++ b/tests/phpunit/api/v3/ContributionPageTest.php @@ -1687,6 +1687,7 @@ public function testSubmitContributionPageWithPriceSetQuantity($thousandSeparato 'last_name' => 'T', 'email' => 'JT@ohcanada.ca', 'is_pay_later' => TRUE, + 'receive_date' => date('Y-m-d H:i:s'), ); // Create PriceSet/PriceField diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index a1455923045f..2102975ec3df 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -2902,8 +2902,6 @@ public function testPendingToCompleteContribution() { 'net_amount' => 20, 'fee_amount' => 0, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $this->_individualId, 'contribution_status_id' => 1, 'billing_middle_name' => '', diff --git a/tests/phpunit/api/v3/MembershipTest.php b/tests/phpunit/api/v3/MembershipTest.php index 3738afe92814..1cc7def0b104 100644 --- a/tests/phpunit/api/v3/MembershipTest.php +++ b/tests/phpunit/api/v3/MembershipTest.php @@ -190,8 +190,6 @@ public function testActivityForCancelledContribution() { $form->testSubmit(array( 'total_amount' => 100, 'financial_type_id' => 1, - 'receive_date' => '04/21/2015', - 'receive_date_time' => '11:27PM', 'contact_id' => $contactId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 3,