42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\User;
|
|
use Domain\Enums\UserRole;
|
|
|
|
describe('EmployeesController', function () {
|
|
beforeEach(function () {
|
|
// GIVEN
|
|
/** @var \Tests\TestCase $this */
|
|
$user = User::factory()->create(['role' => UserRole::SuperAdmin]);
|
|
$this->actingAs($user, 'backend');
|
|
});
|
|
|
|
// FIXME: The Arcadia refresh action is inhibited, uncomment this test when api acrcadia is up.
|
|
// 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');
|
|
});
|
|
});
|