An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
chore(tests): reorganize feature suites and expand team auth coverage
Andras Bacsai347af07a79ba
diff --git a/tests/Feature/ApplicationHealthCheckApiTest.php b/tests/Feature/Api/ApplicationHealthCheckApiTest.phpsimilarity index 100%rename from tests/Feature/ApplicationHealthCheckApiTest.phprename to tests/Feature/Api/ApplicationHealthCheckApiTest.phpdiff --git a/tests/Feature/CloudProviderTokenApiTest.php b/tests/Feature/Api/CloudProviderTokenApiTest.phpsimilarity index 100%rename from tests/Feature/CloudProviderTokenApiTest.phprename to tests/Feature/Api/CloudProviderTokenApiTest.phpdiff --git a/tests/Feature/DatabaseBackupCreationApiTest.php b/tests/Feature/Api/DatabaseBackupCreationApiTest.phpsimilarity index 100%rename from tests/Feature/DatabaseBackupCreationApiTest.phprename to tests/Feature/Api/DatabaseBackupCreationApiTest.phpdiff --git a/tests/Feature/DeploymentCancellationApiTest.php b/tests/Feature/Api/DeploymentCancellationApiTest.phpsimilarity index 100%rename from tests/Feature/DeploymentCancellationApiTest.phprename to tests/Feature/Api/DeploymentCancellationApiTest.phpdiff --git a/tests/Feature/DomainsByServerApiTest.php b/tests/Feature/Api/DomainsByServerApiTest.phpsimilarity index 93%rename from tests/Feature/DomainsByServerApiTest.phprename to tests/Feature/Api/DomainsByServerApiTest.phpindex 1e799bec55..8c675c202f 100644--- a/tests/Feature/DomainsByServerApiTest.php+++ b/tests/Feature/Api/DomainsByServerApiTest.php@@ -25,7 +25,7 @@ beforeEach(function () {$this->environment = Environment::factory()->create(['project_id' => $this->project->id]);});-function authHeaders(): array+function domainApiAuthHeaders(): array{return ['Authorization' => 'Bearer '.test()->bearerToken,@@ -40,7 +40,7 @@ test('returns domains for own team application via uuid query param', function ('destination_type' => $this->destination->getMorphClass(),]);- $response = $this->withHeaders(authHeaders())+ $response = $this->withHeaders(domainApiAuthHeaders())->getJson("/api/v1/servers/{$this->server->uuid}/domains?uuid={$application->uuid}");$response->assertOk();@@ -64,7 +64,7 @@ test('returns 404 when application uuid belongs to another team', function () {'destination_type' => $otherDestination->getMorphClass(),]);- $response = $this->withHeaders(authHeaders())+ $response = $this->withHeaders(domainApiAuthHeaders())->getJson("/api/v1/servers/{$this->server->uuid}/domains?uuid={$otherApplication->uuid}");$response->assertNotFound();@@ -72,7 +72,7 @@ test('returns 404 when application uuid belongs to another team', function () {});test('returns 404 for nonexistent application uuid', function () {- $response = $this->withHeaders(authHeaders())+ $response = $this->withHeaders(domainApiAuthHeaders())->getJson("/api/v1/servers/{$this->server->uuid}/domains?uuid=nonexistent-uuid");$response->assertNotFound();diff --git a/tests/Feature/EnvironmentVariableUpdateApiTest.php b/tests/Feature/Api/EnvironmentVariableUpdateApiTest.phpsimilarity index 100%rename from tests/Feature/EnvironmentVariableUpdateApiTest.phprename to tests/Feature/Api/EnvironmentVariableUpdateApiTest.phpdiff --git a/tests/Feature/GithubAppsListApiTest.php b/tests/Feature/Api/GithubAppsListApiTest.phpsimilarity index 100%rename from tests/Feature/GithubAppsListApiTest.phprename to tests/Feature/Api/GithubAppsListApiTest.phpdiff --git a/tests/Feature/HetznerApiTest.php b/tests/Feature/Api/HetznerApiTest.phpsimilarity index 100%rename from tests/Feature/HetznerApiTest.phprename to tests/Feature/Api/HetznerApiTest.phpdiff --git a/tests/Feature/ScheduledTaskApiTest.php b/tests/Feature/Api/ScheduledTaskApiTest.phpsimilarity index 100%rename from tests/Feature/ScheduledTaskApiTest.phprename to tests/Feature/Api/ScheduledTaskApiTest.phpdiff --git a/tests/Feature/ApplicationBuildpackCleanupTest.php b/tests/Feature/Application/ApplicationBuildpackCleanupTest.phpsimilarity index 100%rename from tests/Feature/ApplicationBuildpackCleanupTest.phprename to tests/Feature/Application/ApplicationBuildpackCleanupTest.phpdiff --git a/tests/Feature/BuildpackSwitchCleanupTest.php b/tests/Feature/Application/BuildpackSwitchCleanupTest.phpsimilarity index 100%rename from tests/Feature/BuildpackSwitchCleanupTest.phprename to tests/Feature/Application/BuildpackSwitchCleanupTest.phpdiff --git a/tests/Feature/GithubSourceChangeTest.php b/tests/Feature/Application/GithubSourceChangeTest.phpsimilarity index 100%rename from tests/Feature/GithubSourceChangeTest.phprename to tests/Feature/Application/GithubSourceChangeTest.phpdiff --git a/tests/Feature/GithubSourceCreateTest.php b/tests/Feature/Application/GithubSourceCreateTest.phpsimilarity index 100%rename from tests/Feature/GithubSourceCreateTest.phprename to tests/Feature/Application/GithubSourceCreateTest.phpdiff --git a/tests/Feature/DeletesUserSessionsTest.php b/tests/Feature/Auth/DeletesUserSessionsTest.phpsimilarity index 100%rename from tests/Feature/DeletesUserSessionsTest.phprename to tests/Feature/Auth/DeletesUserSessionsTest.phpdiff --git a/tests/Feature/LoginRateLimitIPTest.php b/tests/Feature/Auth/LoginRateLimitIPTest.phpsimilarity index 100%rename from tests/Feature/LoginRateLimitIPTest.phprename to tests/Feature/Auth/LoginRateLimitIPTest.phpdiff --git a/tests/Feature/TwoFactorChallengeAccessTest.php b/tests/Feature/Auth/TwoFactorChallengeAccessTest.phpsimilarity index 100%rename from tests/Feature/TwoFactorChallengeAccessTest.phprename to tests/Feature/Auth/TwoFactorChallengeAccessTest.phpdiff --git a/tests/Feature/ApiAuthorizationTest.php b/tests/Feature/Authorization/ApiAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/ApiAuthorizationTest.phprename to tests/Feature/Authorization/ApiAuthorizationTest.phpdiff --git a/tests/Feature/ApiTokenPermissionTest.php b/tests/Feature/Authorization/ApiTokenPermissionTest.phpsimilarity index 100%rename from tests/Feature/ApiTokenPermissionTest.phprename to tests/Feature/Authorization/ApiTokenPermissionTest.phpdiff --git a/tests/Feature/ApplicationConfigAuthorizationTest.php b/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/ApplicationConfigAuthorizationTest.phprename to tests/Feature/Authorization/ApplicationConfigAuthorizationTest.phpdiff --git a/tests/Feature/CloudProviderAuthorizationTest.php b/tests/Feature/Authorization/CloudProviderAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/CloudProviderAuthorizationTest.phprename to tests/Feature/Authorization/CloudProviderAuthorizationTest.phpdiff --git a/tests/Feature/DashboardAuthorizationTest.php b/tests/Feature/Authorization/DashboardAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/DashboardAuthorizationTest.phprename to tests/Feature/Authorization/DashboardAuthorizationTest.phpdiff --git a/tests/Feature/DatabaseConfigAuthorizationTest.php b/tests/Feature/Authorization/DatabaseConfigAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/DatabaseConfigAuthorizationTest.phprename to tests/Feature/Authorization/DatabaseConfigAuthorizationTest.phpdiff --git a/tests/Feature/DestinationOwnershipTest.php b/tests/Feature/Authorization/DestinationOwnershipTest.phpsimilarity index 100%rename from tests/Feature/DestinationOwnershipTest.phprename to tests/Feature/Authorization/DestinationOwnershipTest.phpdiff --git a/tests/Feature/NavbarDeleteTeamAuthorizationTest.php b/tests/Feature/Authorization/NavbarDeleteTeamAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/NavbarDeleteTeamAuthorizationTest.phprename to tests/Feature/Authorization/NavbarDeleteTeamAuthorizationTest.phpdiff --git a/tests/Feature/NotificationAuthorizationTest.php b/tests/Feature/Authorization/NotificationAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/NotificationAuthorizationTest.phprename to tests/Feature/Authorization/NotificationAuthorizationTest.phpdiff --git a/tests/Feature/ProjectEnvironmentAuthorizationTest.php b/tests/Feature/Authorization/ProjectEnvironmentAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/ProjectEnvironmentAuthorizationTest.phprename to tests/Feature/Authorization/ProjectEnvironmentAuthorizationTest.phpdiff --git a/tests/Feature/ResourceHeadingAuthorizationTest.php b/tests/Feature/Authorization/ResourceHeadingAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/ResourceHeadingAuthorizationTest.phprename to tests/Feature/Authorization/ResourceHeadingAuthorizationTest.phpdiff --git a/tests/Feature/ResourceOperationsCrossTenantTest.php b/tests/Feature/Authorization/ResourceOperationsCrossTenantTest.phpsimilarity index 100%rename from tests/Feature/ResourceOperationsCrossTenantTest.phprename to tests/Feature/Authorization/ResourceOperationsCrossTenantTest.phpdiff --git a/tests/Feature/SecurityPageAuthorizationTest.php b/tests/Feature/Authorization/SecurityPageAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/SecurityPageAuthorizationTest.phprename to tests/Feature/Authorization/SecurityPageAuthorizationTest.phpdiff --git a/tests/Feature/ServerAuthorizationTest.php b/tests/Feature/Authorization/ServerAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/ServerAuthorizationTest.phprename to tests/Feature/Authorization/ServerAuthorizationTest.phpdiff --git a/tests/Feature/ServiceConfigAuthorizationTest.php b/tests/Feature/Authorization/ServiceConfigAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/ServiceConfigAuthorizationTest.phprename to tests/Feature/Authorization/ServiceConfigAuthorizationTest.phpdiff --git a/tests/Feature/SharedResourceAuthorizationTest.php b/tests/Feature/Authorization/SharedResourceAuthorizationTest.phpsimilarity index 100%rename from tests/Feature/SharedResourceAuthorizationTest.phprename to tests/Feature/Authorization/SharedResourceAuthorizationTest.phpdiff --git a/tests/Feature/TeamAuthorizationTest.php b/tests/Feature/Authorization/TeamAuthorizationTest.phpsimilarity index 63%rename from tests/Feature/TeamAuthorizationTest.phprename to tests/Feature/Authorization/TeamAuthorizationTest.phpindex af30c8deed..e99e55a2c1 100644--- a/tests/Feature/TeamAuthorizationTest.php+++ b/tests/Feature/Authorization/TeamAuthorizationTest.php@@ -205,3 +205,123 @@ test('user from different team cannot manage members', function () {expect(auth()->user()->can('manageMembers', $this->team))->toBeFalse();});++// --- Team Policy: view ---++test('owner can view team', function () {+ $this->actingAs($this->owner);+ session(['currentTeam' => $this->team]);++ expect(auth()->user()->can('view', $this->team))->toBeTrue();+});++test('admin can view team', function () {+ $this->actingAs($this->admin);+ session(['currentTeam' => $this->team]);++ expect(auth()->user()->can('view', $this->team))->toBeTrue();+});++test('member can view team', function () {+ $this->actingAs($this->member);+ session(['currentTeam' => $this->team]);++ expect(auth()->user()->can('view', $this->team))->toBeTrue();+});++test('non-team member cannot view team', function () {+ $outsider = User::factory()->create();+ $this->actingAs($outsider);+ session(['currentTeam' => $this->team]);++ expect($outsider->can('view', $this->team))->toBeFalse();+});++// --- Team Policy: viewAdmin ---++test('owner can view admin panel', function () {+ $this->actingAs($this->owner);+ session(['currentTeam' => $this->team]);++ expect(auth()->user()->can('viewAdmin', $this->team))->toBeTrue();+});++test('admin can view admin panel', function () {+ $this->actingAs($this->admin);+ session(['currentTeam' => $this->team]);++ expect(auth()->user()->can('viewAdmin', $this->team))->toBeTrue();+});++test('member cannot view admin panel', function () {+ $this->actingAs($this->member);+ session(['currentTeam' => $this->team]);++ expect(auth()->user()->can('viewAdmin', $this->team))->toBeFalse();+});++test('non-team member cannot view admin panel', function () {+ $outsider = User::factory()->create();+ $this->actingAs($outsider);+ session(['currentTeam' => $this->team]);++ expect($outsider->can('viewAdmin', $this->team))->toBeFalse();+});++// --- Non-team member isolation ---++test('non-team member cannot update team', function () {+ $outsider = User::factory()->create();+ $this->actingAs($outsider);+ session(['currentTeam' => $this->team]);++ expect($outsider->can('update', $this->team))->toBeFalse();+});++test('non-team member cannot delete team', function () {+ $outsider = User::factory()->create();+ $this->actingAs($outsider);+ session(['currentTeam' => $this->team]);++ expect($outsider->can('delete', $this->team))->toBeFalse();+});++test('non-team member cannot manage members', function () {+ $outsider = User::factory()->create();+ $this->actingAs($outsider);+ session(['currentTeam' => $this->team]);++ expect($outsider->can('manageMembers', $this->team))->toBeFalse();+});++test('non-team member cannot manage invitations', function () {+ $outsider = User::factory()->create();+ $this->actingAs($outsider);+ session(['currentTeam' => $this->team]);++ expect($outsider->can('manageInvitations', $this->team))->toBeFalse();+});++// --- Team creation and model-level protection ---++test('member can create a new independent team', function () {+ $this->actingAs($this->member);+ session(['currentTeam' => $this->team]);++ $newTeam = Team::create([+ 'name' => 'New Team',+ 'description' => 'Created by member',+ 'personal_team' => false,+ ]);++ expect($newTeam)->toBeInstanceOf(Team::class)+ ->and($newTeam->name)->toBe('New Team');+});++test('member cannot update an existing team at model level', function () {+ $this->actingAs($this->member);+ session(['currentTeam' => $this->team]);++ expect(fn () => $this->team->update(['name' => 'Hacked']))+ ->toThrow(\Exception::class, 'You are not allowed to update this team.');+});diff --git a/tests/Feature/ConvertContainerEnvsToArray.php b/tests/Feature/EnvironmentVariable/ConvertContainerEnvsToArrayTest.phpsimilarity index 100%rename from tests/Feature/ConvertContainerEnvsToArray.phprename to tests/Feature/EnvironmentVariable/ConvertContainerEnvsToArrayTest.phpdiff --git a/tests/Feature/EnvironmentVariableSharedSpacingTest.php b/tests/Feature/EnvironmentVariable/EnvironmentVariableSharedSpacingTest.phpsimilarity index 100%rename from tests/Feature/EnvironmentVariableSharedSpacingTest.phprename to tests/Feature/EnvironmentVariable/EnvironmentVariableSharedSpacingTest.phpdiff --git a/tests/Feature/MultilineEnvironmentVariableTest.php b/tests/Feature/EnvironmentVariable/MultilineEnvironmentVariableTest.phpsimilarity index 100%rename from tests/Feature/MultilineEnvironmentVariableTest.phprename to tests/Feature/EnvironmentVariable/MultilineEnvironmentVariableTest.phpdiff --git a/tests/Feature/ExecuteContainerCommandTest.php b/tests/Feature/ExecuteContainerCommandTest.phpdeleted file mode 100644index 6d485fe652..0000000000--- a/tests/Feature/ExecuteContainerCommandTest.php+++ /dev/null@@ -1,57 +0,0 @@-<?php--namespace Tests\Feature;--use App\Models\Application;-use App\Models\Server;-use App\Models\User;-use PHPUnit\Framework\Attributes\Test;-use Tests\TestCase;-use Tests\Traits\HandlesTestDatabase;--class ExecuteContainerCommandTest extends TestCase-{- use HandlesTestDatabase;-- private $user;-- private $team;-- private $server;-- private $application;-- protected function setUp(): void- {- parent::setUp();-- // Only set up database for tests that need it- if ($this->shouldSetUpDatabase()) {- $this->setUpTestDatabase();- }- // Create test data- $this->user = User::factory()->create();- $this->team = $this->user->teams()->first();- $this->server = Server::factory()->create(['team_id' => $this->team->id]);- $this->application = Application::factory()->create();-- // Login the user- $this->actingAs($this->user);- }-- protected function tearDown(): void- {- if ($this->shouldSetUpDatabase()) {- $this->tearDownTestDatabase();- }- parent::tearDown();- }-- private function shouldSetUpDatabase(): bool- {- return in_array($this->name(), [- 'it_allows_valid_container_access',- 'it_prevents_cross_server_container_access',- ]);- }-}diff --git a/tests/Feature/CloudInitScriptTest.php b/tests/Feature/Helpers/CloudInitScriptTest.phpsimilarity index 100%rename from tests/Feature/CloudInitScriptTest.phprename to tests/Feature/Helpers/CloudInitScriptTest.phpdiff --git a/tests/Feature/ConvertArraysTest.php b/tests/Feature/Helpers/ConvertArraysTest.phpsimilarity index 100%rename from tests/Feature/ConvertArraysTest.phprename to tests/Feature/Helpers/ConvertArraysTest.phpdiff --git a/tests/Feature/ConvertingGitUrlsTest.php b/tests/Feature/Helpers/ConvertingGitUrlsTest.phpsimilarity index 100%rename from tests/Feature/ConvertingGitUrlsTest.phprename to tests/Feature/Helpers/ConvertingGitUrlsTest.phpdiff --git a/tests/Feature/DockerCustomCommandsTest.php b/tests/Feature/Helpers/DockerCustomCommandsTest.phpsimilarity index 100%rename from tests/Feature/DockerCustomCommandsTest.phprename to tests/Feature/Helpers/DockerCustomCommandsTest.phpdiff --git a/tests/Feature/Utf8HandlingTest.php b/tests/Feature/Helpers/Utf8HandlingTest.phpsimilarity index 97%rename from tests/Feature/Utf8HandlingTest.phprename to tests/Feature/Helpers/Utf8HandlingTest.phpindex 50a52c5b2c..6b100b067a 100644--- a/tests/Feature/Utf8HandlingTest.php+++ b/tests/Feature/Helpers/Utf8HandlingTest.php@@ -1,6 +1,6 @@<?php-namespace Tests\Feature;+namespace Tests\Feature\Helpers;use Tests\TestCase;diff --git a/tests/Feature/CheckTraefikVersionJobTest.php b/tests/Feature/Jobs/CheckTraefikVersionJobTest.phpsimilarity index 100%rename from tests/Feature/CheckTraefikVersionJobTest.phprename to tests/Feature/Jobs/CheckTraefikVersionJobTest.phpdiff --git a/tests/Feature/CleanupRedisTest.php b/tests/Feature/Jobs/CleanupRedisTest.phpsimilarity index 100%rename from tests/Feature/CleanupRedisTest.phprename to tests/Feature/Jobs/CleanupRedisTest.phpdiff --git a/tests/Feature/CoolifyTaskRetryTest.php b/tests/Feature/Jobs/CoolifyTaskRetryTest.phpsimilarity index 100%rename from tests/Feature/CoolifyTaskRetryTest.phprename to tests/Feature/Jobs/CoolifyTaskRetryTest.phpdiff --git a/tests/Feature/DatabaseBackupJobTest.php b/tests/Feature/Jobs/DatabaseBackupJobTest.phpsimilarity index 100%rename from tests/Feature/DatabaseBackupJobTest.phprename to tests/Feature/Jobs/DatabaseBackupJobTest.phpdiff --git a/tests/Feature/PushServerUpdateJobTest.php b/tests/Feature/Jobs/PushServerUpdateJobTest.phpsimilarity index 100%rename from tests/Feature/PushServerUpdateJobTest.phprename to tests/Feature/Jobs/PushServerUpdateJobTest.phpdiff --git a/tests/Feature/ScheduledJobManagerStaleLockTest.php b/tests/Feature/Jobs/ScheduledJobManagerStaleLockTest.phpsimilarity index 100%rename from tests/Feature/ScheduledJobManagerStaleLockTest.phprename to tests/Feature/Jobs/ScheduledJobManagerStaleLockTest.phpdiff --git a/tests/Feature/StartupExecutionCleanupTest.php b/tests/Feature/Jobs/StartupExecutionCleanupTest.phpsimilarity index 100%rename from tests/Feature/StartupExecutionCleanupTest.phprename to tests/Feature/Jobs/StartupExecutionCleanupTest.phpdiff --git a/tests/Feature/CaCertificateCommandInjectionTest.php b/tests/Feature/Security/CaCertificateCommandInjectionTest.phpsimilarity index 100%rename from tests/Feature/CaCertificateCommandInjectionTest.phprename to tests/Feature/Security/CaCertificateCommandInjectionTest.phpdiff --git a/tests/Feature/CmdHealthCheckValidationTest.php b/tests/Feature/Security/CmdHealthCheckValidationTest.phpsimilarity index 100%rename from tests/Feature/CmdHealthCheckValidationTest.phprename to tests/Feature/Security/CmdHealthCheckValidationTest.phpdiff --git a/tests/Feature/CommandInjectionSecurityTest.php b/tests/Feature/Security/CommandInjectionSecurityTest.phpsimilarity index 100%rename from tests/Feature/CommandInjectionSecurityTest.phprename to tests/Feature/Security/CommandInjectionSecurityTest.phpdiff --git a/tests/Feature/IpAllowlistTest.php b/tests/Feature/Security/IpAllowlistTest.phpsimilarity index 100%rename from tests/Feature/IpAllowlistTest.phprename to tests/Feature/Security/IpAllowlistTest.phpdiff --git a/tests/Feature/TrustHostsMiddlewareTest.php b/tests/Feature/Security/TrustHostsMiddlewareTest.phpsimilarity index 100%rename from tests/Feature/TrustHostsMiddlewareTest.phprename to tests/Feature/Security/TrustHostsMiddlewareTest.phpdiff --git a/tests/Feature/HetznerServerCreationTest.php b/tests/Feature/Server/HetznerServerCreationTest.phpsimilarity index 100%rename from tests/Feature/HetznerServerCreationTest.phprename to tests/Feature/Server/HetznerServerCreationTest.phpdiff --git a/tests/Feature/SentinelUpdateCheckIndependenceTest.php b/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.phpsimilarity index 100%rename from tests/Feature/SentinelUpdateCheckIndependenceTest.phprename to tests/Feature/Server/SentinelUpdateCheckIndependenceTest.phpdiff --git a/tests/Feature/ServerIpUniquenessTest.php b/tests/Feature/Server/ServerIpUniquenessTest.phpsimilarity index 100%rename from tests/Feature/ServerIpUniquenessTest.phprename to tests/Feature/Server/ServerIpUniquenessTest.phpdiff --git a/tests/Feature/ServerPatchCheckNotificationTest.php b/tests/Feature/Server/ServerPatchCheckNotificationTest.phpsimilarity index 100%rename from tests/Feature/ServerPatchCheckNotificationTest.phprename to tests/Feature/Server/ServerPatchCheckNotificationTest.phpdiff --git a/tests/Feature/ServerSettingSentinelRestartTest.php b/tests/Feature/Server/ServerSettingSentinelRestartTest.phpsimilarity index 100%rename from tests/Feature/ServerSettingSentinelRestartTest.phprename to tests/Feature/Server/ServerSettingSentinelRestartTest.phpdiff --git a/tests/Feature/ServerSettingWasChangedTest.php b/tests/Feature/Server/ServerSettingWasChangedTest.phpsimilarity index 100%rename from tests/Feature/ServerSettingWasChangedTest.phprename to tests/Feature/Server/ServerSettingWasChangedTest.phpdiff --git a/tests/Feature/ServerStorageCheckIndependenceTest.php b/tests/Feature/Server/ServerStorageCheckIndependenceTest.phpsimilarity index 100%rename from tests/Feature/ServerStorageCheckIndependenceTest.phprename to tests/Feature/Server/ServerStorageCheckIndependenceTest.phpdiff --git a/tests/Feature/ServiceDatabaseTeamTest.php b/tests/Feature/Service/ServiceDatabaseTeamTest.phpsimilarity index 100%rename from tests/Feature/ServiceDatabaseTeamTest.phprename to tests/Feature/Service/ServiceDatabaseTeamTest.phpdiff --git a/tests/Feature/ServiceFqdnUpdatePathTest.php b/tests/Feature/Service/ServiceFqdnUpdatePathTest.phpsimilarity index 100%rename from tests/Feature/ServiceFqdnUpdatePathTest.phprename to tests/Feature/Service/ServiceFqdnUpdatePathTest.phpdiff --git a/tests/Feature/StartDatabaseProxyTest.php b/tests/Feature/Service/StartDatabaseProxyTest.phpsimilarity index 100%rename from tests/Feature/StartDatabaseProxyTest.phprename to tests/Feature/Service/StartDatabaseProxyTest.phpdiff --git a/tests/Feature/ScheduledJobMonitoringTest.php b/tests/Feature/Team/ScheduledJobMonitoringTest.phpsimilarity index 100%rename from tests/Feature/ScheduledJobMonitoringTest.phprename to tests/Feature/Team/ScheduledJobMonitoringTest.phpdiff --git a/tests/Feature/TeamDeletionTest.php b/tests/Feature/Team/TeamDeletionTest.phpsimilarity index 100%rename from tests/Feature/TeamDeletionTest.phprename to tests/Feature/Team/TeamDeletionTest.phpdiff --git a/tests/Feature/TeamInvitationEmailNormalizationTest.php b/tests/Feature/Team/TeamInvitationEmailNormalizationTest.phpsimilarity index 100%rename from tests/Feature/TeamInvitationEmailNormalizationTest.phprename to tests/Feature/Team/TeamInvitationEmailNormalizationTest.phpdiff --git a/tests/Feature/TeamInvitationPrivilegeEscalationTest.php b/tests/Feature/Team/TeamInvitationPrivilegeEscalationTest.phpsimilarity index 100%rename from tests/Feature/TeamInvitationPrivilegeEscalationTest.phprename to tests/Feature/Team/TeamInvitationPrivilegeEscalationTest.phpdiff --git a/tests/Feature/TeamNotificationCheckTest.php b/tests/Feature/Team/TeamNotificationCheckTest.phpsimilarity index 100%rename from tests/Feature/TeamNotificationCheckTest.phprename to tests/Feature/Team/TeamNotificationCheckTest.phpdiff --git a/tests/Feature/TeamPolicyTest.php b/tests/Feature/TeamPolicyTest.phpdeleted file mode 100644index 53b716095e..0000000000--- a/tests/Feature/TeamPolicyTest.php+++ /dev/null@@ -1,232 +0,0 @@-<?php--use App\Models\Team;-use App\Models\User;-use Illuminate\Foundation\Testing\RefreshDatabase;--uses(RefreshDatabase::class);--beforeEach(function () {- // Create a team with owner, admin, and member- $this->team = Team::factory()->create();-- $this->owner = User::factory()->create();- $this->admin = User::factory()->create();- $this->member = User::factory()->create();-- $this->team->members()->attach($this->owner->id, ['role' => 'owner']);- $this->team->members()->attach($this->admin->id, ['role' => 'admin']);- $this->team->members()->attach($this->member->id, ['role' => 'member']);-});--describe('update permission', function () {- test('owner can update team', function () {- $this->actingAs($this->owner);- session(['currentTeam' => $this->team]);- expect($this->owner->can('update', $this->team))->toBeTrue();- });-- test('admin can update team', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);- expect($this->admin->can('update', $this->team))->toBeTrue();- });-- test('member cannot update team', function () {- $this->actingAs($this->member);- session(['currentTeam' => $this->team]);- expect($this->member->can('update', $this->team))->toBeFalse();- });-- test('non-team member cannot update team', function () {- $outsider = User::factory()->create();- $this->actingAs($outsider);- session(['currentTeam' => $this->team]);- expect($outsider->can('update', $this->team))->toBeFalse();- });-});--describe('delete permission', function () {- test('owner can delete team', function () {- $this->actingAs($this->owner);- session(['currentTeam' => $this->team]);- expect($this->owner->can('delete', $this->team))->toBeTrue();- });-- test('admin can delete team', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);- expect($this->admin->can('delete', $this->team))->toBeTrue();- });-- test('member cannot delete team', function () {- $this->actingAs($this->member);- session(['currentTeam' => $this->team]);- expect($this->member->can('delete', $this->team))->toBeFalse();- });-- test('non-team member cannot delete team', function () {- $outsider = User::factory()->create();- $this->actingAs($outsider);- session(['currentTeam' => $this->team]);- expect($outsider->can('delete', $this->team))->toBeFalse();- });-});--describe('manageMembers permission', function () {- test('owner can manage members', function () {- $this->actingAs($this->owner);- session(['currentTeam' => $this->team]);- expect($this->owner->can('manageMembers', $this->team))->toBeTrue();- });-- test('admin can manage members', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);- expect($this->admin->can('manageMembers', $this->team))->toBeTrue();- });-- test('member cannot manage members', function () {- $this->actingAs($this->member);- session(['currentTeam' => $this->team]);- expect($this->member->can('manageMembers', $this->team))->toBeFalse();- });-- test('non-team member cannot manage members', function () {- $outsider = User::factory()->create();- $this->actingAs($outsider);- session(['currentTeam' => $this->team]);- expect($outsider->can('manageMembers', $this->team))->toBeFalse();- });-});--describe('viewAdmin permission', function () {- test('owner can view admin panel', function () {- $this->actingAs($this->owner);- session(['currentTeam' => $this->team]);- expect($this->owner->can('viewAdmin', $this->team))->toBeTrue();- });-- test('admin can view admin panel', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);- expect($this->admin->can('viewAdmin', $this->team))->toBeTrue();- });-- test('member cannot view admin panel', function () {- $this->actingAs($this->member);- session(['currentTeam' => $this->team]);- expect($this->member->can('viewAdmin', $this->team))->toBeFalse();- });-- test('non-team member cannot view admin panel', function () {- $outsider = User::factory()->create();- $this->actingAs($outsider);- session(['currentTeam' => $this->team]);- expect($outsider->can('viewAdmin', $this->team))->toBeFalse();- });-});--describe('manageInvitations permission (privilege escalation fix)', function () {- test('owner can manage invitations', function () {- $this->actingAs($this->owner);- session(['currentTeam' => $this->team]);- expect($this->owner->can('manageInvitations', $this->team))->toBeTrue();- });-- test('admin can manage invitations', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);- expect($this->admin->can('manageInvitations', $this->team))->toBeTrue();- });-- test('member cannot manage invitations (SECURITY FIX)', function () {- // This test verifies the privilege escalation vulnerability is fixed- // Previously, members could see and manage admin invitations- $this->actingAs($this->member);- session(['currentTeam' => $this->team]);- expect($this->member->can('manageInvitations', $this->team))->toBeFalse();- });-- test('non-team member cannot manage invitations', function () {- $outsider = User::factory()->create();- $this->actingAs($outsider);- session(['currentTeam' => $this->team]);- expect($outsider->can('manageInvitations', $this->team))->toBeFalse();- });-});--describe('create team', function () {- test('member can create a new independent team', function () {- $this->actingAs($this->member);- session(['currentTeam' => $this->team]);-- $newTeam = Team::create([- 'name' => 'New Team',- 'description' => 'Created by member',- 'personal_team' => false,- ]);-- expect($newTeam)->toBeInstanceOf(Team::class)- ->and($newTeam->name)->toBe('New Team');- });-- test('member cannot update an existing team', function () {- $this->actingAs($this->member);- session(['currentTeam' => $this->team]);-- expect(fn () => $this->team->update(['name' => 'Hacked']))- ->toThrow(\Exception::class, 'You are not allowed to update this team.');- });-- test('owner can create a new team', function () {- $this->actingAs($this->owner);- session(['currentTeam' => $this->team]);-- $newTeam = Team::create([- 'name' => 'Owner New Team',- 'personal_team' => false,- ]);-- expect($newTeam)->toBeInstanceOf(Team::class);- });-- test('admin can create a new team', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);-- $newTeam = Team::create([- 'name' => 'Admin New Team',- 'personal_team' => false,- ]);-- expect($newTeam)->toBeInstanceOf(Team::class);- });-});--describe('view permission', function () {- test('owner can view team', function () {- $this->actingAs($this->owner);- session(['currentTeam' => $this->team]);- expect($this->owner->can('view', $this->team))->toBeTrue();- });-- test('admin can view team', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);- expect($this->admin->can('view', $this->team))->toBeTrue();- });-- test('member can view team', function () {- $this->actingAs($this->member);- session(['currentTeam' => $this->team]);- expect($this->member->can('view', $this->team))->toBeTrue();- });-- test('non-team member cannot view team', function () {- $outsider = User::factory()->create();- $this->actingAs($outsider);- session(['currentTeam' => $this->team]);- expect($outsider->can('view', $this->team))->toBeFalse();- });-});