Merge branch 'main' into #6-google-calendar
# Conflicts: # app/Domain/CalendarGenerator.php # app/Domain/Enums/VacationRequestState.php # app/Domain/VacationRequestStateManager.php # app/Eloquent/Models/Vacation.php # database/migrations/2022_02_07_133018_create_vacations_table.php # resources/js/Composables/statusInfo.js # resources/js/Pages/Calendar.vue # tests/Feature/VacationRequestTest.php # tests/Unit/VacationRequestStatesTest.php
This commit is contained in:
@@ -88,10 +88,10 @@ class UserTest extends FeatureTestCase
|
||||
->post("/users", [
|
||||
"firstName" => "John",
|
||||
"lastName" => "Doe",
|
||||
"role" => Role::EMPLOYEE->value,
|
||||
"role" => Role::Employee->value,
|
||||
"position" => "Test position",
|
||||
"email" => "john.doe@example.com",
|
||||
"employmentForm" => EmploymentForm::B2B_CONTRACT->value,
|
||||
"employmentForm" => EmploymentForm::B2bContract->value,
|
||||
"employmentDate" => Carbon::now()->toDateString(),
|
||||
])
|
||||
->assertSessionHasNoErrors();
|
||||
@@ -100,9 +100,9 @@ class UserTest extends FeatureTestCase
|
||||
"first_name" => "John",
|
||||
"last_name" => "Doe",
|
||||
"email" => "john.doe@example.com",
|
||||
"role" => Role::EMPLOYEE->value,
|
||||
"role" => Role::Employee->value,
|
||||
"position" => "Test position",
|
||||
"employment_form" => EmploymentForm::B2B_CONTRACT->value,
|
||||
"employment_form" => EmploymentForm::B2bContract->value,
|
||||
"employment_date" => Carbon::now()->toDateString(),
|
||||
]);
|
||||
}
|
||||
@@ -127,9 +127,9 @@ class UserTest extends FeatureTestCase
|
||||
"firstName" => "John",
|
||||
"lastName" => "Doe",
|
||||
"email" => "john.doe@example.com",
|
||||
"role" => Role::EMPLOYEE->value,
|
||||
"role" => Role::Employee->value,
|
||||
"position" => "Test position",
|
||||
"employmentForm" => EmploymentForm::B2B_CONTRACT->value,
|
||||
"employmentForm" => EmploymentForm::B2bContract->value,
|
||||
"employmentDate" => Carbon::now()->toDateString(),
|
||||
])
|
||||
->assertSessionHasNoErrors();
|
||||
@@ -138,9 +138,9 @@ class UserTest extends FeatureTestCase
|
||||
"first_name" => "John",
|
||||
"last_name" => "Doe",
|
||||
"email" => "john.doe@example.com",
|
||||
"role" => Role::EMPLOYEE->value,
|
||||
"role" => Role::Employee->value,
|
||||
"position" => "Test position",
|
||||
"employment_form" => EmploymentForm::B2B_CONTRACT->value,
|
||||
"employment_form" => EmploymentForm::B2bContract->value,
|
||||
"employment_date" => Carbon::now()->toDateString(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
$this->actingAs($user)
|
||||
->post("/vacation-requests", [
|
||||
"type" => VacationType::VACATION->value,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 7)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 11)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
@@ -80,8 +80,8 @@ class VacationRequestTest extends FeatureTestCase
|
||||
"user_id" => $user->id,
|
||||
"year_period_id" => $currentYearPeriod->id,
|
||||
"name" => "1/" . $currentYearPeriod->year,
|
||||
"type" => VacationType::VACATION->value,
|
||||
"state" => VacationRequestState::WAITING_FOR_TECHNICAL,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"state" => VacationRequestState::WaitingForTechnical,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 7)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 11)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
@@ -95,8 +95,8 @@ class VacationRequestTest extends FeatureTestCase
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
$vacationRequest = VacationRequest::factory([
|
||||
"state" => VacationRequestState::WAITING_FOR_TECHNICAL,
|
||||
"type" => VacationType::VACATION,
|
||||
"state" => VacationRequestState::WaitingForTechnical,
|
||||
"type" => VacationType::Vacation,
|
||||
])
|
||||
->for($user)
|
||||
->for($currentYearPeriod)
|
||||
@@ -107,7 +107,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
->assertSessionHasNoErrors();
|
||||
|
||||
$this->assertDatabaseHas("vacation_requests", [
|
||||
"state" => VacationRequestState::WAITING_FOR_ADMINISTRATIVE,
|
||||
"state" => VacationRequestState::WaitingForAdministrative,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
$vacationRequest = VacationRequest::factory([
|
||||
"state" => VacationRequestState::WAITING_FOR_ADMINISTRATIVE,
|
||||
"state" => VacationRequestState::WaitingForAdministrative,
|
||||
])
|
||||
->for($user)
|
||||
->for($currentYearPeriod)
|
||||
@@ -130,7 +130,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
->assertSessionHasNoErrors();
|
||||
|
||||
$this->assertDatabaseHas("vacation_requests", [
|
||||
"state" => VacationRequestState::APPROVED,
|
||||
"state" => VacationRequestState::Approved,
|
||||
]);
|
||||
|
||||
Bus::assertDispatched(SendVacationRequestDaysToGoogleCalendar::class);
|
||||
@@ -150,8 +150,8 @@ class VacationRequestTest extends FeatureTestCase
|
||||
->create();
|
||||
|
||||
$vacationRequest = VacationRequest::factory([
|
||||
"state" => VacationRequestState::WAITING_FOR_TECHNICAL,
|
||||
"type" => VacationType::VACATION,
|
||||
"state" => VacationRequestState::WaitingForTechnical,
|
||||
"type" => VacationType::Vacation,
|
||||
])
|
||||
->for($user)
|
||||
->for($currentYearPeriod)
|
||||
@@ -162,7 +162,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
->assertSessionHasNoErrors();
|
||||
|
||||
$this->assertDatabaseHas("vacation_requests", [
|
||||
"state" => VacationRequestState::REJECTED,
|
||||
"state" => VacationRequestState::Rejected,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
$this->actingAs($user)
|
||||
->post("/vacation-requests", [
|
||||
"type" => VacationType::VACATION->value,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 7)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 11)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
@@ -204,7 +204,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
$this->actingAs($user)
|
||||
->post("/vacation-requests", [
|
||||
"type" => VacationType::VACATION->value,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 5)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 6)->toDateString(),
|
||||
"comment" => "Vacation at weekend.",
|
||||
@@ -235,7 +235,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
$this->actingAs($user)
|
||||
->post("/vacation-requests", [
|
||||
"type" => VacationType::VACATION->value,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 4, 18)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 4, 18)->toDateString(),
|
||||
"comment" => "Vacation at holiday.",
|
||||
@@ -258,8 +258,8 @@ class VacationRequestTest extends FeatureTestCase
|
||||
->create();
|
||||
|
||||
VacationRequest::factory([
|
||||
"type" => VacationType::VACATION->value,
|
||||
"state" => VacationRequestState::WAITING_FOR_TECHNICAL,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"state" => VacationRequestState::WaitingForTechnical,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 1)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 4)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
@@ -270,7 +270,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
$this->actingAs($user)
|
||||
->post("/vacation-requests", [
|
||||
"type" => VacationType::VACATION->value,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 1)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 4)->toDateString(),
|
||||
"comment" => "Another comment for the another vacation request.",
|
||||
@@ -294,8 +294,8 @@ class VacationRequestTest extends FeatureTestCase
|
||||
->create();
|
||||
|
||||
VacationRequest::factory([
|
||||
"type" => VacationType::VACATION->value,
|
||||
"state" => VacationRequestState::APPROVED,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"state" => VacationRequestState::Approved,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 2)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 4)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
@@ -306,7 +306,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
$this->actingAs($user)
|
||||
->post("/vacation-requests", [
|
||||
"type" => VacationType::VACATION->value,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 1)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 4)->toDateString(),
|
||||
"comment" => "Another comment for the another vacation request.",
|
||||
@@ -322,7 +322,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
$this->actingAs($user)
|
||||
->post("/vacation-requests", [
|
||||
"type" => VacationType::VACATION->value,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 7)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 6)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
@@ -339,7 +339,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
$nextYearPeriod = $this->createYearPeriod(Carbon::now()->year + 1);
|
||||
$this->actingAs($user)
|
||||
->post("/vacation-requests", [
|
||||
"type" => VacationType::VACATION->value,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 12, 27)->toDateString(),
|
||||
"to" => Carbon::create($nextYearPeriod->year, 1, 2)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
|
||||
@@ -39,8 +39,8 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
/** @var VacationRequest $vacationRequest */
|
||||
$vacationRequest = VacationRequest::factory([
|
||||
"type" => VacationType::VACATION->value,
|
||||
"state" => VacationRequestState::CREATED,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"state" => VacationRequestState::Created,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 1)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 4)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
@@ -51,7 +51,7 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
$this->stateManager->waitForTechnical($vacationRequest);
|
||||
|
||||
$this->assertEquals(VacationRequestState::WAITING_FOR_TECHNICAL, $vacationRequest->state);
|
||||
$this->assertEquals(VacationRequestState::WaitingForTechnical, $vacationRequest->state);
|
||||
}
|
||||
|
||||
public function testAfterCreatingVacationRequestOfTypeSickVacationItTransitsToProperState(): void
|
||||
@@ -62,8 +62,8 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
/** @var VacationRequest $vacationRequest */
|
||||
$vacationRequest = VacationRequest::factory([
|
||||
"type" => VacationType::SICK_VACATION->value,
|
||||
"state" => VacationRequestState::CREATED,
|
||||
"type" => VacationType::Sick->value,
|
||||
"state" => VacationRequestState::Created,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 1)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 4)->toDateString(),
|
||||
])
|
||||
@@ -73,7 +73,7 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
$this->stateManager->approve($vacationRequest);
|
||||
|
||||
$this->assertEquals(VacationRequestState::APPROVED, $vacationRequest->state);
|
||||
$this->assertEquals(VacationRequestState::Approved, $vacationRequest->state);
|
||||
}
|
||||
|
||||
public function testAfterCreatingVacationRequestOfTypeTimeInLieuItTransitsToProperState(): void
|
||||
@@ -84,8 +84,8 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
/** @var VacationRequest $vacationRequest */
|
||||
$vacationRequest = VacationRequest::factory([
|
||||
"type" => VacationType::TIME_IN_LIEU->value,
|
||||
"state" => VacationRequestState::CREATED,
|
||||
"type" => VacationType::TimeInLieu->value,
|
||||
"state" => VacationRequestState::Created,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 2)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 2)->toDateString(),
|
||||
])
|
||||
@@ -95,6 +95,6 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
$this->stateManager->approve($vacationRequest);
|
||||
|
||||
$this->assertEquals(VacationRequestState::APPROVED, $vacationRequest->state);
|
||||
$this->assertEquals(VacationRequestState::Approved, $vacationRequest->state);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user