summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortenzap <fabstz-it@yahoo.fr>2022-11-10 21:54:35 +0100
committertenzap <fabstz-it@yahoo.fr>2022-11-10 21:54:38 +0100
commit517b9aec99df26283d283c6fa9793b64c1188332 (patch)
tree5b2f6a797da1bb9630ba73ea828a5fdfb4d19fbc
parentca889b00ef4d561b181e1df383b91c1f28e3501f (diff)
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'.
-rw-r--r--tests/codeigniter/core/Security_test.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php
index 5132e5887..4d76f4265 100644
--- a/tests/codeigniter/core/Security_test.php
+++ b/tests/codeigniter/core/Security_test.php
@@ -253,9 +253,9 @@ class Security_test extends CI_TestCase {
// 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);
}