jeudi 5 novembre 2020

Symfony Unit Test always returns 404 error. Configuration Problem?

I am not able to run any unit test cases in Symfony project. I've followed everything from official documentation here. https://symfony.com/doc/current/testing.html

Here is my simple unit test code.

    public function testGetBalance()
    {
        $client = static::createClient();

        $client->request('GET', '/back_accounts/1/balance');

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
    }

And I get this error message.

[error] Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /back_accounts/1/balance"" at /media/xubuntu/work/Project/Symfony Test/bank/vendor/symfony/http-kernel/EventListener/RouterListener.php line 136

Would you someone help me what is wrong with my code? Or is there any config misssing? Thank you.

Aucun commentaire:

Enregistrer un commentaire