File: 0005-Change-setMethods-to-addMethods-onlyMethods.patch

package info (click to toggle)
php-slim 3.12.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,368 kB
  • sloc: php: 11,581; makefile: 18; xml: 10; sh: 3
file content (123 lines) | stat: -rw-r--r-- 5,897 bytes parent folder | download
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
112
113
114
115
116
117
118
119
120
121
122
123
From: James Valleroy <jvalleroy@mailbox.org>
Date: Mon, 18 Nov 2024 13:14:15 -0500
Subject: Change setMethods to addMethods/onlyMethods

---
 tests/AppTest.php                 | 4 ++--
 tests/ContainerTest.php           | 2 +-
 tests/DeferredCallableTest.php    | 2 +-
 tests/Handlers/ErrorTest.php      | 4 ++--
 tests/Handlers/NotAllowedTest.php | 2 +-
 tests/Handlers/NotFoundTest.php   | 2 +-
 tests/Handlers/PhpErrorTest.php   | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/AppTest.php b/tests/AppTest.php
index 9e0f038..1142b2c 100644
--- a/tests/AppTest.php
+++ b/tests/AppTest.php
@@ -1614,7 +1614,7 @@ class AppTest extends PHPUnit\Framework\TestCase
         $req = new Request('GET', $uri, $headers, $cookies, $serverParams, $body);
         $res = new Response();
 
-        $mock = $this->getMockBuilder('StdClass')->setMethods(['bar'])->getMock();
+        $mock = $this->getMockBuilder('StdClass')->addMethods(['bar'])->getMock();
 
         $app = new App();
         $container = $app->getContainer();
@@ -2083,7 +2083,7 @@ class AppTest extends PHPUnit\Framework\TestCase
         $body_stream = fopen('php://temp', 'r+');
         $response = new Response();
         $body = $this->getMockBuilder("\Slim\Http\Body")
-            ->setMethods(["getSize"])
+            ->onlyMethods(["getSize"])
             ->setConstructorArgs([$body_stream])
             ->getMock();
         fwrite($body_stream, "Hello");
diff --git a/tests/ContainerTest.php b/tests/ContainerTest.php
index bfadb57..d5d3c7b 100644
--- a/tests/ContainerTest.php
+++ b/tests/ContainerTest.php
@@ -73,7 +73,7 @@ class ContainerTest extends PHPUnit\Framework\TestCase
     public function testGetWithErrorThrownByFactoryClosure()
     {
         $this->expectException('InvalidArgumentException');
-        $invokable = $this->getMockBuilder('StdClass')->setMethods(['__invoke'])->getMock();
+        $invokable = $this->getMockBuilder('StdClass')->addMethods(['__invoke'])->getMock();
         /** @var callable $invokable */
         $invokable->expects($this->any())
             ->method('__invoke')
diff --git a/tests/DeferredCallableTest.php b/tests/DeferredCallableTest.php
index 453d482..4689fb4 100644
--- a/tests/DeferredCallableTest.php
+++ b/tests/DeferredCallableTest.php
@@ -27,7 +27,7 @@ class DeferredCallableTest extends PHPUnit\Framework\TestCase
 
     public function testItBindsClosuresToContainer()
     {
-        $assertCalled = $this->getMockBuilder('StdClass')->setMethods(['foo'])->getMock();
+        $assertCalled = $this->getMockBuilder('StdClass')->addMethods(['foo'])->getMock();
         $assertCalled
             ->expects($this->once())
             ->method('foo');
diff --git a/tests/Handlers/ErrorTest.php b/tests/Handlers/ErrorTest.php
index 055a5f1..b1b90bc 100644
--- a/tests/Handlers/ErrorTest.php
+++ b/tests/Handlers/ErrorTest.php
@@ -70,7 +70,7 @@ class ErrorTest extends PHPUnit\Framework\TestCase
     public function testNotFoundContentType()
     {
         $this->expectException('UnexpectedValueException');
-        $errorMock = $this->getMockBuilder(Error::class)->setMethods(['determineContentType'])->getMock();
+        $errorMock = $this->getMockBuilder(Error::class)->onlyMethods(['determineContentType'])->getMock();
         $errorMock->method('determineContentType')
             ->will($this->returnValue('unknown/type'));
 
@@ -87,7 +87,7 @@ class ErrorTest extends PHPUnit\Framework\TestCase
      */
     public function testPreviousException()
     {
-        $error = $this->getMockBuilder('\Slim\Handlers\Error')->setMethods(['logError'])->getMock();
+        $error = $this->getMockBuilder('\Slim\Handlers\Error')->onlyMethods(['logError'])->getMock();
         $error->expects($this->once())->method('logError')->with(
             $this->logicalAnd(
                 $this->stringContains("Type: Exception" . PHP_EOL . "Message: Second Oops"),
diff --git a/tests/Handlers/NotAllowedTest.php b/tests/Handlers/NotAllowedTest.php
index 6c50b2f..7c3800c 100644
--- a/tests/Handlers/NotAllowedTest.php
+++ b/tests/Handlers/NotAllowedTest.php
@@ -60,7 +60,7 @@ class NotAllowedTest extends PHPUnit\Framework\TestCase
 
     public function testNotFoundContentType()
     {
-        $errorMock = $this->getMockBuilder(NotAllowed::class)->setMethods(['determineContentType'])->getMock();
+        $errorMock = $this->getMockBuilder(NotAllowed::class)->onlyMethods(['determineContentType'])->getMock();
         $errorMock->method('determineContentType')
             ->will($this->returnValue('unknown/type'));
 
diff --git a/tests/Handlers/NotFoundTest.php b/tests/Handlers/NotFoundTest.php
index 9e4c652..f364eb3 100644
--- a/tests/Handlers/NotFoundTest.php
+++ b/tests/Handlers/NotFoundTest.php
@@ -47,7 +47,7 @@ class NotFoundTest extends PHPUnit\Framework\TestCase
 
     public function testNotFoundContentType()
     {
-        $errorMock = $this->getMockBuilder(NotFound::class)->setMethods(['determineContentType'])->getMock();
+        $errorMock = $this->getMockBuilder(NotFound::class)->onlyMethods(['determineContentType'])->getMock();
         $errorMock->method('determineContentType')
             ->will($this->returnValue('unknown/type'));
 
diff --git a/tests/Handlers/PhpErrorTest.php b/tests/Handlers/PhpErrorTest.php
index 768e5ed..4dcbdb0 100644
--- a/tests/Handlers/PhpErrorTest.php
+++ b/tests/Handlers/PhpErrorTest.php
@@ -73,7 +73,7 @@ class PhpErrorTest extends PHPUnit\Framework\TestCase
      */
     public function testNotFoundContentType()
     {
-        $errorMock = $this->getMockBuilder(PhpError::class)->setMethods(['determineContentType'])->getMock();
+        $errorMock = $this->getMockBuilder(PhpError::class)->onlyMethods(['determineContentType'])->getMock();
         $errorMock->method('determineContentType')
             ->will($this->returnValue('unknown/type'));