fix(test): explicitly logout backend guard in customer rejection tests and add phpdoc typehints
This commit is contained in:
parent
a1ad396a0e
commit
bc25ee6f3c
2 changed files with 9 additions and 1 deletions
|
|
@ -100,6 +100,7 @@ describe('DiscountsController', function () {
|
|||
|
||||
describe('authorization rejections', function () {
|
||||
it('redirects unauthenticated guest to login', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
auth('backend')->logout();
|
||||
|
||||
$response = $this->get('/bo/discounts');
|
||||
|
|
@ -107,6 +108,8 @@ describe('DiscountsController', function () {
|
|||
});
|
||||
|
||||
it('redirects frontend customer trying to access bo to login', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
auth('backend')->logout();
|
||||
$customer = new Customer();
|
||||
$this->actingAs($customer, 'frontend');
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\Product;
|
||||
use App\Models\Range;
|
||||
use App\Models\Tag;
|
||||
|
|
@ -18,6 +19,7 @@ describe('ProductsController', function () {
|
|||
|
||||
beforeEach(function () {
|
||||
// GIVEN
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->user = User::factory()->create(['role' => UserRole::SuperAdmin]);
|
||||
$this->actingAs($this->user, 'backend');
|
||||
});
|
||||
|
|
@ -235,6 +237,7 @@ describe('ProductsController', function () {
|
|||
|
||||
describe('authorization rejections', function () {
|
||||
it('redirects unauthenticated guest to login', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
auth('backend')->logout();
|
||||
|
||||
$response = $this->get('/bo/products');
|
||||
|
|
@ -242,7 +245,9 @@ describe('ProductsController', function () {
|
|||
});
|
||||
|
||||
it('redirects frontend customer trying to access bo to login', function () {
|
||||
$customer = new \Customer();
|
||||
/** @var \Tests\TestCase $this */
|
||||
auth('backend')->logout();
|
||||
$customer = new Customer();
|
||||
$this->actingAs($customer, 'frontend');
|
||||
|
||||
$response = $this->get('/bo/products');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue