From 35b19c481e79d2722e4088139b679cf8cda20b55 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 20 Dec 2021 20:13:35 -0800 Subject: [PATCH] HookTest - Fix execution on PHP 8 Before ------ Test fails on PHP 8 ``` CiviWP\HookTest::testFoo Undefined array key "hook_was_called" /home/jenkins/bknix-dfl/build/wp-265-47vsb/web/wp-content/plugins/civicrm/tests/phpunit/CiviWP/HookTest.php:22 ``` After ----- Test passes Comments -------- This is a superficial change - the point of the assertion is to validate the starting circumstance (asserting that the hook has not yet run). This is just a cleaner assertion that the hook has not yet run. --- tests/phpunit/CiviWP/HookTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/CiviWP/HookTest.php b/tests/phpunit/CiviWP/HookTest.php index bffafe5..ad77843 100644 --- a/tests/phpunit/CiviWP/HookTest.php +++ b/tests/phpunit/CiviWP/HookTest.php @@ -19,7 +19,7 @@ public function testFoo(): void { 'foo' => 123, ); $this->assertNotEquals($arg2['foo'], 456); - $this->assertNotEquals($arg2['hook_was_called'], 1); + $this->assertFalse(isset($arg2['hook_was_called'])); \CRM_Utils_Hook::singleton() ->invoke( 2,