Control: tag -1 patch

Le Sat, Dec 26, 2020 at 11:02:04PM +0100, Lucas Nussbaum a écrit :

> Relevant part (hopefully):
[…]
> > There were 6 errors:
> > 
> > 1) ReCaptcha\ReCaptchaTest::testExceptionThrownOnInvalidSecret with data 
> > set #0 ('')
> > RuntimeException: No secret provided
[…]
> > 6) ReCaptcha\RequestMethod\PostTest::testHTTPContextOptions
> > TypeError: Argument 2 passed to PHPUnit\Framework\Assert::assertContains() 
> > must be iterable, string given, called in 
> > /<<PKGBUILDDIR>>/tests/ReCaptcha/RequestMethod/PostTest.php on line 118

Please find attached a patch fixing these issues (that were already
warnings with PHPUnit 8).

I wonder why this failure wasn’t caught sooner by the autopkgtest (or I
would have noticed it before pushing PHPUnit 9 to unstable).

Regards

David
From: =?utf-8?q?David_Pr=C3=A9vot?= <taf...@debian.org>
Date: Tue, 29 Dec 2020 22:51:55 -0400
Subject: Adapt to recent version of PHPUnit (9)

Bug-Debian: https://bugs.debian.org/978381
---
 tests/ReCaptcha/ReCaptchaTest.php          | 2 +-
 tests/ReCaptcha/RequestMethod/PostTest.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ReCaptcha/ReCaptchaTest.php b/tests/ReCaptcha/ReCaptchaTest.php
index ddb16f0..6a90d9e 100644
--- a/tests/ReCaptcha/ReCaptchaTest.php
+++ b/tests/ReCaptcha/ReCaptchaTest.php
@@ -40,11 +40,11 @@ class ReCaptchaTest extends TestCase
 {
 
     /**
-     * @expectedException \RuntimeException
      * @dataProvider invalidSecretProvider
      */
     public function testExceptionThrownOnInvalidSecret($invalid)
     {
+        $this->expectException('\RuntimeException');
         $rc = new ReCaptcha($invalid);
     }
 
diff --git a/tests/ReCaptcha/RequestMethod/PostTest.php b/tests/ReCaptcha/RequestMethod/PostTest.php
index bdfb78e..88a298d 100644
--- a/tests/ReCaptcha/RequestMethod/PostTest.php
+++ b/tests/ReCaptcha/RequestMethod/PostTest.php
@@ -115,7 +115,7 @@ class PostTest extends TestCase
             'Content-type: application/x-www-form-urlencoded',
         );
         foreach ($headers as $header) {
-            $this->assertContains($header, $options['http']['header']);
+            $this->assertStringContainsString($header, $options['http']['header']);
         }
     }
 

Attachment: signature.asc
Description: PGP signature

Reply via email to