Repo rebuild
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Platform\tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Modules\Company\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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user