#38 - fix
This commit is contained in:
parent
ef54b37691
commit
8a6d9151fb
@ -53,10 +53,10 @@ class VacationRequestCreatedOnEmployeeBehalf extends Notification
|
||||
->greeting(__("Hi :user!", [
|
||||
"user" => $user,
|
||||
]))
|
||||
->subject(__("Vacation request :title has been created on your behalf.", [
|
||||
->subject(__("Vacation request :title has been created on your behalf", [
|
||||
"title" => $title,
|
||||
]))
|
||||
->line(__("The vacation request :title has been created correctly by :creator on your behalf in the :appName.", [
|
||||
->line(__("The vacation request :title has been created correctly by user :creator on your behalf in the :appName.", [
|
||||
"title" => $title,
|
||||
"appName" => $appName,
|
||||
"creator" => $creator,
|
||||
|
@ -9,4 +9,4 @@ export default function useCurrentYearPeriodInfo() {
|
||||
minDate,
|
||||
maxDate,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
||||
"Sum:": "Suma:",
|
||||
"Date": "Data",
|
||||
"Day of week": "Dzień tygodnia",
|
||||
"Start date": "Data rozpoczecia",
|
||||
"Start date": "Data rozpoczęcia",
|
||||
"End date": "Data zakończenia",
|
||||
"Worked hours": "Ilość godzin",
|
||||
"Hi :user!": "Cześć :user!",
|
||||
@ -68,9 +68,9 @@
|
||||
"Vacation request :title has been approved": "Wniosek urlopowy :title został zatwierdzony",
|
||||
"The vacation request :title for user :requester has been approved.": "Wniosek urlopowy :title od użytkownika :requester został zatwierdzony.",
|
||||
"Vacation request :title has been cancelled": "Wniosek urlopowy :title został anulowany",
|
||||
"The vacation request :title for user :requester has been cancelled.": "Wniosek urlopowy :title od użytkownika :requester został anulowany.",
|
||||
"The vacation request :title for user :requester has been cancelled.": "Wniosek urlopowy :title od użytkownika :requester został anulowany.",
|
||||
"Vacation request :title has been rejected": "Wniosek urlopowy :title został odrzucony",
|
||||
"The vacation request :title for user :requester has been rejected.": "Wniosek urlopowy :title od użytkownika :requester został odrzucony.",
|
||||
"Vacation request :title has been created on your behalf.": "Wniosek urlopowy :title został utworzony w Twoim imieniu",
|
||||
"The vacation request :title has been created correctly by :creator on your behalf in the :appName.": "W systemie :appName został w Twoim imieniu poprawnie utworzony wnioskek urlopowy :title przez :creator"
|
||||
"Vacation request :title has been created on your behalf": "Wniosek urlopowy :title został utworzony w Twoim imieniu",
|
||||
"The vacation request :title has been created correctly by user :creator on your behalf in the :appName.": "W systemie :appName został poprawnie utworzony wniosek urlopowy :title w Twoim imieniu przez użytkownika :creator."
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ use Toby\Domain\Enums\VacationRequestState;
|
||||
use Toby\Domain\Enums\VacationType;
|
||||
use Toby\Domain\Events\VacationRequestAcceptedByAdministrative;
|
||||
use Toby\Domain\Events\VacationRequestAcceptedByTechnical;
|
||||
use Toby\Domain\Events\VacationRequestApproved;
|
||||
use Toby\Domain\Events\VacationRequestRejected;
|
||||
use Toby\Domain\PolishHolidaysRetriever;
|
||||
use Toby\Eloquent\Models\User;
|
||||
@ -89,6 +90,85 @@ class VacationRequestTest extends FeatureTestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function testUserCanCreateVacationRequestOnEmployeeBehalf(): void
|
||||
{
|
||||
$creator = User::factory()->createQuietly();
|
||||
$user = User::factory()->createQuietly();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
VacationLimit::factory([
|
||||
"days" => 20,
|
||||
])
|
||||
->for($user)
|
||||
->for($currentYearPeriod)
|
||||
->create();
|
||||
|
||||
$this->actingAs($creator)
|
||||
->post("/vacation-requests", [
|
||||
"user" => $user->id,
|
||||
"creator_id" => $creator->id,
|
||||
"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.",
|
||||
])
|
||||
->assertSessionHasNoErrors();
|
||||
|
||||
$this->assertDatabaseHas("vacation_requests", [
|
||||
"user_id" => $user->id,
|
||||
"creator_id" => $creator->id,
|
||||
"year_period_id" => $currentYearPeriod->id,
|
||||
"name" => "1/" . $currentYearPeriod->year,
|
||||
"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.",
|
||||
]);
|
||||
}
|
||||
|
||||
public function testUserCanCreateVacationRequestOnEmployeeBehalfAndSkipAcceptanceFlow(): void
|
||||
{
|
||||
Event::fake(VacationRequestApproved::class);
|
||||
|
||||
$creator = User::factory()->createQuietly();
|
||||
$user = User::factory()->createQuietly();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
VacationLimit::factory([
|
||||
"days" => 20,
|
||||
])
|
||||
->for($user)
|
||||
->for($currentYearPeriod)
|
||||
->create();
|
||||
|
||||
$this->actingAs($creator)
|
||||
->post("/vacation-requests", [
|
||||
"user" => $user->id,
|
||||
"creator_id" => $creator->id,
|
||||
"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.",
|
||||
"skipFlow" => 1,
|
||||
])
|
||||
->assertSessionHasNoErrors();
|
||||
|
||||
$this->assertDatabaseHas("vacation_requests", [
|
||||
"user_id" => $user->id,
|
||||
"creator_id" => $creator->id,
|
||||
"year_period_id" => $currentYearPeriod->id,
|
||||
"name" => "1/" . $currentYearPeriod->year,
|
||||
"type" => VacationType::Vacation->value,
|
||||
"state" => VacationRequestState::Approved,
|
||||
"from" => Carbon::create($currentYearPeriod->year, 2, 7)->toDateString(),
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 11)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
]);
|
||||
}
|
||||
|
||||
public function testTechnicalApproverCanApproveVacationRequest(): void
|
||||
{
|
||||
Event::fake(VacationRequestAcceptedByTechnical::class);
|
||||
|
Loading…
x
Reference in New Issue
Block a user