TenantAtlas/tests/Feature/Database/PoliciesSeederTest.php
ahmido 81c010fa00 fix: Harden SyncPoliciesJob supported types handling (#75)
Harden SyncPoliciesJob type input parsing + fail fast when supported types are empty/mismatched. Pass supported policy types from Tenant sync action and add regression tests.

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.fritz.box>
Reviewed-on: #75
2026-01-26 19:23:40 +00:00

24 lines
716 B
PHP

<?php
use App\Models\Tenant;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
test('policies seeder creates default tenant with external_id', function () {
config()->set('tenantpilot.supported_policy_types', []);
$_ENV['INTUNE_TENANT_ID'] = 'test-tenant-id';
$_SERVER['INTUNE_TENANT_ID'] = 'test-tenant-id';
putenv('INTUNE_TENANT_ID=test-tenant-id');
$this->artisan('db:seed', ['--class' => Database\Seeders\PoliciesSeeder::class])
->assertExitCode(0);
$tenant = Tenant::query()->first();
expect($tenant)->not->toBeNull();
expect($tenant->tenant_id)->toBe('test-tenant-id');
expect($tenant->external_id)->toBe('test-tenant-id');
});