#22 - fix
This commit is contained in:
parent
1586d121f9
commit
d026d41715
@ -73,29 +73,29 @@ class DatabaseSeeder extends Seeder
|
|||||||
|
|
||||||
$yearPeriods = YearPeriod::all();
|
$yearPeriods = YearPeriod::all();
|
||||||
|
|
||||||
// foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
// VacationRequest::factory()
|
VacationRequest::factory()
|
||||||
// ->count(10)
|
->count(10)
|
||||||
// ->for($user)
|
->for($user)
|
||||||
// ->sequence(fn() => [
|
->sequence(fn() => [
|
||||||
// "year_period_id" => $yearPeriods->random()->id,
|
"year_period_id" => $yearPeriods->random()->id,
|
||||||
// ])
|
])
|
||||||
// ->afterCreating(function (VacationRequest $vacationRequest): void {
|
->afterCreating(function (VacationRequest $vacationRequest): void {
|
||||||
// $days = app(VacationDaysCalculator::class)->calculateDays(
|
$days = app(VacationDaysCalculator::class)->calculateDays(
|
||||||
// $vacationRequest->yearPeriod,
|
$vacationRequest->yearPeriod,
|
||||||
// $vacationRequest->from,
|
$vacationRequest->from,
|
||||||
// $vacationRequest->to,
|
$vacationRequest->to,
|
||||||
// );
|
);
|
||||||
//
|
|
||||||
// foreach ($days as $day) {
|
foreach ($days as $day) {
|
||||||
// $vacationRequest->vacations()->create([
|
$vacationRequest->vacations()->create([
|
||||||
// "date" => $day,
|
"date" => $day,
|
||||||
// "user_id" => $vacationRequest->user->id,
|
"user_id" => $vacationRequest->user->id,
|
||||||
// ]);
|
]);
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// ->create();
|
->create();
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generateAvatarsForUsers(Collection $users): void
|
protected function generateAvatarsForUsers(Collection $users): void
|
||||||
|
@ -32,6 +32,7 @@ class VacationRequestTest extends FeatureTestCase
|
|||||||
{
|
{
|
||||||
$user = User::factory()->createQuietly();
|
$user = User::factory()->createQuietly();
|
||||||
$currentYearPeriod = YearPeriod::current();
|
$currentYearPeriod = YearPeriod::current();
|
||||||
|
|
||||||
VacationRequest::factory()
|
VacationRequest::factory()
|
||||||
->count(10)
|
->count(10)
|
||||||
->for($user)
|
->for($user)
|
||||||
@ -47,6 +48,7 @@ class VacationRequestTest extends FeatureTestCase
|
|||||||
->has("requests.data", 10),
|
->has("requests.data", 10),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUserCanCreateVacationRequest(): void
|
public function testUserCanCreateVacationRequest(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->createQuietly();
|
$user = User::factory()->createQuietly();
|
||||||
@ -73,6 +75,7 @@ class VacationRequestTest extends FeatureTestCase
|
|||||||
"comment" => "Comment for the vacation request.",
|
"comment" => "Comment for the vacation request.",
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTechnicalApproverCanApproveVacationRequest(): void
|
public function testTechnicalApproverCanApproveVacationRequest(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->createQuietly();
|
$user = User::factory()->createQuietly();
|
||||||
@ -95,6 +98,7 @@ class VacationRequestTest extends FeatureTestCase
|
|||||||
"state" => VacationRequestState::WAITING_FOR_ADMINISTRATIVE,
|
"state" => VacationRequestState::WAITING_FOR_ADMINISTRATIVE,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAdministrativeApproverCanApproveVacationRequest(): void
|
public function testAdministrativeApproverCanApproveVacationRequest(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->createQuietly();
|
$user = User::factory()->createQuietly();
|
||||||
@ -117,6 +121,7 @@ class VacationRequestTest extends FeatureTestCase
|
|||||||
"state" => VacationRequestState::APPROVED,
|
"state" => VacationRequestState::APPROVED,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTechnicalApproverCanRejectVacationRequest(): void
|
public function testTechnicalApproverCanRejectVacationRequest(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->createQuietly();
|
$user = User::factory()->createQuietly();
|
||||||
@ -208,6 +213,7 @@ class VacationRequestTest extends FeatureTestCase
|
|||||||
"vacationRequest" => trans("You have pending vacation request in this range."),
|
"vacationRequest" => trans("You have pending vacation request in this range."),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUserCannotCreateVacationRequestIfHeHasApprovedVacationRequestInThisRange(): void
|
public function testUserCannotCreateVacationRequestIfHeHasApprovedVacationRequestInThisRange(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->createQuietly();
|
$user = User::factory()->createQuietly();
|
||||||
@ -235,6 +241,7 @@ class VacationRequestTest extends FeatureTestCase
|
|||||||
"vacationRequest" => trans("You have approved vacation request in this range."),
|
"vacationRequest" => trans("You have approved vacation request in this range."),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUserCannotCreateVacationRequestWithEndDatePriorToTheStartDate(): void
|
public function testUserCannotCreateVacationRequestWithEndDatePriorToTheStartDate(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->createQuietly();
|
$user = User::factory()->createQuietly();
|
||||||
@ -250,6 +257,7 @@ class VacationRequestTest extends FeatureTestCase
|
|||||||
"vacationRequest" => trans("Vacation needs minimum one day."),
|
"vacationRequest" => trans("Vacation needs minimum one day."),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUserCannotCreateVacationRequestAtTheTurnOfTheYear(): void
|
public function testUserCannotCreateVacationRequestAtTheTurnOfTheYear(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->createQuietly();
|
$user = User::factory()->createQuietly();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user