From fa18b7458e036fde1939591a36168fe92e10c0bf Mon Sep 17 00:00:00 2001 From: KarinG Date: Mon, 25 Apr 2016 13:49:07 -0600 Subject: [PATCH] CRM-18110-test added test. --- .../CRM/Contribute/Form/ContributionTest.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php index c4bdeb1b45..35c0cbd89d 100644 --- a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php @@ -617,6 +617,29 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase { $this->assertEquals($note['note'], 'Super cool and interesting stuff'); } + /** + * Test that if a negative contribution is entered it does not get reset to $0 + */ + public function testEnterNegativeContribution() { + $form = new CRM_Contribute_Form_Contribution(); + $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, + ), + CRM_Core_Action::ADD); + $this->callAPISuccessGetCount('Contribution', array('contact_id' => $this->_individualId), 1); + + $contribution = $this->callAPISuccessGetSingle('Contribution', array( + 'contact_id' => $this->_individualId, + )); + $this->assertEquals(-5, $contribution['total_amount']); + } + /** * Test the submit function on the contribution page. */ -- 2.25.1