34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
|
|
$tabs = ['dashboard', 'cloud', 'users', 'backups', 'invoices', 'support'];
|
|
|
|
it('redirects guests from portal tabs to login', function (string $tab) {
|
|
$this->get(route($tab))->assertRedirect('/login');
|
|
})->with($tabs);
|
|
|
|
it('renders portal tabs for authenticated users', function (string $tab) {
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user)->get(route($tab))
|
|
->assertOk()
|
|
->assertSee('CluPilot');
|
|
})->with($tabs);
|
|
|
|
it('binds the cloud card to the real instance', function () {
|
|
$user = \App\Models\User::factory()->create(['email' => 'c@cloud.test']);
|
|
$customer = \App\Models\Customer::factory()->create(['email' => 'c@cloud.test', 'user_id' => $user->id, 'name' => 'Acme AG']);
|
|
$host = \App\Models\Host::factory()->active()->create();
|
|
\App\Models\Instance::factory()->create([
|
|
'customer_id' => $customer->id, 'host_id' => $host->id, 'status' => 'active',
|
|
'plan' => 'business', 'subdomain' => 'acme-ag', 'quota_gb' => 1000,
|
|
]);
|
|
|
|
$this->actingAs($user)->get(route('cloud'))
|
|
->assertOk()
|
|
->assertSee('acme-ag.'.config('provisioning.dns.zone')) // real subdomain, not a fixture
|
|
->assertSee(__('billing.plan.business'))
|
|
->assertSee(__('billing.perf.high'));
|
|
});
|