#38 - fix
This commit is contained in:
parent
ef54b37691
commit
8a6d9151fb
@ -53,10 +53,10 @@ class VacationRequestCreatedOnEmployeeBehalf extends Notification
|
|||||||
->greeting(__("Hi :user!", [
|
->greeting(__("Hi :user!", [
|
||||||
"user" => $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,
|
"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,
|
"title" => $title,
|
||||||
"appName" => $appName,
|
"appName" => $appName,
|
||||||
"creator" => $creator,
|
"creator" => $creator,
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
"Sum:": "Suma:",
|
"Sum:": "Suma:",
|
||||||
"Date": "Data",
|
"Date": "Data",
|
||||||
"Day of week": "Dzień tygodnia",
|
"Day of week": "Dzień tygodnia",
|
||||||
"Start date": "Data rozpoczecia",
|
"Start date": "Data rozpoczęcia",
|
||||||
"End date": "Data zakończenia",
|
"End date": "Data zakończenia",
|
||||||
"Worked hours": "Ilość godzin",
|
"Worked hours": "Ilość godzin",
|
||||||
"Hi :user!": "Cześć :user!",
|
"Hi :user!": "Cześć :user!",
|
||||||
@ -71,6 +71,6 @@
|
|||||||
"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",
|
"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.",
|
"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",
|
"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"
|
"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\Enums\VacationType;
|
||||||
use Toby\Domain\Events\VacationRequestAcceptedByAdministrative;
|
use Toby\Domain\Events\VacationRequestAcceptedByAdministrative;
|
||||||
use Toby\Domain\Events\VacationRequestAcceptedByTechnical;
|
use Toby\Domain\Events\VacationRequestAcceptedByTechnical;
|
||||||
|
use Toby\Domain\Events\VacationRequestApproved;
|
||||||
use Toby\Domain\Events\VacationRequestRejected;
|
use Toby\Domain\Events\VacationRequestRejected;
|
||||||
use Toby\Domain\PolishHolidaysRetriever;
|
use Toby\Domain\PolishHolidaysRetriever;
|
||||||
use Toby\Eloquent\Models\User;
|
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
|
public function testTechnicalApproverCanApproveVacationRequest(): void
|
||||||
{
|
{
|
||||||
Event::fake(VacationRequestAcceptedByTechnical::class);
|
Event::fake(VacationRequestAcceptedByTechnical::class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user