Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
phuocsmileonetwothree opened this issue Nov 30, 2023 · 1 comment

Comments

@phuocsmileonetwothree
Copy link

  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

});
@tibix
Copy link

tibix commented Mar 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants