mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
license upgrade function
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\App\Users;
|
||||
|
||||
use Storage;
|
||||
|
||||
@@ -133,7 +133,7 @@ class AdminLanguageTranslatorTest extends TestCase
|
||||
->assertStatus(200)
|
||||
->assertJsonFragment([
|
||||
'locale' => 'en',
|
||||
'close' => 'Close',
|
||||
'close' => 'Close',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class AdminLanguageTranslatorTest extends TestCase
|
||||
->getJson("/api/admin/languages/$language->id")
|
||||
->assertStatus(200)
|
||||
->assertJsonFragment([
|
||||
'close' => 'Close',
|
||||
'close' => 'Close',
|
||||
'locale' => 'en',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,21 +61,21 @@ class SetupWizardTest extends TestCase
|
||||
Setting::all()->each->delete();
|
||||
|
||||
$this->postJson('/api/setup/app-setup', [
|
||||
'color' => '#00BC72',
|
||||
'title' => 'VueFileManager',
|
||||
'description' => 'The best file manager on the internet',
|
||||
'googleAnalytics' => 'UA-12345678-1',
|
||||
'contactMail' => 'john@doe.com',
|
||||
'subscriptionType' => 'metered',
|
||||
'userVerification' => 1,
|
||||
'userRegistration' => 1,
|
||||
'storageLimitation' => 1,
|
||||
'defaultStorage' => 10,
|
||||
'logo' => UploadedFile::fake()->image('fake-logo.jpg'),
|
||||
'color' => '#00BC72',
|
||||
'title' => 'VueFileManager',
|
||||
'description' => 'The best file manager on the internet',
|
||||
'googleAnalytics' => 'UA-12345678-1',
|
||||
'contactMail' => 'john@doe.com',
|
||||
'subscriptionType' => 'metered',
|
||||
'userVerification' => 1,
|
||||
'userRegistration' => 1,
|
||||
'storageLimitation' => 1,
|
||||
'defaultStorage' => 10,
|
||||
'logo' => UploadedFile::fake()->image('fake-logo.jpg'),
|
||||
'logo_dark' => UploadedFile::fake()->image('fake-logo-dark.jpg'),
|
||||
'logo_horizontal' => UploadedFile::fake()->image('fake-logo-horizontal.jpg'),
|
||||
'logo_horizontal' => UploadedFile::fake()->image('fake-logo-horizontal.jpg'),
|
||||
'logo_horizontal_dark' => UploadedFile::fake()->image('fake-logo-horizontal-dark.jpg'),
|
||||
'favicon' => UploadedFile::fake()->image('fake-favicon.jpg'),
|
||||
'favicon' => UploadedFile::fake()->image('fake-favicon.jpg'),
|
||||
])->assertStatus(204);
|
||||
|
||||
$this
|
||||
|
||||
Reference in New Issue
Block a user