#22 - cr fixes

This commit is contained in:
Adrian Hopek 2022-02-15 13:19:41 +01:00
parent 09da5cacda
commit 26b9d2da0c
15 changed files with 158 additions and 145 deletions

View File

@ -73,7 +73,7 @@ class CalendarGenerator
{
return Vacation::query()
->whereBetween("date", [$period->start, $period->end])
->whereRelation("vacationRequest", "state", VacationRequestState::APPROVED->value)
->whereRelation("vacationRequest", "state", VacationRequestState::Approved->value)
->get()
->groupBy(fn(Vacation $vacation) => $vacation->date->toDateString());
}

View File

@ -6,10 +6,10 @@ namespace Toby\Domain\Enums;
enum EmploymentForm: string
{
case EMPLOYMENT_CONTRACT = "employment_contract";
case COMMISSION_CONTRACT = "commission_contract";
case B2B_CONTRACT = "b2b_contract";
case BOARD_MEMBER_CONTRACT = "board_member_contract";
case EmploymentContract = "employment_contract";
case ComissionContract = "commission_contract";
case B2bContract = "b2b_contract";
case BoardMemberContract = "board_member_contract";
public function label(): string
{

View File

@ -6,10 +6,10 @@ namespace Toby\Domain\Enums;
enum Role: string
{
case EMPLOYEE = "employee";
case ADMINISTRATOR = "administrator";
case TECHNICAL_APPROVER = "technical_approver";
case ADMINISTRATIVE_APPROVER = "administrative_approver";
case Employee = "employee";
case Administrator = "administrator";
case TechnicalApprover = "technical_approver";
case AdministrativeApprover = "administrative_approver";
public function label(): string
{

View File

@ -6,14 +6,14 @@ namespace Toby\Domain\Enums;
enum VacationRequestState: string
{
case CREATED = "created";
case CANCELED = "canceled";
case REJECTED = "rejected";
case APPROVED = "approved";
case WAITING_FOR_TECHNICAL = "waiting_for_technical";
case WAITING_FOR_ADMINISTRATIVE = "waiting_for_administrative";
case ACCEPTED_BY_TECHNICAL = "accepted_by_technical";
case ACCEPTED_BY_ADMINISTRATIVE = "accepted_by_administrative";
case Created = "created";
case Canceled = "canceled";
case Rejected = "rejected";
case Approved = "approved";
case WaitingForTechnical = "waiting_for_technical";
case WaitingForAdministrative = "waiting_for_administrative";
case AcceptedByTechnical = "accepted_by_technical";
case AcceptedByAdministrative = "accepted_by_administrative";
public function label(): string
{
@ -23,24 +23,24 @@ enum VacationRequestState: string
public static function pendingStates(): array
{
return [
self::CREATED,
self::WAITING_FOR_TECHNICAL,
self::WAITING_FOR_ADMINISTRATIVE,
self::ACCEPTED_BY_TECHNICAL,
self::ACCEPTED_BY_ADMINISTRATIVE,
self::Created,
self::WaitingForTechnical,
self::WaitingForAdministrative,
self::AcceptedByTechnical,
self::AcceptedByAdministrative,
];
}
public static function successStates(): array
{
return [self::APPROVED];
return [self::Approved];
}
public static function failedStates(): array
{
return [
self::REJECTED,
self::CANCELED,
self::Rejected,
self::Canceled,
];
}

View File

@ -6,15 +6,15 @@ namespace Toby\Domain\Enums;
enum VacationType: string
{
case VACATION = "vacation";
case VACATION_ON_REQUEST = "vacation_on_request";
case SPECIAL_VACATION = "special_vacation";
case CHILDCARE_VACATION = "childcare_vacation";
case TRAINING_VACATION = "training_vacation";
case UNPAID_VACATION = "unpaid_vacation";
case VOLUNTEERING_VACATION = "volunteering_vacation";
case TIME_IN_LIEU = "time_in_lieu";
case SICK_VACATION = "sick_vacation";
case Vacation = "vacation";
case OnRequest = "vacation_on_request";
case Special = "special_vacation";
case Childcare = "childcare_vacation";
case Training = "training_vacation";
case Unpaid = "unpaid_vacation";
case Volunteering = "volunteering_vacation";
case TimeInLieu = "time_in_lieu";
case Sick = "sick_vacation";
public function label(): string
{

View File

@ -23,50 +23,50 @@ class VacationRequestStateManager
public function markAsCreated(VacationRequest $vacationRequest): void
{
$this->changeState($vacationRequest, VacationRequestState::CREATED);
$this->changeState($vacationRequest, VacationRequestState::Created);
$this->dispatcher->dispatch(new VacationRequestCreated($vacationRequest));
}
public function approve(VacationRequest $vacationRequest): void
{
$this->changeState($vacationRequest, VacationRequestState::APPROVED);
$this->changeState($vacationRequest, VacationRequestState::Approved);
$this->dispatcher->dispatch(new VacationRequestApproved($vacationRequest));
}
public function reject(VacationRequest $vacationRequest): void
{
$this->changeState($vacationRequest, VacationRequestState::REJECTED);
$this->changeState($vacationRequest, VacationRequestState::Rejected);
}
public function cancel(VacationRequest $vacationRequest): void
{
$this->changeState($vacationRequest, VacationRequestState::CANCELED);
$this->changeState($vacationRequest, VacationRequestState::Canceled);
}
public function acceptAsTechnical(VacationRequest $vacationRequest): void
{
$this->changeState($vacationRequest, VacationRequestState::ACCEPTED_BY_TECHNICAL);
$this->changeState($vacationRequest, VacationRequestState::AcceptedByTechnical);
$this->dispatcher->dispatch(new VacationRequestAcceptedByTechnical($vacationRequest));
}
public function acceptAsAdministrative(VacationRequest $vacationRequest): void
{
$this->changeState($vacationRequest, VacationRequestState::ACCEPTED_BY_ADMINISTRATIVE);
$this->changeState($vacationRequest, VacationRequestState::AcceptedByAdministrative);
$this->dispatcher->dispatch(new VacationRequestAcceptedByAdministrative($vacationRequest));
}
public function waitForTechnical(VacationRequest $vacationRequest): void
{
$this->changeState($vacationRequest, VacationRequestState::WAITING_FOR_TECHNICAL);
$this->changeState($vacationRequest, VacationRequestState::WaitingForTechnical);
}
public function waitForAdministrative(VacationRequest $vacationRequest): void
{
$this->changeState($vacationRequest, VacationRequestState::WAITING_FOR_ADMINISTRATIVE);
$this->changeState($vacationRequest, VacationRequestState::WaitingForAdministrative);
}
protected function changeState(VacationRequest $vacationRequest, VacationRequestState $state): void

View File

@ -6,55 +6,55 @@ use Toby\Domain\Enums\VacationType;
use Toby\Domain\VacationTypeConfigRetriever;
return [
VacationType::VACATION->value => [
VacationType::Vacation->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
VacationTypeConfigRetriever::KEY_BILLABLE => true,
VacationTypeConfigRetriever::KEY_HAS_LIMIT => true,
],
VacationType::VACATION_ON_REQUEST->value => [
VacationType::OnRequest->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
VacationTypeConfigRetriever::KEY_BILLABLE => true,
VacationTypeConfigRetriever::KEY_HAS_LIMIT => true,
],
VacationType::TIME_IN_LIEU->value => [
VacationType::TimeInLieu->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => false,
VacationTypeConfigRetriever::KEY_BILLABLE => true,
VacationTypeConfigRetriever::KEY_HAS_LIMIT => false,
],
VacationType::SICK_VACATION->value => [
VacationType::Sick->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
VacationTypeConfigRetriever::KEY_BILLABLE => true,
VacationTypeConfigRetriever::KEY_HAS_LIMIT => false,
],
VacationType::UNPAID_VACATION->value => [
VacationType::Unpaid->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
VacationTypeConfigRetriever::KEY_BILLABLE => false,
VacationTypeConfigRetriever::KEY_HAS_LIMIT => false,
],
VacationType::SPECIAL_VACATION->value => [
VacationType::Special->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
VacationTypeConfigRetriever::KEY_BILLABLE => false,
VacationTypeConfigRetriever::KEY_HAS_LIMIT => false,
],
VacationType::CHILDCARE_VACATION->value => [
VacationType::Childcare->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
VacationTypeConfigRetriever::KEY_BILLABLE => false,
VacationTypeConfigRetriever::KEY_HAS_LIMIT => false,
],
VacationType::TRAINING_VACATION->value => [
VacationType::Training->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
VacationTypeConfigRetriever::KEY_BILLABLE => true,
VacationTypeConfigRetriever::KEY_HAS_LIMIT => false,
],
VacationType::VOLUNTEERING_VACATION->value => [
VacationType::Volunteering->value => [
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
VacationTypeConfigRetriever::KEY_BILLABLE => true,

View File

@ -23,7 +23,7 @@ class UserFactory extends Factory
"email" => $this->faker->unique()->safeEmail(),
"employment_form" => $this->faker->randomElement(EmploymentForm::cases()),
"position" => $this->faker->jobTitle(),
"role" => Role::EMPLOYEE,
"role" => Role::Employee,
"employment_date" => Carbon::createFromInterface($this->faker->dateTimeBetween("2020-10-27"))->toDateString(),
"remember_token" => Str::random(10),
];

View File

@ -16,7 +16,7 @@ return new class() extends Migration {
$table->string("last_name");
$table->string("email")->unique();
$table->string("avatar")->nullable();
$table->string("role")->default(Role::EMPLOYEE->value);
$table->string("role")->default(Role::Employee->value);
$table->string("position");
$table->string("employment_form");
$table->date("employment_date");

View File

@ -0,0 +1,60 @@
const months = [
{
'name': 'Styczeń',
'value': 'january',
},
{
'name': 'Luty',
'value': 'february',
},
{
'name': 'Marzec',
'value': 'march',
},
{
'name': 'Kwiecień',
'value': 'april',
},
{
'name': 'Maj',
'value': 'may',
},
{
'name': 'Czerwiec',
'value': 'june',
},
{
'name': 'Lipiec',
'value': 'july',
},
{
'name': 'Sierpień',
'value': 'august',
},
{
'name': 'Wrzesień',
'value': 'september',
},
{
'name': 'Październik',
'value': 'october',
},
{
'name': 'Listopad',
'value': 'november',
},
{
'name': 'Grudzień',
'value': 'december',
},
]
export function useMonthInfo() {
const getMonths = () => months
const findMonth = value => months.find(month => month.value === value)
return {
getMonths,
findMonth,
}
}

View File

@ -31,7 +31,7 @@ const statuses = [
},
},
{
text: 'Czeka na akceptację od technicznego',
text: 'Czeka na akceptację od przełożonego technicznego',
value: 'waiting_for_technical',
outline: {
icon: OutlineClockIcon,
@ -44,7 +44,7 @@ const statuses = [
},
},
{
text: 'Czeka na akceptację od administracyjnego',
text: 'Czeka na akceptację od przełożonego administracyjnego',
value: 'waiting_for_administrative',
outline: {
icon: OutlineClockIcon,

View File

@ -126,6 +126,7 @@
import {Menu, MenuButton, MenuItem, MenuItems} from '@headlessui/vue'
import {CheckIcon, ChevronDownIcon} from '@heroicons/vue/solid'
import {computed} from 'vue'
import {useMonthInfo} from '@/Composables/monthInfo'
export default {
name: 'VacationCalendar',
@ -152,58 +153,10 @@ export default {
},
},
setup(props) {
const months = [
{
'name': 'Styczeń',
'value': 'january',
},
{
'name': 'Luty',
'value': 'february',
},
{
'name': 'Marzec',
'value': 'march',
},
{
'name': 'Kwiecień',
'value': 'april',
},
{
'name': 'Maj',
'value': 'may',
},
{
'name': 'Czerwiec',
'value': 'june',
},
{
'name': 'Lipiec',
'value': 'july',
},
{
'name': 'Sierpień',
'value': 'august',
},
{
'name': 'Wrzesień',
'value': 'september',
},
{
'name': 'Październik',
'value': 'october',
},
{
'name': 'Listopad',
'value': 'november',
},
{
'name': 'Grudzień',
'value': 'december',
},
]
const {getMonths, findMonth} = useMonthInfo()
const months = getMonths()
const selectedMonth = computed(() => months.find(month => month.value === props.currentMonth))
const selectedMonth = computed(() => findMonth(props.currentMonth))
return {
months,

View File

@ -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(),
]);
}

View File

@ -65,7 +65,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.",
@ -76,8 +76,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.",
@ -91,8 +91,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)
@ -103,7 +103,7 @@ class VacationRequestTest extends FeatureTestCase
->assertSessionHasNoErrors();
$this->assertDatabaseHas("vacation_requests", [
"state" => VacationRequestState::WAITING_FOR_ADMINISTRATIVE,
"state" => VacationRequestState::WaitingForAdministrative,
]);
}
@ -115,7 +115,7 @@ class VacationRequestTest extends FeatureTestCase
$currentYearPeriod = YearPeriod::current();
$vacationRequest = VacationRequest::factory([
"state" => VacationRequestState::WAITING_FOR_ADMINISTRATIVE,
"state" => VacationRequestState::WaitingForAdministrative,
])
->for($user)
->for($currentYearPeriod)
@ -126,7 +126,7 @@ class VacationRequestTest extends FeatureTestCase
->assertSessionHasNoErrors();
$this->assertDatabaseHas("vacation_requests", [
"state" => VacationRequestState::APPROVED,
"state" => VacationRequestState::Approved,
]);
}
@ -144,8 +144,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)
@ -156,7 +156,7 @@ class VacationRequestTest extends FeatureTestCase
->assertSessionHasNoErrors();
$this->assertDatabaseHas("vacation_requests", [
"state" => VacationRequestState::REJECTED,
"state" => VacationRequestState::Rejected,
]);
}
@ -174,7 +174,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.",
@ -198,7 +198,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.",
@ -229,7 +229,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.",
@ -252,8 +252,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.",
@ -264,7 +264,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.",
@ -288,8 +288,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.",
@ -300,7 +300,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.",
@ -316,7 +316,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.",
@ -333,7 +333,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.",

View File

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