Revert "Management UI"

This reverts commit f11404c574.
This commit is contained in:
Stefan Lazic committed 2026-09-05 09:31:59 +01:00
1 parent 3e052e56b1
commit 33fb14b773
29 files changed
+94 -881

No files matched your search

+12 -30
View File
@@ -3,8 +3,6 @@
namespace Tests\Feature;
use App\Models\ApplicationInstallation;
use App\Models\Business;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
@@ -12,41 +10,25 @@ class InstallationTest extends TestCase
{
use RefreshDatabase;
public function test_a_clean_database_creates_only_a_platform_super_admin(): void
public function test_a_clean_database_can_be_installed_once(): void
{
$this->get('/install')->assertOk()->assertSee('Create the platform administrator');
$this->get('/install')->assertOk()->assertSee('Create your business');
$response = $this->post('/install', [
'adminName' => 'Platform Admin',
'adminEmail' => 'admin@example.test',
'businessName' => 'Installed Shop',
'slug' => 'installed-shop',
'domain' => 'localhost',
'adminName' => 'First Owner',
'adminEmail' => 'first-owner@example.test',
'password' => 'password123',
'password_confirmation' => 'password123',
]);
$response->assertRedirect(route('manager.dashboard'));
$this->assertDatabaseHas('ApplicationInstallation', [
'id' => 'singleton',
'status' => 'INSTALLED',
'primaryBusinessId' => null,
]);
$this->assertDatabaseHas('User', ['email' => 'admin@example.test', 'isSuperAdmin' => 1]);
$this->assertSame(0, Business::count());
$this->get('/install')->assertRedirect(route('manager.dashboard'));
$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());
}
public function test_installation_cannot_be_repeated(): void
{
$admin = User::factory()->create(['isSuperAdmin' => true]);
ApplicationInstallation::create(['id' => 'singleton', 'status' => 'INSTALLED', 'installedAt' => now(), 'initialAdminUserId' => $admin->id]);
$this->post('/install', [
'adminName' => 'Another Admin',
'adminEmail' => 'another@example.test',
'password' => 'password123',
'password_confirmation' => 'password123',
])->assertRedirect(route('manager.login'));
$this->assertDatabaseMissing('User', ['email' => 'another@example.test']);
}
}