From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Thu, 6 Mar 2025 13:54:54 +0100
Subject: Modernize PHPUnit syntax

---
 tests/ReCaptcha/ReCaptchaTest.php                | 7 +++----
 tests/ReCaptcha/RequestMethod/SocketPostTest.php | 6 +++---
 tests/ReCaptcha/RequestParametersTest.php        | 9 +++------
 tests/ReCaptcha/ResponseTest.php                 | 5 ++---
 4 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/tests/ReCaptcha/ReCaptchaTest.php b/tests/ReCaptcha/ReCaptchaTest.php
index 886d187..cc5bb03 100644
--- a/tests/ReCaptcha/ReCaptchaTest.php
+++ b/tests/ReCaptcha/ReCaptchaTest.php
@@ -34,13 +34,12 @@
 
 namespace ReCaptcha;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 class ReCaptchaTest extends TestCase
 {
-    /**
-     * @dataProvider invalidSecretProvider
-     */
+    #[DataProvider('invalidSecretProvider')]
     public function testExceptionThrownOnInvalidSecret($invalid)
     {
         $this->expectException(\RuntimeException::class);
@@ -76,7 +75,7 @@ class ReCaptchaTest extends TestCase
             ->with($this->callback(function ($params) {
                 return true;
             }))
-            ->will($this->returnValue($responseJson));
+            ->willReturn($responseJson);
         return $method;
     }
 
diff --git a/tests/ReCaptcha/RequestMethod/SocketPostTest.php b/tests/ReCaptcha/RequestMethod/SocketPostTest.php
index 9becf70..f927b4f 100644
--- a/tests/ReCaptcha/RequestMethod/SocketPostTest.php
+++ b/tests/ReCaptcha/RequestMethod/SocketPostTest.php
@@ -55,7 +55,7 @@ class SocketPostTest extends TestCase
                 ->willReturn("HTTP/1.0 200 OK\n\nRESPONSEBODY");
         $socket->expects($this->exactly(2))
                 ->method('feof')
-                ->will($this->onConsecutiveCalls(false, true));
+                ->willReturn(false, true);
         $socket->expects($this->once())
                 ->method('fclose')
                 ->willReturn(true);
@@ -82,7 +82,7 @@ class SocketPostTest extends TestCase
                 ->willReturn("HTTP/1.0 200 OK\n\nRESPONSEBODY");
         $socket->expects($this->exactly(2))
                 ->method('feof')
-                ->will($this->onConsecutiveCalls(false, true));
+                ->willReturn(false, true);
         $socket->expects($this->once())
                 ->method('fclose')
                 ->willReturn(true);
@@ -107,7 +107,7 @@ class SocketPostTest extends TestCase
                 ->willReturn("HTTP/1.0 500 NOPEn\\nBOBBINS");
         $socket->expects($this->exactly(2))
                 ->method('feof')
-                ->will($this->onConsecutiveCalls(false, true));
+                ->willReturn(false, true);
         $socket->expects($this->once())
                 ->method('fclose')
                 ->willReturn(true);
diff --git a/tests/ReCaptcha/RequestParametersTest.php b/tests/ReCaptcha/RequestParametersTest.php
index 84f45c4..c8c7b38 100644
--- a/tests/ReCaptcha/RequestParametersTest.php
+++ b/tests/ReCaptcha/RequestParametersTest.php
@@ -34,6 +34,7 @@
 
 namespace ReCaptcha;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 class RequestParametersTest extends Testcase
@@ -50,18 +51,14 @@ class RequestParametersTest extends Testcase
         );
     }
 
-    /**
-     * @dataProvider provideValidData
-     */
+    #[DataProvider('provideValidData')]
     public function testToArray($secret, $response, $remoteIp, $version, $expectedArray, $expectedQuery)
     {
         $params = new RequestParameters($secret, $response, $remoteIp, $version);
         $this->assertEquals($params->toArray(), $expectedArray);
     }
 
-    /**
-     * @dataProvider provideValidData
-     */
+    #[DataProvider('provideValidData')]
     public function testToQueryString($secret, $response, $remoteIp, $version, $expectedArray, $expectedQuery)
     {
         $params = new RequestParameters($secret, $response, $remoteIp, $version);
diff --git a/tests/ReCaptcha/ResponseTest.php b/tests/ReCaptcha/ResponseTest.php
index 13092d2..841d833 100644
--- a/tests/ReCaptcha/ResponseTest.php
+++ b/tests/ReCaptcha/ResponseTest.php
@@ -34,13 +34,12 @@
 
 namespace ReCaptcha;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 class ResponseTest extends TestCase
 {
-    /**
-     * @dataProvider provideJson
-     */
+    #[DataProvider('provideJson')]
     public function testFromJson($json, $success, $errorCodes, $hostname, $challengeTs, $apkPackageName, $score, $action)
     {
         $response = Response::fromJson($json);
