Skip to content

Commit

Permalink
Merge pull request #20439 from eileenmcnaughton/proftest
Browse files Browse the repository at this point in the history
Fix profile test teardown
  • Loading branch information
seamuslee001 authored May 29, 2021
2 parents a76a8c5 + 9db37f9 commit 946984c
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 81 deletions.
4 changes: 3 additions & 1 deletion Civi/Test/ContactTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ trait ContactTestTrait {
/**
* Emulate a logged in user since certain functions use that.
* value to store a record in the DB (like activity)
*
* @see https://issues.civicrm.org/jira/browse/CRM-8180
*
* @return int
* Contact ID of the created user.
* @throws \CiviCRM_API3_Exception
*/
public function createLoggedInUser() {
public function createLoggedInUser(): int {
$params = [
'first_name' => 'Logged In',
'last_name' => 'User ' . rand(),
Expand Down
5 changes: 3 additions & 2 deletions tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Civi\Api4\RelationshipType;
use Civi\Payment\System;
use Civi\Api4\OptionValue;
use Civi\Test\Api3DocTrait;
use League\Csv\Reader;

/**
Expand Down Expand Up @@ -58,7 +59,7 @@
*/
class CiviUnitTestCase extends PHPUnit\Framework\TestCase {

use \Civi\Test\Api3DocTrait;
use Api3DocTrait;
use \Civi\Test\GenericAssertionsTrait;
use \Civi\Test\DbTestTrait;
use \Civi\Test\ContactTestTrait;
Expand Down Expand Up @@ -3122,7 +3123,7 @@ protected function enableTaxAndInvoicing($params = []) {
*
* @throws \CRM_Core_Exception
*/
protected function disableTaxAndInvoicing() {
protected function disableTaxAndInvoicing(): \Civi\Core\SettingsBag {
$accounts = $this->callAPISuccess('EntityFinancialAccount', 'get', ['account_relationship' => 'Sales Tax Account is'])['values'];
foreach ($accounts as $account) {
$this->callAPISuccess('EntityFinancialAccount', 'delete', ['id' => $account['id']]);
Expand Down
Loading

0 comments on commit 946984c

Please sign in to comment.