ldc-cocotte/tests/Feature/App/Http/Controllers/Bo/EmployeesControllerTest.php
Jérémy Munsch 8b96ce90be
test(casts): add tests for EmployeeSitesCast functionality
test(casts): add tests for ShopperEstablishmentCodeCast functionality

test(casts): add tests for ShopperServiceCodeCast functionality

test(casts): add tests for ShopperSiteCodeCast functionality

test(dto): update ProductDtoTest to include additional fields

test(dto): update SettingDtoTest to remove arcadiaSites assertions

test(events): update AnOrderHasBeenPlacedTest to use value objects

test(entities): update OrderTest to use value objects for employee details

test(value-objects): update EmployeeUpsertDataTest to use value objects

test(pagination): update PaginationTest to access value properties

test(services): update AppCustomerAuthServiceTest to use CrmHashcode

test(services): update CrmServiceTest to use CrmHashcode for customer retrieval
2026-10-27 09:58:45 +01:00

43 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use App\Jobs\FetchAndUpsertArcadiaEmployees;
use App\Models\User;
use Domain\Enums\UserRole;
use Illuminate\Support\Facades\Queue;
describe('EmployeesController', function () {
beforeEach(function () {
// GIVEN
/** @var \Tests\TestCase $this */
$this->user = User::factory()->create(['role' => UserRole::SuperAdmin]);
$this->actingAs($this->user, 'backend');
});
it('can launch employee sync job', function () {
// GIVEN
/** @var \Tests\TestCase $this */
Queue::fake();
// WHEN
$response = $this->post('/bo/settings/employees/sync');
// THEN
$response->assertSessionHasNoErrors();
$response->assertRedirect(route('bo.dashboard'));
Queue::assertPushed(FetchAndUpsertArcadiaEmployees::class);
});
it('redirects unauthenticated users to login', function () {
// GIVEN
/** @var \Tests\TestCase $this */
auth()->guard('backend')->logout();
// WHEN
$response = $this->post('/bo/settings/employees/sync');
// THEN
$response->assertRedirect('/bo/login');
});
});