Description: Adapt unit tests so that they can run on Debian systems
Forwarded: not-needed
Author: Fab Stz <fabstz-it@yahoo.fr>
Last-Update: 2022-11-05

--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -32,6 +32,14 @@
 	class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper');
 }
 
+if ( ! class_exists('vfsStream') && file_exists('/usr/share/php/org/bovigo/vfs/autoload.php'))
+{
+	include_once '/usr/share/php/org/bovigo/vfs/autoload.php';
+	class_alias('org\bovigo\vfs\vfsStream', 'vfsStream');
+	class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory');
+	class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper');
+}
+
 // Define CI path constants to VFS (filesystem setup in CI_TestCase::setUp)
 defined('BASEPATH') OR define('BASEPATH', vfsStream::url('system/'));
 defined('APPPATH') OR define('APPPATH', vfsStream::url('application/'));
@@ -72,9 +80,9 @@
 
 if (is_php('7.0'))
 {
-	$test_case_code = file_get_contents(PROJECT_BASE.'vendor/phpunit/phpunit/src/Framework/TestCase.php');
-	$test_case_code = preg_replace('/^\s+((?:protected|public)(?: static)? function \w+\(\)): void/m', '$1', $test_case_code);
-	file_put_contents(PROJECT_BASE.'vendor/phpunit/phpunit/src/Framework/TestCase.php', $test_case_code);
+	//$test_case_code = file_get_contents('/usr/share/php/PHPUnit/Framework/TestCase.php');
+	//$test_case_code = preg_replace('/^\s+((?:protected|public)(?: static)? function \w+\(\)): void/m', '$1', $test_case_code);
+	//file_put_contents('/usr/share/php/PHPUnit/Framework/TestCase.php', $test_case_code);
 }
 
 include_once SYSTEM_PATH.'core/compat/mbstring.php';
--- a/tests/codeigniter/helpers/security_helper_test.php
+++ b/tests/codeigniter/helpers/security_helper_test.php
@@ -2,7 +2,7 @@
 
 class Security_helper_tests extends CI_TestCase {
 
-	function setUp()
+	function setUp(): void
 	{
 		$this->helper('security');
 		$obj = new stdClass;
--- a/tests/mocks/ci_testcase.php
+++ b/tests/mocks/ci_testcase.php
@@ -32,7 +32,7 @@
 
 	// --------------------------------------------------------------------
 
-	public function setUp()
+	public function setUp(): void
 	{
 		// Setup VFS with base directories
 		$this->ci_vfs_root = vfsStream::setup('');
@@ -48,7 +48,7 @@
 
 	// --------------------------------------------------------------------
 
-	public function tearDown()
+	public function tearDown(): void
 	{
 		if (method_exists($this, 'tear_down'))
 		{
@@ -345,7 +345,7 @@
 	 * happen in setUp, but someone is bound to forget to
 	 * call the parent method and debugging this is no fun.
 	 */
-	public function runBare()
+	public function runBare(): void
 	{
 		self::$ci_test_instance = $this;
 		parent::runBare();
