mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 00:02:15 +00:00
license upgrade function
This commit is contained in:
@@ -6,7 +6,9 @@ use Tests\TestCase;
|
||||
use App\Users\Models\User;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Domain\Settings\Models\Setting;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Domain\Settings\Actions\SeedDefaultSettingsAction;
|
||||
use Domain\Localization\Actions\SeedDefaultLanguageAction;
|
||||
|
||||
class SettingsTest extends TestCase
|
||||
{
|
||||
@@ -241,4 +243,64 @@ class SettingsTest extends TestCase
|
||||
'host' => null,
|
||||
])->assertStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_upgrade_license()
|
||||
{
|
||||
Http::fake([
|
||||
'https://verify.vuefilemanager.com/api/verify-code/*' => Http::response('b6896a44017217c36f4a6fdc56699728'),
|
||||
]);
|
||||
|
||||
collect([
|
||||
[
|
||||
'name' => 'license',
|
||||
'value' => 'regular',
|
||||
],
|
||||
[
|
||||
'name' => 'purchase_code',
|
||||
'value' => '22b28b36-6d84-41b2-a920-a884b2bf63b6',
|
||||
],
|
||||
])->each(function ($col) {
|
||||
Setting::updateOrCreate([
|
||||
'name' => $col['name'],
|
||||
], [
|
||||
'value' => $col['value'],
|
||||
]);
|
||||
});
|
||||
|
||||
resolve(SeedDefaultLanguageAction::class)();
|
||||
|
||||
$admin = User::factory()
|
||||
->create(['role' => 'admin']);
|
||||
|
||||
$this
|
||||
->actingAs($admin)
|
||||
->postJson('/api/admin/upgrade-license', [
|
||||
'purchaseCode' => '6ab28b36-6d84-41b2-a920-a884b2bf63b6',
|
||||
])->assertStatus(201);
|
||||
|
||||
collect([
|
||||
[
|
||||
'name' => 'license',
|
||||
'value' => 'extended',
|
||||
],
|
||||
[
|
||||
'name' => 'purchase_code',
|
||||
'value' => '6ab28b36-6d84-41b2-a920-a884b2bf63b6',
|
||||
],
|
||||
])->each(function ($col) {
|
||||
$this->assertDatabaseHas('settings', [
|
||||
'name' => $col['name'],
|
||||
'value' => $col['value'],
|
||||
]);
|
||||
});
|
||||
|
||||
$this->assertDatabaseHas('language_translations', [
|
||||
'key' => 'go_to_subscription',
|
||||
'value' => 'Go to Subscription',
|
||||
'lang' => 'en',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user