Skip to content

Commit

Permalink
Merge pull request #619 from mzk/dev-os-set-methods-deprecated-phpunit10
Browse files Browse the repository at this point in the history
fix setMethods is deprecated phpunit 10
  • Loading branch information
alexislefebvre authored Apr 5, 2023
2 parents 82092d0 + 446bee6 commit 23269c9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/Test/WebTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Liip\Acme\Tests\App\AppKernel;
use Liip\FunctionalTestBundle\Test\WebTestCase;
use PHPUnit\Framework\AssertionFailedError;
use function method_exists;

/**
* @IgnoreAnnotation("depends")
Expand Down Expand Up @@ -242,9 +243,14 @@ public function test404Error(): void
*/
public function testIsSuccessfulException(): void
{
$response = $this->getMockBuilder('Symfony\Component\HttpFoundation\Response')
->disableOriginalConstructor()
->setMethods(['getContent'])
$mockBuilder = $this->getMockBuilder('Symfony\Component\HttpFoundation\Response')
->disableOriginalConstructor();
if (method_exists($mockBuilder, 'setMethods')) {
$mockBuilder->setMethods(['getContent']);
} else { // phpunit 10
$mockBuilder->onlyMethods(['getContent']);
}
$response = $mockBuilder
->getMock();

$response->expects($this->any())
Expand Down

0 comments on commit 23269c9

Please sign in to comment.