From 8024371149d70567d7f4e6bb7b603fcc811523a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Thu, 7 Nov 2024 16:24:01 +0000 Subject: [PATCH] wip --- .env.ci | 2 +- .github/workflows/tests.yml | 2 +- database/factories/ElectionFactory.php | 1 + tests/Feature/Livewire/Pages/ElectionTurnoutsTest.php | 6 +++++- tests/TestCase.php | 3 ++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.env.ci b/.env.ci index a661b6e..d29ef4e 100644 --- a/.env.ci +++ b/.env.ci @@ -5,7 +5,7 @@ APP_DEBUG=true DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 -DB_DATABASE=rezultatevot +DB_DATABASE=tests DB_USERNAME=root DB_PASSWORD=tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cbdf34d..2407561 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: mysql: image: mysql:8.0 env: - MYSQL_DATABASE: rezultatevot + MYSQL_DATABASE: tests MYSQL_ALLOW_EMPTY_PASSWORD: true ports: - 3306 diff --git a/database/factories/ElectionFactory.php b/database/factories/ElectionFactory.php index 59d1e44..4776289 100644 --- a/database/factories/ElectionFactory.php +++ b/database/factories/ElectionFactory.php @@ -41,6 +41,7 @@ public function definition(): array ->loser(fn () => null), 'year' => $year, 'is_live' => false, + 'properties' => [], ]; } diff --git a/tests/Feature/Livewire/Pages/ElectionTurnoutsTest.php b/tests/Feature/Livewire/Pages/ElectionTurnoutsTest.php index 3854e08..41677da 100644 --- a/tests/Feature/Livewire/Pages/ElectionTurnoutsTest.php +++ b/tests/Feature/Livewire/Pages/ElectionTurnoutsTest.php @@ -5,6 +5,7 @@ namespace Tests\Feature\Livewire\Pages; use App\Livewire\Pages\ElectionTurnouts; +use App\Models\Election; use Livewire\Livewire; use PHPUnit\Framework\Attributes\Test; use Tests\TestCase; @@ -14,7 +15,10 @@ class ElectionTurnoutsTest extends TestCase #[Test] public function renders_successfully() { + $election = Election::factory() + ->create(); + Livewire::test(ElectionTurnouts::class) - ->assertStatus(200); + ->assertOk(); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 6ac0072..281e844 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,9 +4,10 @@ namespace Tests; +use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { - // + use LazilyRefreshDatabase; }