LaravelDaily/Test-Laravel-Routes

Tests\Feature\RoutesTest::test_is_admin_middleware_is_working && Tests\Feature\RoutesTest::test_task_api_crud_is_working

phuocsmileonetwothree opened this issue · 1 comments

  1. Tests\Feature\RoutesTest::test_task_api_crud_is_working
    Expected response status code [200] but received 404.
    Failed asserting that 200 is identical to 404.

  2. Tests\Feature\RoutesTest::test_is_admin_middleware_is_working
    Expected response status code [403] but received 500.
    Failed asserting that 403 is identical to 500.

I have a two errors and this is a code of me :

  1. Route::prefix('app')->group(function(){
    // Tasks inside that /app group:

    // Task 7: point URL /app/dashboard to a "Single Action" DashboardController
    // Assign the route name "dashboard"
    // Put one Route Group code line here below
    
    
    Route::get('dashboard', [DashboardController::class])->name('dashboard');
    // Task 8: Manage tasks with URL /app/tasks/***.
    // Add ONE line to assign 7 resource routes to TaskController
    // Put one code line here below
    
    Route::resource('tasks', TaskController::class);
    

    // End of the /app Route Group

    });

  2. Route::group(['prefix' => 'admin', 'middleware' => ['is_admin']], function(){
    // Tasks inside that /admin group:

    // Task 10: point URL /admin/dashboard to a "Single Action" Admin/DashboardController
    // Put one code line here below

    Route::get('dashboard', [AdminDashboardController::class]);
    // Task 11: point URL /admin/stats to a "Single Action" Admin/StatsController
    // Put one code line here below

    Route::get('stats', [StatsController::class]);
    // End of the /admin Route Group

});

Did you set AdminDashboardController as an alias on the import?
Also you might want to add the leading / (forward slash) on both dashboard and stats