X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fapi%2Fv4%2FAction%2FSqlFunctionTest.php;h=af91acffaff4d63c8d839258ed17369374eaa74c;hb=27cd8728de77bd4df74352d3798432c27bf04cb4;hp=f948b22db48cb21093860941347f917ff5bcd141;hpb=aefd05e9305c9f926a025c57cec1e4630fd91a7d;p=civicrm-core.git diff --git a/tests/phpunit/api/v4/Action/SqlFunctionTest.php b/tests/phpunit/api/v4/Action/SqlFunctionTest.php index f948b22db4..af91acffaf 100644 --- a/tests/phpunit/api/v4/Action/SqlFunctionTest.php +++ b/tests/phpunit/api/v4/Action/SqlFunctionTest.php @@ -14,7 +14,6 @@ * * @package CRM * @copyright CiviCRM LLC https://civicrm.org/licensing - * */ @@ -38,9 +37,8 @@ class SqlFunctionTest extends UnitTestCase { } public function testGroupAggregates() { - $cid = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'bill')->execute()->first()['id']; - Contribution::save() - ->setCheckPermissions(FALSE) + $cid = Contact::create(FALSE)->addValue('first_name', 'bill')->execute()->first()['id']; + Contribution::save(FALSE) ->setDefaults(['contact_id' => $cid, 'financial_type_id' => 1]) ->setRecords([ ['total_amount' => 100, 'receive_date' => '2020-01-01'], @@ -49,8 +47,7 @@ class SqlFunctionTest extends UnitTestCase { ['total_amount' => 400, 'receive_date' => '2020-01-01'], ]) ->execute(); - $agg = Contribution::get() - ->setCheckPermissions(FALSE) + $agg = Contribution::get(FALSE) ->addGroupBy('contact_id') ->addWhere('contact_id', '=', $cid) ->addSelect('AVG(total_amount) AS average') @@ -68,9 +65,8 @@ class SqlFunctionTest extends UnitTestCase { } public function testGroupHaving() { - $cid = Contact::create()->setCheckPermissions(FALSE)->addValue('first_name', 'donor')->execute()->first()['id']; - Contribution::save() - ->setCheckPermissions(FALSE) + $cid = Contact::create(FALSE)->addValue('first_name', 'donor')->execute()->first()['id']; + Contribution::save(FALSE) ->setDefaults(['contact_id' => $cid, 'financial_type_id' => 1]) ->setRecords([ ['total_amount' => 100, 'receive_date' => '2020-02-02'], @@ -79,8 +75,7 @@ class SqlFunctionTest extends UnitTestCase { ['total_amount' => 400, 'receive_date' => '2020-04-04'], ]) ->execute(); - $result = Contribution::get() - ->setCheckPermissions(FALSE) + $result = Contribution::get(FALSE) ->addGroupBy('contact_id') ->addGroupBy('receive_date') ->addSelect('contact_id')