|
16 | 16 | use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
|
17 | 17 | use Liip\Acme\Tests\App\AppKernel;
|
18 | 18 | use Liip\FunctionalTestBundle\Test\WebTestCase;
|
19 |
| -use function method_exists; |
20 | 19 | use PHPUnit\Framework\AssertionFailedError;
|
21 | 20 |
|
22 | 21 | /**
|
@@ -243,25 +242,16 @@ public function test404Error(): void
|
243 | 242 | */
|
244 | 243 | public function testIsSuccessfulException(): void
|
245 | 244 | {
|
246 |
| - $mockBuilder = $this->getMockBuilder('Symfony\Component\HttpFoundation\Response') |
247 |
| - ->disableOriginalConstructor(); |
248 |
| - if (method_exists($mockBuilder, 'setMethods')) { |
249 |
| - $mockBuilder->setMethods(['getContent']); |
250 |
| - } else { // phpunit 10 |
251 |
| - $mockBuilder->onlyMethods(['getContent']); |
252 |
| - } |
253 |
| - $response = $mockBuilder |
254 |
| - ->getMock(); |
| 245 | + $path = '/exception'; |
255 | 246 |
|
256 |
| - $response->expects($this->any()) |
257 |
| - ->method('getContent') |
258 |
| - ->will($this->throwException(new \Exception('foo'))); |
| 247 | + $client = static::makeClient(); |
| 248 | + $client->request('GET', $path); |
259 | 249 |
|
260 | 250 | try {
|
261 |
| - $this->isSuccessful($response); |
| 251 | + $this->isSuccessful($client->getResponse()); |
262 | 252 | } catch (AssertionFailedError $e) {
|
263 | 253 | $string = <<<'EOF'
|
264 |
| -The Response was not successful: foo |
| 254 | +The Response was not successful: foo (500 Internal Server Error) |
265 | 255 | Failed asserting that false is true.
|
266 | 256 | EOF;
|
267 | 257 | $this->assertSame($string, $e->getMessage());
|
|
0 commit comments