永远测试API laravel功能响应404

时间:2019-12-06 18:57:13

标签: laravel phpunit

进行任何测试时都会返回我 404 ,并且通过招摇网址api / lojas / uuid,他可以正常响应。

文件: LojasTest.php

namespace Tests\Feature;

use Tests\TestCase;

class LojasTest extends TestCase

    /**
     * A basic functional test example.
     *
     * @return void
     */
{


    public function testNenhumRecursoEncontradoParaOsCriteriosInformados(): void
        {
            $response = $this->get('/lojas/617752d2-175e-11ea-ae6f-0242ac120003');

            $response->assertStatus(200);
        }

}

文件: .ENV

APP_DEBUG=true
DEBUGBAR_ENABLED=false
APP_LOG_LEVEL=debug
APP_URL=http://localhost

错误:

  

http://localhost/lojas/617752d2-175e-11ea-ae6f-0242ac120003 2019-12-06   17:43:23 GET 404 Symfony

     

预期状态码为200,但收到404。断言为false失败   是真的。   /opt/project/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:151   /opt/project/tests/Feature/LojasTest.php:21

1 个答案:

答案 0 :(得分:-1)

通过命令解决。

php artisan serve