This commit is contained in:
Adrian Hopek
2022-01-24 10:23:08 +01:00
parent 75889a16e6
commit 62fc1e1ca9
14 changed files with 51 additions and 37 deletions

View File

@@ -26,7 +26,7 @@ class VacationLimitTest extends FeatureTestCase
->assertInertia(
fn(Assert $page) => $page
->component("VacationLimits")
->has("limits.data", 10)
->has("limits.data", 10),
);
}
@@ -58,14 +58,14 @@ class VacationLimitTest extends FeatureTestCase
$this->actingAs($admin)
->put("/vacation-limits", [
"items" => $data
"items" => $data,
])
->assertRedirect();
$this->assertDatabaseHas("vacation_limits", [
"id" => $limit1->id,
"has_vacation" => true,
"days" => 25,
"id" => $limit1->id,
"has_vacation" => true,
"days" => 25,
]);
$this->assertDatabaseHas("vacation_limits", [

View File

@@ -16,7 +16,9 @@ trait InteractsWithYearPeriods
public function createYearPeriod(int $year): YearPeriod
{
/** @var YearPeriod $yearPeriod */
$yearPeriod = YearPeriod::factory()->create(["year" => $year]);
$yearPeriod = YearPeriod::factory()->create([
"year" => $year,
]);
return $yearPeriod;
}
@@ -28,7 +30,9 @@ trait InteractsWithYearPeriods
public function markYearPeriodAsSelected(YearPeriod $yearPeriod): void
{
$this->session([YearPeriodRetriever::SESSION_KEY => $yearPeriod->id]);
$this->session([
YearPeriodRetriever::SESSION_KEY => $yearPeriod->id,
]);
}
public function clearSelectedYearPeriod(): void
@@ -42,4 +46,4 @@ trait InteractsWithYearPeriods
YearPeriod::query()->delete();
}
}
}

View File

@@ -9,7 +9,6 @@ use Illuminate\Support\Carbon;
use Tests\TestCase;
use Tests\Traits\InteractsWithYearPeriods;
use Toby\Jobs\CheckYearPeriod;
use Toby\Models\YearPeriod;
class CheckYearPeriodTest extends TestCase
{

View File

@@ -24,7 +24,7 @@ class YearPeriodRetrieverTest extends TestCase
public YearPeriod $nextYearPeriod;
public YearPeriodRetriever $yearPeriodRetriever;
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
@@ -64,20 +64,19 @@ class YearPeriodRetrieverTest extends TestCase
"navigation" => [
[
"year" => $this->previousYearPeriod->year,
"link" => route("year-periods.select", $this->previousYearPeriod)
"link" => route("year-periods.select", $this->previousYearPeriod),
],
[
"year" => $this->currentYearPeriod->year,
"link" => route("year-periods.select", $this->currentYearPeriod)
"link" => route("year-periods.select", $this->currentYearPeriod),
],
[
"year" => $this->nextYearPeriod->year,
"link" => route("year-periods.select", $this->nextYearPeriod)
"link" => route("year-periods.select", $this->nextYearPeriod),
],
]
],
];
$this->assertSame($expected, $this->yearPeriodRetriever->links());
}
}