- small changes (#98)
* - added some test * - cr fix * wip * wip * Update resources/js/Shared/MainMenu.vue Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com> * fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl> Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,8 @@ namespace Tests\Unit;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Tests\TestCase;
|
||||
use Tests\Traits\InteractsWithYearPeriods;
|
||||
use Toby\Domain\Actions\CreateUserAction;
|
||||
use Toby\Domain\Actions\CreateYearPeriodAction;
|
||||
use Toby\Eloquent\Models\User;
|
||||
use Toby\Eloquent\Models\YearPeriod;
|
||||
|
||||
@@ -27,7 +29,11 @@ class VacationLimitTest extends TestCase
|
||||
$this->assertDatabaseCount("vacation_limits", 0);
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
$user = User::factory()->create();
|
||||
$createUserAction = $this->app->make(CreateUserAction::class);
|
||||
|
||||
$dumpData = User::factory()->raw();
|
||||
|
||||
$user = $createUserAction->execute($dumpData);
|
||||
|
||||
$this->assertDatabaseCount("vacation_limits", 1);
|
||||
|
||||
@@ -40,10 +46,12 @@ class VacationLimitTest extends TestCase
|
||||
public function testWhenYearPeriodIsCreatedThenVacationLimitsForThisYearPeriodAreCreated(): void
|
||||
{
|
||||
$this->assertDatabaseCount("vacation_limits", 0);
|
||||
$createYearPeriodAction = $this->app->make(CreateYearPeriodAction::class);
|
||||
$lastYear = YearPeriod::query()->max("year") + 1;
|
||||
|
||||
User::factory(10)->createQuietly();
|
||||
User::factory(10)->create();
|
||||
|
||||
YearPeriod::factory()->create();
|
||||
$createYearPeriodAction->execute($lastYear);
|
||||
|
||||
$this->assertDatabaseCount("vacation_limits", 10);
|
||||
}
|
||||
|
@@ -39,16 +39,16 @@ class VacationRequestNotificationTest extends TestCase
|
||||
|
||||
$user = User::factory([
|
||||
"role" => Role::Employee,
|
||||
])->createQuietly();
|
||||
])->create();
|
||||
$technicalApprover = User::factory([
|
||||
"role" => Role::TechnicalApprover,
|
||||
])->createQuietly();
|
||||
])->create();
|
||||
$administrativeApprover = User::factory([
|
||||
"role" => Role::AdministrativeApprover,
|
||||
])->createQuietly();
|
||||
])->create();
|
||||
$admin = User::factory([
|
||||
"role" => Role::Administrator,
|
||||
])->createQuietly();
|
||||
])->create();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
@@ -78,13 +78,13 @@ class VacationRequestNotificationTest extends TestCase
|
||||
|
||||
$technicalApprover = User::factory([
|
||||
"role" => Role::TechnicalApprover,
|
||||
])->createQuietly();
|
||||
])->create();
|
||||
$administrativeApprover = User::factory([
|
||||
"role" => Role::AdministrativeApprover,
|
||||
])->createQuietly();
|
||||
])->create();
|
||||
$admin = User::factory([
|
||||
"role" => Role::Administrator,
|
||||
])->createQuietly();
|
||||
])->create();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
|
@@ -40,7 +40,7 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
public function testAfterCreatingVacationRequestOfTypeVacationItTransitsToProperState(): void
|
||||
{
|
||||
$user = User::factory()->createQuietly();
|
||||
$user = User::factory()->create();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
@@ -63,7 +63,7 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
public function testAfterCreatingVacationRequestOfTypeSickVacationItTransitsToProperState(): void
|
||||
{
|
||||
$user = User::factory()->createQuietly();
|
||||
$user = User::factory()->create();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
@@ -85,7 +85,7 @@ class VacationRequestStatesTest extends TestCase
|
||||
|
||||
public function testAfterCreatingVacationRequestOfTypeTimeInLieuItTransitsToProperState(): void
|
||||
{
|
||||
$user = User::factory()->createQuietly();
|
||||
$user = User::factory()->create();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
|
@@ -60,7 +60,14 @@ class YearPeriodRetrieverTest extends TestCase
|
||||
public function testLinks(): void
|
||||
{
|
||||
$expected = [
|
||||
"current" => $this->current->year,
|
||||
"current" => [
|
||||
"year" => $this->currentYearPeriod->year,
|
||||
"link" => route("year-periods.select", $this->currentYearPeriod),
|
||||
],
|
||||
"selected" => [
|
||||
"year" => $this->currentYearPeriod->year,
|
||||
"link" => route("year-periods.select", $this->currentYearPeriod),
|
||||
],
|
||||
"navigation" => [
|
||||
[
|
||||
"year" => $this->previousYearPeriod->year,
|
||||
|
Reference in New Issue
Block a user