Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Functional tests fail when NotFoundHttpException is thrown #25311

Copy link
Copy link
Closed
@gjuric

Description

@gjuric
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.0.0

When I am running functional tests that extend WebTestCase and I request a controller action that throws a NotFoundHttpException it looks like the exception is not converted to u 404 response. (I am checking for a 404 response code in the test).

#!/usr/bin/env php
PHPUnit 6.5.2 by Sebastian Bergmann and contributors.

Testing Project Test Suite
E                                                                   1 / 1 (100%)

Time: 275 ms, Memory: 8.00MB

There was 1 error:

1) App\Tests\DefaultControllerTest::testSomething
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: Not Found

...sf4/vendor/symfony/framework-bundle/Controller/ControllerTrait.php:282
...sf4/src/Controller/DefaultController.php:15
...sf4/vendor/symfony/http-kernel/HttpKernel.php:151
...sf4/vendor/symfony/http-kernel/HttpKernel.php:66
...sf4/vendor/symfony/http-kernel/Kernel.php:190
...sf4/vendor/symfony/http-kernel/Client.php:68
...sf4/vendor/symfony/framework-bundle/Client.php:131
...sf4/vendor/symfony/browser-kit/Client.php:312
...sf4/tests/DefaultControllerTest.php:12

If I return a response from the controller:

return new Response('Not found', Response::HTTP_NOT_FOUND)

then the tests pass.

I have create a minimal example here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.