X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fapi%2Fv3%2FContributionTest.php;h=2e433ed2f5e477e18bb9ea09b74ea291d264916d;hb=0bc483648ce59a68bb752827b218f6976689660e;hp=37d2f9d92fd27f5f1d7c0e38f4893ad2b54d9fae;hpb=9d3be1ed8ea1e282801bb830790de72d836a4250;p=civicrm-core.git diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 37d2f9d92f..2e433ed2f5 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -504,6 +504,25 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals(1, $contribution['count']); } + /** + * CRM-16227 introduces invoice_id as a parameter. + */ + public function testGetContributionByInvoice() { + $this->callAPISuccess('Contribution', 'create', array_merge($this->_params, array('invoice_id' => 'curly'))); + $this->callAPISuccess('Contribution', 'create', array_merge($this->_params), array('invoice_id' => 'churlish')); + $this->callAPISuccessGetCount('Contribution', array(), 2); + $this->callAPISuccessGetSingle('Contribution', array('invoice_id' => 'curly')); + // The following don't work. They are the format we are trying to introduce but although the form uses this format + // CRM_Contact_BAO_Query::convertFormValues puts them into the other format & the where only supports that. + // ideally the where clause would support this format (as it does on contact_BAO_Query) and those lines would + // come out of convertFormValues + // $this->callAPISuccessGetSingle('Contribution', array('invoice_id' => array('LIKE' => '%ish%'))); + // $this->callAPISuccessGetSingle('Contribution', array('invoice_id' => array('NOT IN' => array('curly')))); + // $this->callAPISuccessGetCount('Contribution', array('invoice_id' => array('LIKE' => '%ly%')), 2); + // $this->callAPISuccessGetCount('Contribution', array('invoice_id' => array('IN' => array('curly', 'churlish'))), + // 2); + } + /** * Create test with unique field name on source. */