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'));
 
