35 lines
1.2 KiB
PHP
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());
|
|
}
|
|
}
|