$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();
}
$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
*/