File: 01-debian-unit_tests.patch

package info (click to toggle)
php-codeigniter-framework 3.1.13%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,228 kB
  • sloc: php: 37,178; xml: 205; makefile: 138; python: 66; sh: 65
file content (75 lines) | stat: -rw-r--r-- 2,700 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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();