TenantAtlas/apps/platform/tests/Feature/Rbac/TenantAdminAuthorizationTest.php
ahmido 292d555eac refactor: consolidate internal tenant model naming (#355)
## Summary
- consolidate internal platform naming from `Tenant` to `Environment` / `ManagedEnvironment` across models, controllers, services, and Filament resources
- rename environment-scoped UI surfaces such as dashboards, chooser flows, navigation, and related widgets to match the updated environment-first domain language
- align middleware, onboarding/review lifecycle services, jobs, and route/context controllers with the new environment-scoped architecture

## Validation
- not rerun as part of this commit/push/PR request

## Notes
- branch is 1 commit ahead of `platform-dev`
- main commit: `refactor: consolidate internal tenant model naming`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #355
2026-05-14 11:13:28 +00:00

34 lines
877 B
PHP

<?php
use App\Filament\Pages\Tenancy\RegisterTenant;
use App\Filament\Resources\ManagedEnvironmentResource;
use Filament\Facades\Filament;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
uses(RefreshDatabase::class);
test('readonly users cannot access tenant registration', function () {
[$user] = createUserWithTenant(role: 'readonly');
$this->actingAs($user);
Filament::setCurrentPanel(Filament::getPanel('admin'));
expect(RegisterTenant::canView())->toBeFalse();
Livewire::actingAs($user)
->test(RegisterTenant::class)
->assertStatus(404);
Filament::setCurrentPanel(null);
});
test('readonly users cannot create tenants via CRUD', function () {
[$user] = createUserWithTenant(role: 'readonly');
$this->actingAs($user);
expect(ManagedEnvironmentResource::canCreate())->toBeFalse();
});