51 lines
1.3 KiB
PHP
Executable File
51 lines
1.3 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Modules\Platform\tests\Feature;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Modules\Company\Models\Company;
|
|
use Tests\TestCase;
|
|
|
|
class PlatformAccessTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_mpba_platform_admin_can_access_admin_dashboard_without_licence(): void
|
|
{
|
|
$company = Company::create([
|
|
'name' => 'MPBA Limited',
|
|
'slug' => 'mpba-limited',
|
|
'is_system_company' => true,
|
|
'status' => 'active',
|
|
]);
|
|
|
|
$user = User::factory()->create([
|
|
'company_id' => $company->id,
|
|
'email' => 'mark.gregory@mpba.co.uk',
|
|
'is_platform_admin' => true,
|
|
'is_company_admin' => true,
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get('/admin')
|
|
->assertOk()
|
|
->assertSee('Platform', false);
|
|
}
|
|
|
|
public function test_non_system_company_requires_license(): void
|
|
{
|
|
$company = Company::create([
|
|
'name' => 'Customer Limited',
|
|
'slug' => 'customer-limited',
|
|
'status' => 'active',
|
|
]);
|
|
|
|
$user = User::factory()->create(['company_id' => $company->id]);
|
|
|
|
$this->actingAs($user)
|
|
->get('/dashboard')
|
|
->assertStatus(402);
|
|
}
|
|
}
|