diff --git a/tests/Feature/App/Http/Controllers/Bo/DiscountsControllerTest.php b/tests/Feature/App/Http/Controllers/Bo/DiscountsControllerTest.php index c70666f1..838898fa 100644 --- a/tests/Feature/App/Http/Controllers/Bo/DiscountsControllerTest.php +++ b/tests/Feature/App/Http/Controllers/Bo/DiscountsControllerTest.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use App\Models\Customer; use App\Models\Discount; use App\Models\User; use Domain\Enums\DiscountType; @@ -105,12 +106,12 @@ describe('DiscountsController', function () { $response->assertRedirect('/bo/login'); }); - it('denies access to unauthorized user with customer role', function () { - $user = User::factory()->make(['role' => UserRole::Customer]); - $this->actingAs($user, 'backend'); + it('redirects frontend customer trying to access bo to login', function () { + $customer = new Customer(); + $this->actingAs($customer, 'frontend'); $response = $this->get('/bo/discounts'); - expect($response->status())->toBe(403); + $response->assertRedirect('/bo/login'); }); }); }); diff --git a/tests/Feature/App/Http/Controllers/Bo/ProductsControllerTest.php b/tests/Feature/App/Http/Controllers/Bo/ProductsControllerTest.php index 5ca31bbd..96a38eea 100644 --- a/tests/Feature/App/Http/Controllers/Bo/ProductsControllerTest.php +++ b/tests/Feature/App/Http/Controllers/Bo/ProductsControllerTest.php @@ -241,12 +241,12 @@ describe('ProductsController', function () { $response->assertRedirect('/bo/login'); }); - it('denies access to unauthorized user with customer role', function () { - $user = User::factory()->make(['role' => UserRole::Customer]); - $this->actingAs($user, 'backend'); + it('redirects frontend customer trying to access bo to login', function () { + $customer = new \Customer(); + $this->actingAs($customer, 'frontend'); $response = $this->get('/bo/products'); - expect($response->status())->toBe(403); + $response->assertRedirect('/bo/login'); }); }); });