#23 - wip
This commit is contained in:
@@ -5,10 +5,10 @@ declare(strict_types=1);
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Tests\TestCase;
|
||||
use Tests\FeatureTestCase;
|
||||
use Toby\Models\User;
|
||||
|
||||
class AuthenticationTest extends TestCase
|
||||
class AuthenticationTest extends FeatureTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
|
@@ -6,10 +6,10 @@ namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
use Tests\FeatureTestCase;
|
||||
use Toby\Models\User;
|
||||
|
||||
class InertiaTest extends TestCase
|
||||
class InertiaTest extends FeatureTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
|
46
tests/Feature/SelectYearPeriodTest.php
Normal file
46
tests/Feature/SelectYearPeriodTest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Tests\FeatureTestCase;
|
||||
use Toby\Helpers\YearPeriodRetriever;
|
||||
use Toby\Models\User;
|
||||
|
||||
class SelectYearPeriodTest extends FeatureTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
public function testUserCanSelectNextYearPeriod(): void
|
||||
{
|
||||
$nextYearPeriod = $this->createYearPeriod(Carbon::now()->year + 1);
|
||||
$user = User::factory()->create();
|
||||
$yearPeriodRetriever = new YearPeriodRetriever();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post("/year-periods/{$nextYearPeriod->id}/select")
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame($nextYearPeriod->id, $yearPeriodRetriever->selected()->id);
|
||||
}
|
||||
|
||||
public function testUserCannotSelectNextYearPeriodIfDoesntExist(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post("/year-periods/25/select")
|
||||
->assertNotFound();
|
||||
}
|
||||
|
||||
public function testIfUserDoesntSelectAnyYearPeriodCurrentActsAsSelected(): void
|
||||
{
|
||||
$yearPeriodRetriever = new YearPeriodRetriever();
|
||||
$currentYearPeriod = $yearPeriodRetriever->current();
|
||||
|
||||
$this->assertSame($currentYearPeriod->id, $yearPeriodRetriever->selected()->id);
|
||||
}
|
||||
}
|
@@ -8,11 +8,11 @@ use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
use Tests\FeatureTestCase;
|
||||
use Toby\Enums\EmploymentForm;
|
||||
use Toby\Models\User;
|
||||
|
||||
class UserTest extends TestCase
|
||||
class UserTest extends FeatureTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
|
Reference in New Issue
Block a user