Betreiber: Knopf zum Anlegen heißt jetzt "Neuen Mandanten anlegen"
Deploy / test (push) Failing after 2s
Deploy / deploy (push) Skipped

Die Schaltfläche hieß nur "Erstellen" (Filaments Vorgabe) und war als
Einstieg nicht erkennbar. Dazu ein Test, der den ganzen Weg geht: Liste,
Formular, Anlegen samt Dienste-Freischaltung – und prüft, dass ein neuer
Mandant nichts von dem Mandanten erbt, den der Betreiber gerade ansieht.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5 committed 2026-10-24 09:39:41 +02:00
1 parent e0e8c1d856
commit d9383cf3e5
2 files changed
+39 -1

No files matched your search

@@ -5,6 +5,7 @@
use App\Filament\Operator\TenantResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use Filament\Support\Icons\Heroicon;
class ListTenants extends ListRecords
{
@@ -13,7 +14,9 @@ class ListTenants extends ListRecords
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
CreateAction::make()
->label('Neuen Mandanten anlegen')
->icon(Heroicon::OutlinedPlus),
];
}
}
+35
View File
@@ -3,6 +3,7 @@
namespace Tests\Feature;
use App\Enums\TenantServiceKey;
use App\Filament\Operator\Tenants\Pages\CreateTenant;
use App\Filament\Operator\Tenants\Pages\EditTenant;
use App\Models\Tenant;
use App\Models\User;
@@ -99,6 +100,40 @@ public function test_a_landlord_without_a_decision_keeps_the_portal_services():
$this->assertFalse(app(TenantFeatures::class)->enabled(TenantServiceKey::AiOffers, $tenant));
}
public function test_the_operator_creates_a_landlord_in_the_operator_panel(): void
{
$existing = Tenant::factory()->create();
app(TenantContext::class)->set($existing);
$operator = User::factory()->create();
$operator->forceFill(['is_operator' => true])->saveQuietly();
$this->actingAs($operator);
Filament::setCurrentPanel('operator');
$this->get('/betreiber/tenants')->assertOk()->assertSee('Neuen Mandanten anlegen');
$this->get('/betreiber/tenants/create')->assertOk();
Livewire::test(CreateTenant::class)
->fillForm([
'name' => 'Ferienhaus Düne',
'slug' => 'duene',
'is_active' => true,
'services.'.TenantServiceKey::PortalSync->value.'.is_enabled' => true,
'services.'.TenantServiceKey::PortalMail->value.'.is_enabled' => false,
])
->call('create')
->assertHasNoErrors();
$created = Tenant::query()->where('slug', 'duene')->sole();
$this->assertSame('Ferienhaus Düne', $created->name);
$this->assertTrue(app(TenantFeatures::class)->enabled(TenantServiceKey::PortalSync, $created));
$this->assertFalse(app(TenantFeatures::class)->enabled(TenantServiceKey::PortalMail, $created));
// A new landlord must not inherit anything from the one the operator happened to be looking at.
$this->assertNull($created->contact_email);
$this->assertSame(Settings::MODE_TEST, $created->operating_mode);
}
public function test_the_operator_switches_a_service_on_the_tenant_form(): void
{
$tenant = Tenant::factory()->create();