fix(test): use Customer model for unauthorized BO access tests instead of undefined enum case [AUD-TST-003]
This commit is contained in:
parent
23682def0d
commit
418b4e1941
2 changed files with 9 additions and 8 deletions
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue