3 files changed
+47
-1
No files matched your search
@@ -49,4 +49,22 @@ class InstallationTest extends TestCase
|
||||
|
||||
$this->assertDatabaseMissing('User', ['email' => 'another@example.test']);
|
||||
}
|
||||
|
||||
public function test_an_existing_installation_can_upgrade_its_recorded_initial_admin_once(): void
|
||||
{
|
||||
$legacyOwner = User::factory()->create(['isSuperAdmin' => false, 'passwordHash' => password_hash('password123', PASSWORD_BCRYPT)]);
|
||||
ApplicationInstallation::create([
|
||||
'id' => 'singleton',
|
||||
'status' => 'INSTALLED',
|
||||
'installedAt' => now(),
|
||||
'initialAdminUserId' => $legacyOwner->id,
|
||||
]);
|
||||
|
||||
$this->post('/manager/sign-in', [
|
||||
'email' => $legacyOwner->email,
|
||||
'password' => 'password123',
|
||||
])->assertRedirect(route('manager.dashboard'));
|
||||
|
||||
$this->assertDatabaseHas('User', ['id' => $legacyOwner->id, 'isSuperAdmin' => 1]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user