diff --git a/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php b/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php index 2169552b6ce5fd47fb8eb1b7f1b4c4c0b73d7bb6..617753d5ddda3e1ad831de7e1b83b8804c068c2a 100644 --- a/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php @@ -469,6 +469,13 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase { $dao = new CRM_Core_DAO(); $contribution_page = $dao->createTestObject('CRM_Contribute_DAO_ContributionPage'); $contribution->contribution_page_id = $contributionPageID = $contribution_page->id; + //for unknown reasons trying to do a find & save on a contribution with a receive_date set + // doesn't work. This seems of minimal relevance to this test so ignoring + // note that in tests it worked sometimes & not others - dependent on which other tests run. + // running all CRM_Core tests caused failure as did just the single failing test. But running + // just this class succeeds - because it actually doesn't do a mysql update on the following save + // (unknown reason) + unset($contribution->receive_date); $contribution->save(); } diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 6e557393132f3c16a3cfa395a69885c5b36860c5..c05465c93185a85f1faa8af2d6571371c0c9a119 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -513,6 +513,20 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__); } + + /* + * Create test with unique field name on source + */ + function testCreateDefaultNow() { + + $params = $this->_params; + unset($params['receive_date']); + + $contribution = $this->callAPISuccess('contribution', 'create', $params); + $contribution = $this->callAPISuccessGetSingle('contribution', array('id' => $contribution['id'])); + $this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($contribution['receive_date']))); + } + /* * Create test with unique field name on source */