added full module support

This commit is contained in:
Mark Gregory
2026-06-10 12:42:07 +01:00
parent 12d4eec076
commit c59b16d791
63 changed files with 1639 additions and 131 deletions
@@ -0,0 +1,26 @@
<?php
namespace Modules\Platform\tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Modules\Platform\app\Models\Company;
use Modules\Platform\app\Models\LicenseKey;
use Tests\TestCase;
class LicenseKeyTest extends TestCase
{
use RefreshDatabase;
public function test_license_key_is_hashed_and_not_stored_plain(): void
{
$company = Company::create(['name' => 'Tenant A', 'slug' => 'tenant-a']);
$plainKey = LicenseKey::issueFor($company, 'Production licence', 'enterprise', 50);
$license = LicenseKey::firstOrFail();
$this->assertStringStartsWith('WMS-', $plainKey);
$this->assertNotSame($plainKey, $license->key_hash);
$this->assertSame(hash('sha256', $plainKey), $license->key_hash);
$this->assertTrue($company->fresh()->hasActiveLicense());
}
}