fix(test): explicitly logout backend guard in customer rejection tests and add phpdoc typehints

This commit is contained in:
Jérémy Munsch 2026-08-26 11:52:08 +02:00
parent a1ad396a0e
commit bc25ee6f3c
No known key found for this signature in database
GPG key ID: 2AAECDA6B7330F91
2 changed files with 9 additions and 1 deletions

View file

@ -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');

View file

@ -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');