From 4c24a94db15df329a15e5ab27e5eaa9e55253579 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 2 Dec 2023 17:33:47 +1300 Subject: [PATCH] Stop forcing apiVersion to 3 in setUp It should be possible to override it at a class level... --- tests/phpunit/CiviTest/CiviUnitTestCase.php | 2 -- tests/phpunit/api/v3/ActivityContactTest.php | 8 +++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index fd65764ef6..b643348dc9 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -295,8 +295,6 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase { parent::setUp(); CRM_Core_Session::singleton()->set('userID'); - $this->_apiversion = 3; - // Use a temporary file for STDIN $GLOBALS['stdin'] = tmpfile(); if ($GLOBALS['stdin'] === FALSE) { diff --git a/tests/phpunit/api/v3/ActivityContactTest.php b/tests/phpunit/api/v3/ActivityContactTest.php index a848a6896c..b7de1795c4 100644 --- a/tests/phpunit/api/v3/ActivityContactTest.php +++ b/tests/phpunit/api/v3/ActivityContactTest.php @@ -18,7 +18,7 @@ * @group headless */ class api_v3_ActivityContactTest extends CiviUnitTestCase { - protected $_apiversion; + protected $_apiversion = 3; protected $_contactID; protected $_activityID; protected $_params; @@ -42,9 +42,8 @@ class api_v3_ActivityContactTest extends CiviUnitTestCase { * @param int $version * * @dataProvider versionThreeAndFour - * @throws \CRM_Core_Exception */ - public function testCreateActivityContact($version) { + public function testCreateActivityContact(int $version): void { $this->_apiversion = $version; $result = $this->callAPISuccess('ActivityContact', 'create', $this->_params); @@ -61,9 +60,8 @@ class api_v3_ActivityContactTest extends CiviUnitTestCase { * @param int $version * * @dataProvider versionThreeAndFour - * @throws \CRM_Core_Exception */ - public function testDeleteActivityContact($version) { + public function testDeleteActivityContact(int $version): void { $this->_apiversion = $version; //create one $create = $this->callAPISuccess('activity_contact', 'create', $this->_params); -- 2.25.1