File: 0005-fix-error-with-phpunit10-undefined-method-setMethods.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 (111 lines) | stat: -rw-r--r-- 5,237 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From 0c52aa93ee29d4f175d3714414c6c581153fd8bc Mon Sep 17 00:00:00 2001
From: tenzap <fabstz-it@yahoo.fr>
Date: Mon, 19 Jun 2023 20:21:54 +0200
Subject: [PATCH 5/8] fix error with phpunit10 (undefined method setMethods())

 Was removed in phpunit10

 Error: Call to undefined method PHPUnit\Framework\MockObject\MockBuilder::setMethods()
---
 tests/codeigniter/core/Loader_test.php               | 4 ++--
 tests/codeigniter/helpers/language_helper_test.php   | 2 +-
 tests/codeigniter/helpers/number_helper_test.php     | 2 +-
 tests/codeigniter/libraries/Calendar_test.php        | 4 ++--
 tests/codeigniter/libraries/Driver_test.php          | 2 +-
 tests/codeigniter/libraries/Form_validation_test.php | 4 ++--
 tests/codeigniter/libraries/Upload_test.php          | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

--- a/tests/codeigniter/core/Loader_test.php
+++ b/tests/codeigniter/core/Loader_test.php
@@ -299,7 +299,7 @@
 		$this->assertEquals($content.$value, $out);
 
 		// Mock output class
-		$output = $this->getMockBuilder('CI_Output')->setMethods(array('append_output'))->getMock();
+		$output = $this->getMockBuilder('CI_Output')->onlyMethods(array('append_output'))->getMock();
 		$output->expects($this->once())->method('append_output')->with($content.$value);
 		$this->ci_instance_var('output', $output);
 
@@ -451,7 +451,7 @@
 	{
 		// Mock lang class and test load call
 		$file = 'test';
-		$lang = $this->getMockBuilder('CI_Lang')->setMethods(array('load'))->getMock();
+		$lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('load'))->getMock();
 		$lang->expects($this->once())->method('load')->with($file);
 		$this->ci_instance_var('lang', $lang);
 		$this->assertInstanceOf('CI_Loader', $this->load->language($file));
--- a/tests/codeigniter/helpers/language_helper_test.php
+++ b/tests/codeigniter/helpers/language_helper_test.php
@@ -5,7 +5,7 @@
 	public function test_lang()
 	{
 		$this->helper('language');
-		$lang = $this->getMockBuilder('CI_Lang')->setMethods(array('line'))->getMock();
+		$lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('line'))->getMock();
 		$lang->expects($this->any())->method('line')->will($this->returnValue(FALSE));
 		$this->ci_instance_var('lang', $lang);
 
--- a/tests/codeigniter/helpers/number_helper_test.php
+++ b/tests/codeigniter/helpers/number_helper_test.php
@@ -11,7 +11,7 @@
 
 		// Mock away load, too much going on in there,
 		// we'll just check for the expected parameter
-		$lang = $this->getMockBuilder('CI_Lang')->setMethods(array('load'))->getMock();
+		$lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('load'))->getMock();
 		$lang->expects($this->once())
 			 ->method('load')
 			 ->with($this->equalTo('number'));
--- a/tests/codeigniter/libraries/Calendar_test.php
+++ b/tests/codeigniter/libraries/Calendar_test.php
@@ -5,9 +5,9 @@
 	public function set_up()
 	{
 		// Required for get_total_days()
-		$this->ci_instance_var('load', $this->getMockBuilder('CI_Loader')->setMethods(array('helper'))->getMock());
+		$this->ci_instance_var('load', $this->getMockBuilder('CI_Loader')->onlyMethods(array('helper'))->getMock());
 
-		$lang = $this->getMockBuilder('CI_Lang')->setMethods(array('load', 'line'))->getMock();
+		$lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('load', 'line'))->getMock();
 		$lang->expects($this->any())->method('line')->will($this->returnValue(FALSE));
 		$this->ci_instance_var('lang', $lang);
 
--- a/tests/codeigniter/libraries/Driver_test.php
+++ b/tests/codeigniter/libraries/Driver_test.php
@@ -18,7 +18,7 @@
 
 		// Mock Loader->get_package_paths
 		$paths = 'get_package_paths';
-		$ldr = $this->getMockBuilder('CI_Loader')->setMethods(array($paths))->getMock();
+		$ldr = $this->getMockBuilder('CI_Loader')->onlyMethods(array($paths))->getMock();
 		$ldr->expects($this->any())->method($paths)->will($this->returnValue(array(APPPATH, BASEPATH)));
 		$this->ci_instance_var('load', $ldr);
 
--- a/tests/codeigniter/libraries/Form_validation_test.php
+++ b/tests/codeigniter/libraries/Form_validation_test.php
@@ -8,10 +8,10 @@
 
 		// Create a mock loader since load->helper() looks in the wrong directories for unit tests,
 		// We'll use CI_TestCase->helper() instead
-		$loader = $this->getMockBuilder('CI_Loader')->setMethods(array('helper'))->getMock();
+		$loader = $this->getMockBuilder('CI_Loader')->onlyMethods(array('helper'))->getMock();
 
 		// Same applies for lang
-		$lang = $this->getMockBuilder('CI_Lang')->setMethods(array('load'))->getMock();
+		$lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('load'))->getMock();
 
 		$this->ci_set_config('charset', 'UTF-8');
 		$utf8 = new Mock_Core_Utf8();
--- a/tests/codeigniter/libraries/Upload_test.php
+++ b/tests/codeigniter/libraries/Upload_test.php
@@ -7,7 +7,7 @@
 		$ci = $this->ci_instance();
 		$ci->upload = new CI_Upload();
 		$ci->security = new Mock_Core_Security();
-		$ci->lang = $this->getMockBuilder('CI_Lang')->setMethods(array('load', 'line'))->getMock();
+		$ci->lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('load', 'line'))->getMock();
 		$ci->lang->expects($this->any())->method('line')->will($this->returnValue(FALSE));
 		$this->upload = $ci->upload;
 	}