Files
NextChair/tests/Feature/InstallationTest.php
T
Stefan Lazic 2ef3654841
CI / ci (push) Canceled after 0s
PHP Rebuild
Initial PHP rebuild of the app
2026-09-05 08:21:33 +01:00

35 lines
1.2 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\ApplicationInstallation;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class InstallationTest extends TestCase
{
use RefreshDatabase;
public function test_a_clean_database_can_be_installed_once(): void
{
$this->get('/install')->assertOk()->assertSee('Create your business');
$response = $this->post('/install', [
'businessName' => 'Installed Shop',
'slug' => 'installed-shop',
'domain' => 'localhost',
'adminName' => 'First Owner',
'adminEmail' => 'first-owner@example.test',
'password' => 'password123',
'password_confirmation' => 'password123',
]);
$response->assertRedirect(route('install'));
$this->assertDatabaseHas('ApplicationInstallation', ['id' => 'singleton', 'status' => 'INSTALLED']);
$this->assertDatabaseHas('Business', ['slug' => 'installed-shop']);
$this->assertDatabaseHas('User', ['email' => 'first-owner@example.test']);
$this->get('/install')->assertRedirect(route('public.home'));
$this->assertSame(1, ApplicationInstallation::count());
}
}