mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
test folder refactoring
This commit is contained in:
89
tests/Domain/Maintenance/AppUpgradeTest.php
Normal file
89
tests/Domain/Maintenance/AppUpgradeTest.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\App;
|
||||
|
||||
use App\Models\User;
|
||||
use DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AppUpgradeTest extends TestCase
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_upgrade_default_language_translations()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'admin']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
DB::table('settings')
|
||||
->insert([
|
||||
[
|
||||
'name' => 'language',
|
||||
'value' => 'en',
|
||||
],
|
||||
[
|
||||
'name' => 'license',
|
||||
'value' => 'Extended',
|
||||
]
|
||||
]);
|
||||
|
||||
collect(['en', 'sk'])
|
||||
->map(function ($locale) {
|
||||
|
||||
DB::table('languages')
|
||||
->insert([
|
||||
'id' => Str::uuid(),
|
||||
'name' => 'English',
|
||||
'locale' => $locale
|
||||
]);
|
||||
|
||||
DB::table('language_translations')
|
||||
->insert([
|
||||
[
|
||||
'key' => 'activation.stripe.button',
|
||||
'value' => 'Set up your Stripe account',
|
||||
'lang' => $locale
|
||||
], [
|
||||
'key' => 'activation.stripe.description',
|
||||
'value' => 'This is original test description',
|
||||
'lang' => $locale
|
||||
]
|
||||
]);
|
||||
});
|
||||
|
||||
$this->get('/upgrade/translations')
|
||||
->assertStatus(201);
|
||||
|
||||
collect(['en', 'sk'])
|
||||
->map(function ($locale) {
|
||||
|
||||
$this->assertDatabaseHas('language_translations', [
|
||||
'key' => 'activation.stripe.title',
|
||||
'value' => 'Your Stripe account is not set',
|
||||
'lang' => $locale,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('language_translations', [
|
||||
'key' => 'activation.stripe.description',
|
||||
'value' => 'This is original test description',
|
||||
'lang' => $locale,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseMissing('language_translations', [
|
||||
'key' => 'activation.stripe.description',
|
||||
'value' => 'To charge your users, please set up your Stripe account credentials.',
|
||||
'lang' => $locale,
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user