Search code examples
phpphpunitcode-coveragefunctional-testingsilex

Silex - Code coverage from functional test


I would like to generate code coverage from functional testing in Silex App via PHPUnit. I created sandbox where you could reproduce.

The question is: Why Controller::indexAction() method is marked as Not Executed code in code coverage report?

code coverage

Thank you!


Solution

  • No time for testing. What i have seen:

    You are setting your test array for the first test in app.php

    return new \Symfony\Component\HttpFoundation\JsonResponse(['foo' => 'bar']);
    

    Why? And did the test fail if you remove that? Maybe here the Controller isn't tested.

    Then you are testing the 2 methods not in the same way.

    Maybe that leads to the solution of the problem.