From 517b9aec99df26283d283c6fa9793b64c1188332 Mon Sep 17 00:00:00 2001
From: tenzap <fabstz-it@yahoo.fr>
Date: Thu, 10 Nov 2022 21:54:35 +0100
Subject: [PATCH] Adapt unit tests so as not to fail with PHPUnit 8.5

When the phpunit tests are run with phpunit 8.5, they will fail because
the test would call assertMatchesRegularExpression which doesn't exists in
that version.

So check the existence of the method instead of checking the class
'PHPUnit_Runner_Version'.
---
 tests/codeigniter/core/Security_test.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/tests/codeigniter/core/Security_test.php
+++ b/tests/codeigniter/core/Security_test.php
@@ -252,9 +252,9 @@
 		// Perform hash
 		$this->security->xss_hash();
 
-		$assertRegExp = class_exists('PHPUnit_Runner_Version')
-			? 'assertRegExp'
-			: 'assertMatchesRegularExpression';
+		$assertRegExp = method_exists($this, 'assertMatchesRegularExpression')
+			? 'assertMatchesRegularExpression'
+			: 'assertRegExp';
 		$this->$assertRegExp('#^[0-9a-f]{32}$#iS', $this->security->xss_hash);
 	}
 
