diff --git a/ext/afform/core/tests/phpunit/CRM/Afform/UtilTest.php b/ext/afform/core/tests/phpunit/CRM/Afform/UtilTest.php index e3884febf7c4..c759c16ee6a7 100644 --- a/ext/afform/core/tests/phpunit/CRM/Afform/UtilTest.php +++ b/ext/afform/core/tests/phpunit/CRM/Afform/UtilTest.php @@ -56,7 +56,7 @@ public function getNameExamples() { * @dataProvider getNameExamples * @throws \Exception */ - public function testNameConversion($inputFileName, $toFormat, $expected) { + public function testNameConversion($inputFileName, $toFormat, $expected): void { $actual = _afform_angular_module_name($inputFileName, $toFormat); $this->assertEquals($expected, $actual); } diff --git a/ext/afform/core/tests/phpunit/Civi/Afform/FilterTest.php b/ext/afform/core/tests/phpunit/Civi/Afform/FilterTest.php index 4e84b5592d37..012c4c2727c8 100644 --- a/ext/afform/core/tests/phpunit/Civi/Afform/FilterTest.php +++ b/ext/afform/core/tests/phpunit/Civi/Afform/FilterTest.php @@ -34,7 +34,7 @@ private function htmlFilter($fileName, $html) { return $htmls[$fileName]; } - public function testDefnInjection() { + public function testDefnInjection(): void { $inputHtml = sprintf(self::PERSON_TPL, '
'); $filteredHtml = $this->htmlFilter('~/afform/MyForm.aff.html', $inputHtml); @@ -46,7 +46,7 @@ public function testDefnInjection() { $this->assertEquals('First Name', $myField['defn']['label']); } - public function testDefnInjectionNested() { + public function testDefnInjectionNested(): void { $inputHtml = sprintf(self::PERSON_TPL, '
'); $filteredHtml = $this->htmlFilter('~/afform/MyForm.aff.html', $inputHtml); @@ -58,7 +58,7 @@ public function testDefnInjectionNested() { $this->assertEquals('First Name', $myField['defn']['label']); } - public function testDefnOverrideTitle() { + public function testDefnOverrideTitle(): void { $inputHtml = sprintf(self::PERSON_TPL, '
'); $filteredHtml = $this->htmlFilter('~/afform/MyForm.aff.html', $inputHtml); diff --git a/ext/afform/core/tests/phpunit/Civi/Afform/FormDataModelTest.php b/ext/afform/core/tests/phpunit/Civi/Afform/FormDataModelTest.php index 00513dd3ee00..0e6d7812ee42 100644 --- a/ext/afform/core/tests/phpunit/Civi/Afform/FormDataModelTest.php +++ b/ext/afform/core/tests/phpunit/Civi/Afform/FormDataModelTest.php @@ -99,7 +99,7 @@ public function getEntityExamples() { * @param $expectEntities * @dataProvider getEntityExamples */ - public function testGetEntities($html, $expectEntities) { + public function testGetEntities($html, $expectEntities): void { $parser = new \CRM_Afform_ArrayHtml(); $fdm = new FormDataModel($parser->convertHtmlToArray($html)); $this->assertEquals($expectEntities, $fdm->getEntities()); diff --git a/ext/afform/core/tests/phpunit/Civi/Afform/SymbolsTest.php b/ext/afform/core/tests/phpunit/Civi/Afform/SymbolsTest.php index 8074fc41f9ca..e2560aa6d715 100644 --- a/ext/afform/core/tests/phpunit/Civi/Afform/SymbolsTest.php +++ b/ext/afform/core/tests/phpunit/Civi/Afform/SymbolsTest.php @@ -90,7 +90,7 @@ public function getExamples() { * Types are (e)lement, (a)ttribute, (c)lass * @dataProvider getExamples */ - public function testSymbols($html, $expect) { + public function testSymbols($html, $expect): void { $expectDefaults = ['e' => [], 'a' => [], 'c' => []]; $expect = array_merge($expectDefaults, $expect); $actual = Symbols::scan($html); diff --git a/ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php b/ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php index d7406c754d9e..5d310b7c2f2d 100644 --- a/ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php +++ b/ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php @@ -14,7 +14,7 @@ public static function setUpBeforeClass() { ->apply(); } - public function setUp() { + public function setUp(): void { parent::setUp(); Civi\Api4\Afform::revert() ->setCheckPermissions(FALSE) @@ -22,7 +22,7 @@ public function setUp() { ->execute(); } - public function tearDown() { + public function tearDown(): void { parent::tearDown(); Civi\Api4\Afform::revert() ->setCheckPermissions(FALSE) @@ -30,7 +30,7 @@ public function tearDown() { ->execute(); } - public function testChangingPermissions() { + public function testChangingPermissions(): void { $http = new \GuzzleHttp\Client(['http_errors' => FALSE]); $url = function ($path, $query = NULL) { return CRM_Utils_System::url($path, $query, TRUE, NULL, FALSE); @@ -49,7 +49,7 @@ public function testChangingPermissions() { $this->assertOpensPage($result, 'mock-page'); } - public function testChangingPath() { + public function testChangingPath(): void { $http = new \GuzzleHttp\Client(['http_errors' => FALSE]); $url = function ($path, $query = NULL) { return CRM_Utils_System::url($path, $query, TRUE, NULL, FALSE); diff --git a/ext/afform/mock/tests/phpunit/api/v4/AfformTest.php b/ext/afform/mock/tests/phpunit/api/v4/AfformTest.php index 9f5132a31a48..3d57c90bb0c1 100644 --- a/ext/afform/mock/tests/phpunit/api/v4/AfformTest.php +++ b/ext/afform/mock/tests/phpunit/api/v4/AfformTest.php @@ -45,7 +45,7 @@ public function getBasicDirectives() { * @param array $originalMetadata * @dataProvider getBasicDirectives */ - public function testGetUpdateRevert($formName, $originalMetadata) { + public function testGetUpdateRevert($formName, $originalMetadata): void { $get = function($arr, $key) { return isset($arr[$key]) ? $arr[$key] : NULL; }; @@ -134,7 +134,7 @@ public function getFormatExamples() { * (For debug messages) A symbolic name of the example data-set being tested. * @dataProvider getFormatExamples */ - public function testBasicConvert($formName, $updateFormat, $updateLayout, $readFormat, $readLayout, $exampleName) { + public function testBasicConvert($formName, $updateFormat, $updateLayout, $readFormat, $readLayout, $exampleName): void { $actual = Civi\Api4\Afform::convert()->setLayout($updateLayout) ->setFrom($updateFormat) ->setTo($readFormat) @@ -177,7 +177,7 @@ public function testBasicConvert($formName, $updateFormat, $updateLayout, $readF * (For debug messages) A symbolic name of the example data-set being tested. * @dataProvider getFormatExamples */ - public function testUpdateAndGetFormat($formName, $updateFormat, $updateLayout, $readFormat, $readLayout, $exampleName) { + public function testUpdateAndGetFormat($formName, $updateFormat, $updateLayout, $readFormat, $readLayout, $exampleName): void { Civi\Api4\Afform::revert()->addWhere('name', '=', $formName)->execute(); Civi\Api4\Afform::update() @@ -213,7 +213,7 @@ public function getWhitespaceExamples() { * * @dataProvider getWhitespaceExamples */ - public function testWhitespaceFormat($directiveName, $example, $exampleName) { + public function testWhitespaceFormat($directiveName, $example, $exampleName): void { Civi\Api4\Afform::save() ->addRecord(['name' => $directiveName, 'layout' => $example['html']]) ->setLayoutFormat('html') @@ -243,7 +243,7 @@ public function testWhitespaceFormat($directiveName, $example, $exampleName) { $this->assertEquals($example['pretty'], $this->fudgeMarkup($result['layout'])); } - public function testAutoRequires() { + public function testAutoRequires(): void { $formName = 'mockPage'; $this->createLoggedInUser(); diff --git a/ext/afform/mock/tests/phpunit/api/v4/AfformUsageTest.php b/ext/afform/mock/tests/phpunit/api/v4/AfformUsageTest.php index 152e55c96bb0..f13d6fa55d10 100644 --- a/ext/afform/mock/tests/phpunit/api/v4/AfformUsageTest.php +++ b/ext/afform/mock/tests/phpunit/api/v4/AfformUsageTest.php @@ -13,7 +13,7 @@ class api_v4_AfformUsageTest extends api_v4_AfformTestCase { protected $formName; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); self::$layouts['aboutMe'] = << @@ -26,12 +26,12 @@ public static function setUpBeforeClass() { EOHTML; } - public function setUp() { + public function setUp(): void { parent::setUp(); $this->formName = 'mock' . rand(0, 100000); } - public function tearDown() { + public function tearDown(): void { Civi\Api4\Afform::revert() ->setCheckPermissions(FALSE) ->addWhere('name', '=', $this->formName) @@ -39,7 +39,7 @@ public function tearDown() { parent::tearDown(); } - public function testAboutMeAllowed() { + public function testAboutMeAllowed(): void { $this->useValues([ 'layout' => self::$layouts['aboutMe'], 'permission' => CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION, @@ -71,7 +71,7 @@ public function testAboutMeAllowed() { $this->assertEquals('Lasty', $contact['last_name']); } - public function testAboutMeForbidden() { + public function testAboutMeForbidden(): void { $this->useValues([ 'layout' => self::$layouts['aboutMe'], 'permission' => CRM_Core_Permission::ALWAYS_DENY_PERMISSION, diff --git a/ext/authx/tests/phpunit/Civi/Authx/AllFlowsTest.php b/ext/authx/tests/phpunit/Civi/Authx/AllFlowsTest.php index eb6eff39b77b..e80108d70741 100644 --- a/ext/authx/tests/phpunit/Civi/Authx/AllFlowsTest.php +++ b/ext/authx/tests/phpunit/Civi/Authx/AllFlowsTest.php @@ -34,7 +34,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf */ protected $quirks = []; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { \Civi\Test::e2e() ->installMe(__DIR__) ->callback( @@ -46,7 +46,7 @@ function() { ->apply(); } - public function setUp() { + public function setUp(): void { $quirks = [ 'Joomla' => ['sendsExcessCookies', 'authErrorShowsForm'], 'WordPress' => ['sendsExcessCookies'], @@ -62,7 +62,7 @@ public function setUp() { } } - public function tearDown() { + public function tearDown(): void { foreach ($this->settingsBackup as $setting => $value) { \Civi::settings()->set($setting, $value); } @@ -91,7 +91,7 @@ public function getCredTypes() { return $exs; } - public function testAnonymous() { + public function testAnonymous(): void { $http = $this->createGuzzle(['http_errors' => FALSE]); /** @var \Psr\Http\Message\RequestInterface $request */ @@ -111,7 +111,7 @@ public function testAnonymous() { * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getStatelessExamples */ - public function testStatelessContactOnly($credType, $flowType) { + public function testStatelessContactOnly($credType, $flowType): void { if ($credType === 'pass') { $this->assertTrue(TRUE, 'No need to test password credentials with non-user contacts'); return; @@ -146,7 +146,7 @@ public function testStatelessContactOnly($credType, $flowType) { * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getStatelessExamples */ - public function testStatelessUserContact($credType, $flowType) { + public function testStatelessUserContact($credType, $flowType): void { $http = $this->createGuzzle(['http_errors' => FALSE]); /** @var \Psr\Http\Message\RequestInterface $request */ @@ -176,7 +176,7 @@ public function testStatelessUserContact($credType, $flowType) { * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getCredTypes */ - public function testStatefulLoginAllowed($credType) { + public function testStatefulLoginAllowed($credType): void { $flowType = 'login'; $credFunc = 'cred' . ucfirst(preg_replace(';[^a-zA-Z0-9];', '', $credType)); @@ -222,7 +222,7 @@ public function testStatefulLoginAllowed($credType) { * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getCredTypes */ - public function testStatefulLoginProhibited($credType) { + public function testStatefulLoginProhibited($credType): void { $flowType = 'login'; $http = $this->createGuzzle(['http_errors' => FALSE]); $credFunc = 'cred' . ucfirst(preg_replace(';[^a-zA-Z0-9];', '', $credType)); @@ -244,7 +244,7 @@ public function testStatefulLoginProhibited($credType) { * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getCredTypes */ - public function testStatefulAutoAllowed($credType) { + public function testStatefulAutoAllowed($credType): void { $flowType = 'auto'; $cookieJar = new CookieJar(); $http = $this->createGuzzle(['http_errors' => FALSE, 'cookies' => $cookieJar]); @@ -271,7 +271,7 @@ public function testStatefulAutoAllowed($credType) { * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getCredTypes */ - public function testStatefulAutoProhibited($credType) { + public function testStatefulAutoProhibited($credType): void { $flowType = 'auto'; $cookieJar = new CookieJar(); $http = $this->createGuzzle(['http_errors' => FALSE, 'cookies' => $cookieJar]); @@ -291,7 +291,7 @@ public function testStatefulAutoProhibited($credType) { * @throws \CiviCRM_API3_Exception * @throws \GuzzleHttp\Exception\GuzzleException */ - public function testStatefulStatelessOverlap() { + public function testStatefulStatelessOverlap(): void { \Civi::settings()->set("authx_login_cred", ['api_key']); \Civi::settings()->set("authx_header_cred", ['api_key']); @@ -329,7 +329,7 @@ public function testStatefulStatelessOverlap() { * @throws \CiviCRM_API3_Exception * @throws \GuzzleHttp\Exception\GuzzleException */ - public function testMultipleStateless() { + public function testMultipleStateless(): void { \Civi::settings()->set("authx_header_cred", ['api_key']); $cookieJar = new CookieJar(); $http = $this->createGuzzle(['http_errors' => FALSE, 'cookies' => $cookieJar]); @@ -417,7 +417,7 @@ public function requestMyContact() { * The expected user ID * @param \Psr\Http\Message\ResponseInterface $response */ - public function assertMyContact($cid, $uid, ResponseInterface $response) { + public function assertMyContact($cid, $uid, ResponseInterface $response): void { $this->assertContentType('application/json', $response); $this->assertStatusCode(200, $response); $j = json_decode((string) $response->getBody(), 1); @@ -431,7 +431,7 @@ public function assertMyContact($cid, $uid, ResponseInterface $response) { * * @param \Psr\Http\Message\ResponseInterface $response */ - public function assertAnonymousContact(ResponseInterface $response) { + public function assertAnonymousContact(ResponseInterface $response): void { $formattedFailure = $this->formatFailure($response); $this->assertContentType('application/json', $response); $this->assertStatusCode(200, $response); @@ -448,7 +448,7 @@ public function assertAnonymousContact(ResponseInterface $response) { * * @param \Psr\Http\Message\ResponseInterface $response */ - public function assertDashboardUnauthorized($response = NULL) { + public function assertDashboardUnauthorized($response = NULL): void { $response = $this->resolveResponse($response); if (!in_array('authErrorShowsForm', $this->quirks)) { $this->assertStatusCode(403, $response); @@ -459,7 +459,7 @@ public function assertDashboardUnauthorized($response = NULL) { ); } - public function assertDashboardOk($response = NULL) { + public function assertDashboardOk($response = NULL): void { $response = $this->resolveResponse($response); $this->assertStatusCode(200, $response); $this->assertContentType('text/html', $response); @@ -569,7 +569,7 @@ public function credNone($cid) { /** * @param \Psr\Http\Message\ResponseInterface $response */ - private function assertFailedDueToProhibition($response) { + private function assertFailedDueToProhibition($response): void { $this->assertBodyRegexp(';HTTP 401;', $response); $this->assertContentType('text/plain', $response); if (!in_array('sendsExcessCookies', $this->quirks)) { diff --git a/ext/ewaysingle/tests/phpunit/CRM/Core/Payment/EwayTest.php b/ext/ewaysingle/tests/phpunit/CRM/Core/Payment/EwayTest.php index 6591c5bb1676..de4ef3511c52 100644 --- a/ext/ewaysingle/tests/phpunit/CRM/Core/Payment/EwayTest.php +++ b/ext/ewaysingle/tests/phpunit/CRM/Core/Payment/EwayTest.php @@ -31,13 +31,13 @@ public function setUpHeadless() { ->apply(); } - public function setUp() { + public function setUp(): void { $this->setUpEwayProcessor(); $this->processor = \Civi\Payment\System::singleton()->getById($this->ids['PaymentProcessor']['eWAY']); parent::setUp(); } - public function tearDown() { + public function tearDown(): void { $this->callAPISuccess('PaymentProcessor', 'delete', ['id' => $this->ids['PaymentProcessor']['eWAY']]); parent::tearDown(); } @@ -45,7 +45,7 @@ public function tearDown() { /** * Test making a once off payment */ - public function testSinglePayment() { + public function testSinglePayment(): void { $this->setupMockHandler(); $params = $this->getBillingParams(); $params['amount'] = 10.00; @@ -69,7 +69,7 @@ public function testSinglePayment() { /** * Test making a failed once off payment */ - public function testErrorSinglePayment() { + public function testErrorSinglePayment(): void { $this->setupMockHandler(NULL, TRUE); $params = $this->getBillingParams(); $params['amount'] = 5.24; @@ -125,7 +125,7 @@ protected function getBillingParams(): array { ]; } - public function setUpEwayProcessor() { + public function setUpEwayProcessor(): void { $params = [ 'name' => 'demo', 'domain_id' => CRM_Core_Config::domainID(), @@ -164,7 +164,7 @@ public function setUpEwayProcessor() { * * @throws \CiviCRM_API3_Exception */ - protected function setupMockHandler($id = NULL, $error = FALSE) { + protected function setupMockHandler($id = NULL, $error = FALSE): void { if ($id) { $this->processor = Civi\Payment\System::singleton()->getById($id); } @@ -181,7 +181,7 @@ protected function setupMockHandler($id = NULL, $error = FALSE) { * * @return array */ - public function getExpectedSinglePaymentResponses() { + public function getExpectedSinglePaymentResponses(): array { return [ 'True10002xyz123456100000,Transaction Approved(Test Gateway)', ]; @@ -192,7 +192,7 @@ public function getExpectedSinglePaymentResponses() { * * @return array */ - public function getExpectedSinglePaymentRequests() { + public function getExpectedSinglePaymentRequests(): array { return [ '876543211000John O'Connor44443333222211111022xyzTest ContributionJohnO'Connorunittesteway@civicrm.org8 Hobbitton Road, The Shire, NSW.5010xyz123127.0.0.1AUS', ]; @@ -203,7 +203,7 @@ public function getExpectedSinglePaymentRequests() { * * @return array */ - public function getExpectedSinglePaymentErrorResponses() { + public function getExpectedSinglePaymentErrorResponses(): array { return [ 'False10003xyz12345652424,Do Not Honour(Test Gateway)', ]; diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/BuildAmountHookTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/BuildAmountHookTest.php index 1ef9435ff1bd..0c24979bc207 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/BuildAmountHookTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/BuildAmountHookTest.php @@ -19,7 +19,7 @@ class BuildAmountHookTest extends BaseTestClass { /** * Test api applies permissions on line item actions (delete & get). */ - public function testBuildAmount() { + public function testBuildAmount(): void { $priceSet = PriceSet::create()->setValues(['name' => 'test', 'title' => 'test', 'extends' => 'CiviMember'])->execute()->first(); PriceField::create()->setValues([ 'financial_type_id:name' => 'Donation', diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/LineItemTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/LineItemTest.php index 33db7de3424c..3f15b7ec0d79 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/LineItemTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/LineItemTest.php @@ -28,7 +28,7 @@ class LineItemTest extends BaseTestClass { * * @dataProvider versionThreeAndFour */ - public function testLineItemApiPermissions($version) { + public function testLineItemApiPermissions($version): void { $contact1 = $this->individualCreate(); $defaultPriceFieldID = $this->getDefaultPriceFieldID(); $order = $this->callAPISuccess('Order', 'create', [ diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php index 8e63eeeaa2c3..df71a02e3553 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php @@ -15,7 +15,7 @@ class MembershipTypesTest extends BaseTestClass { /** * Test buildMembershipTypes. */ - public function testMembershipTypesHook() { + public function testMembershipTypesHook(): void { $types = MembershipType::save(FALSE)->setRecords([ ['name' => 'Forbidden', 'financial_type_id:name' => 'Member Dues'], ['name' => 'Go for it', 'financial_type_id:name' => 'Donation'], diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/OptionsTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/OptionsTest.php index 1f9ab60309a9..2141178bc8b2 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/OptionsTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/OptionsTest.php @@ -13,7 +13,7 @@ class OptionsTest extends BaseTestClass { /** * Test buildMembershipTypes. */ - public function testBuildOptions() { + public function testBuildOptions(): void { $this->setupLoggedInUserWithLimitedFinancialTypeAccess(); $options = \CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(); $this->assertEquals(['Donation'], array_merge($options)); diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/HtmlClickTrackerTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/HtmlClickTrackerTest.php index a486daed2e2a..082e2c0f76ac 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/HtmlClickTrackerTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/HtmlClickTrackerTest.php @@ -19,7 +19,7 @@ */ class HtmlClickTrackerTest extends \CiviUnitTestCase { - public function setUp() { + public function setUp(): void { // Activate before transactions are setup. $manager = \CRM_Extension_System::singleton()->getManager(); if ($manager->getStatus('org.civicrm.flexmailer') !== \CRM_Extension_Manager::STATUS_INSTALLED) { @@ -79,7 +79,7 @@ public function getHrefExamples() { * @param $expectHtml * @dataProvider getHrefExamples */ - public function testReplaceHref($inputHtml, $expectHtml) { + public function testReplaceHref($inputHtml, $expectHtml): void { $actual = HtmlClickTracker::replaceHrefUrls($inputHtml, function($url) { return "tracking($url)"; }); diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/TextClickTrackerTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/TextClickTrackerTest.php index a99ac5473e98..64f8b7f8c08d 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/TextClickTrackerTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTracker/TextClickTrackerTest.php @@ -19,7 +19,7 @@ */ class TextClickTrackerTest extends \CiviUnitTestCase { - public function setUp() { + public function setUp(): void { // Activate before transactions are setup. $manager = \CRM_Extension_System::singleton()->getManager(); if ($manager->getStatus('org.civicrm.flexmailer') !== \CRM_Extension_Manager::STATUS_INSTALLED) { @@ -79,7 +79,7 @@ public function getHrefExamples() { * @param $expectHtml * @dataProvider getHrefExamples */ - public function testReplaceTextUrls($inputHtml, $expectHtml) { + public function testReplaceTextUrls($inputHtml, $expectHtml): void { $inputText = \CRM_Utils_String::htmlToText($inputHtml); $expectText = \CRM_Utils_String::htmlToText($expectHtml); $expectText = str_replace('/tracking', 'tracking', $expectText); diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTrackerTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTrackerTest.php index 1f723c5557c0..91a7af91e272 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTrackerTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ClickTrackerTest.php @@ -25,7 +25,7 @@ public function setUpHeadless() { ->apply(); } - public function setUp() { + public function setUp(): void { // Mock the getTrackerURL call; we don't need to test creating a row in a table. // If you want this to work without runkit, then either (a) make the dummy rows or (b) switch this to a hook/event that is runtime-configurable. require_once 'CRM/Mailing/BAO/TrackableURL.php'; @@ -34,7 +34,7 @@ public function setUp() { parent::setUp(); } - public function tearDown() { + public function tearDown(): void { // Reset the class. runkit7_method_remove('\CRM_Mailing_BAO_TrackableURL', 'getBasicTrackerURL'); runkit7_method_rename('\CRM_Mailing_BAO_TrackableURL', 'orig_getBasicTrackerURL', 'getBasicTrackerURL'); @@ -44,7 +44,7 @@ public function tearDown() { /** * Example: Test that a link without any tokens works. */ - public function testLinkWithoutTokens() { + public function testLinkWithoutTokens(): void { $filter = new TextClickTracker(); $msg = 'See this: https://example.com/foo/bar?a=b&c=d#frag'; $result = $filter->filterContent($msg, 1, 1); @@ -54,7 +54,7 @@ public function testLinkWithoutTokens() { /** * Example: Test that a link with tokens in the query works. */ - public function testLinkWithTokensInQueryWithStaticParams() { + public function testLinkWithTokensInQueryWithStaticParams(): void { $filter = new TextClickTracker(); $msg = 'See this: https://example.com/foo/bar?a=b&cid={contact.id}'; $result = $filter->filterContent($msg, 1, 1); @@ -64,7 +64,7 @@ public function testLinkWithTokensInQueryWithStaticParams() { /** * Example: Test that a link with tokens in the query works. */ - public function testLinkWithTokensInQueryWithMultipleStaticParams() { + public function testLinkWithTokensInQueryWithMultipleStaticParams(): void { $filter = new TextClickTracker(); $msg = 'See this: https://example.com/foo/bar?cs={contact.checksum}&a=b&cid={contact.id}'; $result = $filter->filterContent($msg, 1, 1); @@ -74,7 +74,7 @@ public function testLinkWithTokensInQueryWithMultipleStaticParams() { /** * Example: Test that a link with tokens in the query works. */ - public function testLinkWithTokensInQueryWithMultipleStaticParamsHtml() { + public function testLinkWithTokensInQueryWithMultipleStaticParamsHtml(): void { $filter = new HtmlClickTracker(); $msg = 'See this'; $result = $filter->filterContent($msg, 1, 1); @@ -84,7 +84,7 @@ public function testLinkWithTokensInQueryWithMultipleStaticParamsHtml() { /** * Example: Test that a link with tokens in the query works. */ - public function testLinkWithTokensInQueryWithoutStaticParams() { + public function testLinkWithTokensInQueryWithoutStaticParams(): void { $filter = new TextClickTracker(); $msg = 'See this: https://example.com/foo/bar?cid={contact.id}'; $result = $filter->filterContent($msg, 1, 1); @@ -97,7 +97,7 @@ public function testLinkWithTokensInQueryWithoutStaticParams() { * Seems browsers maintain the fragment when they receive a redirect, so a * token here might still work. */ - public function testLinkWithTokensInFragment() { + public function testLinkWithTokensInFragment(): void { $filter = new TextClickTracker(); $msg = 'See this: https://example.com/foo/bar?a=b#cid={contact.id}'; $result = $filter->filterContent($msg, 1, 1); @@ -110,7 +110,7 @@ public function testLinkWithTokensInFragment() { * Seems browsers maintain the fragment when they receive a redirect, so a * token here might still work. */ - public function testLinkWithTokensInQueryAndFragment() { + public function testLinkWithTokensInQueryAndFragment(): void { $filter = new TextClickTracker(); $msg = 'See this: https://example.com/foo/bar?a=b&cid={contact.id}#cid={contact.id}'; $result = $filter->filterContent($msg, 1, 1); @@ -120,7 +120,7 @@ public function testLinkWithTokensInQueryAndFragment() { /** * We can't handle tokens in the domain so it should not be tracked. */ - public function testLinkWithTokensInDomainFails() { + public function testLinkWithTokensInDomainFails(): void { $filter = new TextClickTracker(); $msg = 'See this: https://{some.domain}.com/foo/bar'; $result = $filter->filterContent($msg, 1, 1); @@ -130,7 +130,7 @@ public function testLinkWithTokensInDomainFails() { /** * We can't handle tokens in the path so it should not be tracked. */ - public function testLinkWithTokensInPathFails() { + public function testLinkWithTokensInPathFails(): void { $filter = new TextClickTracker(); $msg = 'See this: https://example.com/{some.path}'; $result = $filter->filterContent($msg, 1, 1); diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php index b68047122537..69a496fa6abf 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ConcurrentDeliveryTest.php @@ -33,7 +33,7 @@ */ class ConcurrentDeliveryTest extends \api_v3_JobProcessMailingTest { - public function setUp() { + public function setUp(): void { // Activate before transactions are setup. $manager = \CRM_Extension_System::singleton()->getManager(); if ($manager->getStatus('org.civicrm.flexmailer') !== \CRM_Extension_Manager::STATUS_INSTALLED) { @@ -45,7 +45,7 @@ public function setUp() { \Civi::settings()->set('flexmailer_traditional', 'flexmailer'); } - public function tearDown() { + public function tearDown(): void { // We're building on someone else's test and don't fully trust them to // protect our settings. Make sure they did. $ok = ('flexmailer' == \Civi::settings()->get('flexmailer_traditional')) @@ -65,11 +65,11 @@ public function tearDown() { * @dataProvider concurrencyExamples * @see _testConcurrencyCommon */ - public function testConcurrency($settings, $expectedTallies, $expectedTotal) { + public function testConcurrency($settings, $expectedTallies, $expectedTotal): void { parent::testConcurrency($settings, $expectedTallies, $expectedTotal); } - public function testBasic() { + public function testBasic(): void { parent::testBasic(); } diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/FlexMailerSystemTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/FlexMailerSystemTest.php index a5b7d5c2b20f..12e8d5e69a08 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/FlexMailerSystemTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/FlexMailerSystemTest.php @@ -39,7 +39,7 @@ class FlexMailerSystemTest extends \CRM_Mailing_BaseMailingSystemTest { private $counts; - public function setUp() { + public function setUp(): void { // Activate before transactions are setup. $manager = \CRM_Extension_System::singleton()->getManager(); if ($manager->getStatus('org.civicrm.flexmailer') !== \CRM_Extension_Manager::STATUS_INSTALLED) { @@ -80,7 +80,7 @@ public function hook_alterMailParams(&$params, $context = NULL) { $this->assertEquals('flexmailer', $context); } - public function tearDown() { + public function tearDown(): void { parent::tearDown(); $this->assertNotEmpty($this->counts['hook_alterMailParams']); foreach (FlexMailer::getEventTypes() as $event => $class) { @@ -106,7 +106,7 @@ public function testUrlTracking( $htmlUrlRegex, $textUrlRegex, $params - ) { + ): void { parent::testUrlTracking($inputHtml, $htmlUrlRegex, $textUrlRegex, $params); } @@ -132,19 +132,19 @@ public function urlTrackingExamples() { return $cases; } - public function testBasicHeaders() { + public function testBasicHeaders(): void { parent::testBasicHeaders(); } - public function testText() { + public function testText(): void { parent::testText(); } - public function testHtmlWithOpenTracking() { + public function testHtmlWithOpenTracking(): void { parent::testHtmlWithOpenTracking(); } - public function testHtmlWithOpenAndUrlTracking() { + public function testHtmlWithOpenAndUrlTracking(): void { parent::testHtmlWithOpenAndUrlTracking(); } diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/Listener/SimpleFilterTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/Listener/SimpleFilterTest.php index 8a0eba86356a..b7d4d7904f1d 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/Listener/SimpleFilterTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/Listener/SimpleFilterTest.php @@ -29,7 +29,7 @@ */ class SimpleFilterTest extends \CiviUnitTestCase { - public function setUp() { + public function setUp(): void { // Activate before transactions are setup. $manager = \CRM_Extension_System::singleton()->getManager(); if ($manager->getStatus('org.civicrm.flexmailer') !== \CRM_Extension_Manager::STATUS_INSTALLED) { @@ -42,7 +42,7 @@ public function setUp() { /** * Ensure that the utility `SimpleFilter::byValue()` correctly filters. */ - public function testByValue() { + public function testByValue(): void { $test = $this; list($tasks, $e) = $this->createExampleBatch(); @@ -63,7 +63,7 @@ public function testByValue() { /** * Ensure that the utility `SimpleFilter::byColumn()` correctly filters. */ - public function testByColumn() { + public function testByColumn(): void { $test = $this; list($tasks, $e) = $this->createExampleBatch(); diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/MailingPreviewTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/MailingPreviewTest.php index 32cdd1759784..a6fadbdc8c14 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/MailingPreviewTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/MailingPreviewTest.php @@ -21,7 +21,7 @@ class MailingPreviewTest extends \CiviUnitTestCase { */ protected $footer; - public function setUp() { + public function setUp(): void { // Activate before transactions are setup. $manager = \CRM_Extension_System::singleton()->getManager(); if ($manager->getStatus('org.civicrm.flexmailer') !== \CRM_Extension_Manager::STATUS_INSTALLED) { @@ -56,13 +56,13 @@ public function setUp() { )); } - public function tearDown() { + public function tearDown(): void { // DGW \CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0; parent::tearDown(); } - public function testMailerPreview() { + public function testMailerPreview(): void { // BEGIN SAMPLE DATA $contactID = $this->individualCreate(); $displayName = $this->callAPISuccess('contact', 'get', @@ -99,7 +99,7 @@ public function testMailerPreview() { $this->assertEquals('flexmailer', $previewResult['values']['_rendered_by_']); } - public function testMailerPreviewWithoutId() { + public function testMailerPreviewWithoutId(): void { // BEGIN SAMPLE DATA $contactID = $this->createLoggedInUser(); $displayName = $this->callAPISuccess('contact', 'get', ['id' => $contactID]); @@ -147,7 +147,7 @@ protected function getMaxIds() { * @param array $expectMaxIds * Array(string $table => int $maxId). */ - protected function assertMaxIds($expectMaxIds) { + protected function assertMaxIds($expectMaxIds): void { foreach ($expectMaxIds as $table => $maxId) { $this->assertDBQuery($expectMaxIds[$table], 'SELECT MAX(id) FROM ' . $table, [], "Table $table should have a maximum ID of $maxId"); } diff --git a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php index 3b5d9993488f..35541e5e6739 100644 --- a/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php +++ b/ext/flexmailer/tests/phpunit/Civi/FlexMailer/ValidatorTest.php @@ -17,7 +17,7 @@ */ class ValidatorTest extends \CiviUnitTestCase { - public function setUp() { + public function setUp(): void { // Activate before transactions are setup. $manager = \CRM_Extension_System::singleton()->getManager(); if ($manager->getStatus('org.civicrm.flexmailer') !== \CRM_Extension_Manager::STATUS_INSTALLED) { @@ -85,7 +85,7 @@ public function getExamples() { * @param array $expectedErrors * @dataProvider getExamples */ - public function testExamples($mailingData, $expectedErrors) { + public function testExamples($mailingData, $expectedErrors): void { $mailing = new \CRM_Mailing_DAO_Mailing(); $mailing->copyValues($mailingData); $actualErrors = Validator::createAndRun($mailing); diff --git a/ext/oauth-client/tests/phpunit/CRM/OAuth/MailSetupTest.php b/ext/oauth-client/tests/phpunit/CRM/OAuth/MailSetupTest.php index 06ee4b8c20a4..d5f8e9a858e5 100644 --- a/ext/oauth-client/tests/phpunit/CRM/OAuth/MailSetupTest.php +++ b/ext/oauth-client/tests/phpunit/CRM/OAuth/MailSetupTest.php @@ -18,15 +18,15 @@ public function setUpHeadless() { return \Civi\Test::headless()->install('oauth-client')->apply(); } - public function setUp() { + public function setUp(): void { parent::setUp(); } - public function tearDown() { + public function tearDown(): void { parent::tearDown(); } - public function testEvalArrayTemplate() { + public function testEvalArrayTemplate(): void { $vars = array( 'token' => [ 'client_id' => 10, diff --git a/ext/oauth-client/tests/phpunit/api/v4/OAuthClientGrantTest.php b/ext/oauth-client/tests/phpunit/api/v4/OAuthClientGrantTest.php index 9cc4a1fe8269..a678726d491b 100644 --- a/ext/oauth-client/tests/phpunit/api/v4/OAuthClientGrantTest.php +++ b/ext/oauth-client/tests/phpunit/api/v4/OAuthClientGrantTest.php @@ -18,19 +18,19 @@ public function setUpHeadless() { return \Civi\Test::headless()->install('oauth-client')->apply(); } - public function setUp() { + public function setUp(): void { parent::setUp(); $this->assertEquals(0, CRM_Core_DAO::singleValueQuery('SELECT count(*) FROM civicrm_oauth_client')); } - public function tearDown() { + public function tearDown(): void { parent::tearDown(); } /** * Basic sanity check - create, read, and delete a client. */ - public function testAuthorizationCode() { + public function testAuthorizationCode(): void { $usePerms = function($ps) { $base = ['access CiviCRM']; \CRM_Core_Config::singleton()->userPermissionClass->permissions = array_merge($base, $ps); diff --git a/ext/oauth-client/tests/phpunit/api/v4/OAuthClientTest.php b/ext/oauth-client/tests/phpunit/api/v4/OAuthClientTest.php index d4107ea386e0..34ec0a09730e 100644 --- a/ext/oauth-client/tests/phpunit/api/v4/OAuthClientTest.php +++ b/ext/oauth-client/tests/phpunit/api/v4/OAuthClientTest.php @@ -18,19 +18,19 @@ public function setUpHeadless() { return \Civi\Test::headless()->install('oauth-client')->apply(); } - public function setUp() { + public function setUp(): void { parent::setUp(); $this->assertEquals(0, CRM_Core_DAO::singleValueQuery('SELECT count(*) FROM civicrm_oauth_client')); } - public function tearDown() { + public function tearDown(): void { parent::tearDown(); } /** * Basic sanity check - create, read, and delete a client. */ - public function testBasic() { + public function testBasic(): void { $random = CRM_Utils_String::createRandom(16, CRM_Utils_String::ALPHANUMERIC); $usePerms = function($ps) { $base = ['access CiviCRM']; @@ -83,7 +83,7 @@ public function testCreateBadProvider() { } } - public function testUpdateBadProvider() { + public function testUpdateBadProvider(): void { $random = CRM_Utils_String::createRandom(16, CRM_Utils_String::ALPHANUMERIC); $usePerms = function($ps) { $base = ['access CiviCRM']; diff --git a/ext/oauth-client/tests/phpunit/api/v4/OAuthProviderTest.php b/ext/oauth-client/tests/phpunit/api/v4/OAuthProviderTest.php index a7f54e880e43..2643fc9284d5 100644 --- a/ext/oauth-client/tests/phpunit/api/v4/OAuthProviderTest.php +++ b/ext/oauth-client/tests/phpunit/api/v4/OAuthProviderTest.php @@ -17,18 +17,18 @@ public function setUpHeadless() { return \Civi\Test::headless()->install('oauth-client')->apply(); } - public function setUp() { + public function setUp(): void { parent::setUp(); } - public function tearDown() { + public function tearDown(): void { parent::tearDown(); } /** * Create, read, and destroy token - with full access to secrets. */ - public function testGet() { + public function testGet(): void { \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM']; $examples = Civi\Api4\OAuthProvider::get() diff --git a/ext/oauth-client/tests/phpunit/api/v4/OAuthSysTokenTest.php b/ext/oauth-client/tests/phpunit/api/v4/OAuthSysTokenTest.php index 43b20790bba2..bcd061413854 100644 --- a/ext/oauth-client/tests/phpunit/api/v4/OAuthSysTokenTest.php +++ b/ext/oauth-client/tests/phpunit/api/v4/OAuthSysTokenTest.php @@ -18,20 +18,20 @@ public function setUpHeadless() { return \Civi\Test::headless()->install('oauth-client')->apply(); } - public function setUp() { + public function setUp(): void { parent::setUp(); $this->assertEquals(0, CRM_Core_DAO::singleValueQuery('SELECT count(*) FROM civicrm_oauth_client')); $this->assertEquals(0, CRM_Core_DAO::singleValueQuery('SELECT count(*) FROM civicrm_oauth_systoken')); } - public function tearDown() { + public function tearDown(): void { parent::tearDown(); } /** * Create, read, and destroy token - with full access to secrets. */ - public function testFullApiAccess() { + public function testFullApiAccess(): void { $random = CRM_Utils_String::createRandom(16, CRM_Utils_String::ALPHANUMERIC); $usePerms = function($ps) { $base = ['access CiviCRM']; @@ -86,7 +86,7 @@ public function testFullApiAccess() { /** * Create, read, and destroy a token - with limited API access (cannot access token secrets). */ - public function testLimitedApiAccess() { + public function testLimitedApiAccess(): void { $random = CRM_Utils_String::createRandom(16, CRM_Utils_String::ALPHANUMERIC); $usePerms = function($ps) { $base = ['access CiviCRM']; @@ -159,7 +159,7 @@ public function testLimitedApiAccess() { $this->assertEquals("example-refresh-token-$random", $token['refresh_token']); } - public function testGetByScope() { + public function testGetByScope(): void { $random = CRM_Utils_String::createRandom(16, CRM_Utils_String::ALPHANUMERIC); $usePerms = function($ps) { $base = ['access CiviCRM']; diff --git a/ext/sequentialcreditnotes/tests/phpunit/SequentialcreditnotesTest.php b/ext/sequentialcreditnotes/tests/phpunit/SequentialcreditnotesTest.php index 507b39a92182..58bda954fdbc 100644 --- a/ext/sequentialcreditnotes/tests/phpunit/SequentialcreditnotesTest.php +++ b/ext/sequentialcreditnotes/tests/phpunit/SequentialcreditnotesTest.php @@ -45,7 +45,7 @@ public function setUpHeadless(): \Civi\Test\CiviEnvBuilder { * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception */ - public function testCreateCreditNoteId() { + public function testCreateCreditNoteId(): void { $this->_apiversion = 4; $contactId = $this->callAPISuccess('Contact', 'create', ['contact_type' => 'Individual', 'email' => 'b@example.com'])['id'];