новый дизайн
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Models\GameAccountUser;
|
||||
use App\Services\AzerothCoreAccountService;
|
||||
use App\Services\InviteCodeService;
|
||||
use Illuminate\Support\Collection;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Mockery\MockInterface;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -64,7 +65,7 @@ class AdminAccountsFeatureTest extends TestCase
|
||||
$this->mock(InviteCodeService::class, function (MockInterface $mock): void {
|
||||
$mock->shouldReceive('latest')
|
||||
->once()
|
||||
->andReturn(new Collection());
|
||||
->andReturn(new Collection);
|
||||
|
||||
$mock->shouldReceive('stats')
|
||||
->once()
|
||||
@@ -74,11 +75,14 @@ class AdminAccountsFeatureTest extends TestCase
|
||||
$response = $this->actingAs($this->makeUser(3))->get(route('admin.accounts.index'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('Stormmage');
|
||||
$response->assertSee('Аккаунты и персонажи');
|
||||
$response->assertSee('Управление инвайт-кодами');
|
||||
$response->assertSee('Игроки · 1');
|
||||
$response->assertSee('Боты · 1');
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('Admin/Accounts', false)
|
||||
->where('accounts.0.username', 'ADMIN')
|
||||
->where('accounts.0.characters.0.name', 'Stormmage')
|
||||
->where('accountTabs.players.count', 1)
|
||||
->where('accountTabs.bots.count', 1)
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_admin_can_open_bots_tab(): void
|
||||
@@ -104,7 +108,7 @@ class AdminAccountsFeatureTest extends TestCase
|
||||
'online' => false,
|
||||
'joined_at' => '14.03.2026 01:00',
|
||||
'last_login_at' => '14.03.2026 01:30',
|
||||
'characters' => new Collection(),
|
||||
'characters' => new Collection,
|
||||
],
|
||||
]));
|
||||
});
|
||||
@@ -112,7 +116,7 @@ class AdminAccountsFeatureTest extends TestCase
|
||||
$this->mock(InviteCodeService::class, function (MockInterface $mock): void {
|
||||
$mock->shouldReceive('latest')
|
||||
->once()
|
||||
->andReturn(new Collection());
|
||||
->andReturn(new Collection);
|
||||
|
||||
$mock->shouldReceive('stats')
|
||||
->once()
|
||||
@@ -122,8 +126,13 @@ class AdminAccountsFeatureTest extends TestCase
|
||||
$response = $this->actingAs($this->makeUser(3))->get(route('admin.accounts.index', ['tab' => 'bots']));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('RNDBOT0007');
|
||||
$response->assertSee('Боты · 2');
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('Admin/Accounts', false)
|
||||
->where('activeTab', 'bots')
|
||||
->where('accounts.0.username', 'RNDBOT0007')
|
||||
->where('accountTabs.bots.count', 2)
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_admin_can_update_access_level(): void
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Models\GameAccountUser;
|
||||
use App\Services\AzerothCoreAccountService;
|
||||
use App\Services\BalanceService;
|
||||
use Illuminate\Support\Collection;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Mockery\MockInterface;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -20,14 +21,18 @@ class AdminBalancesFeatureTest extends TestCase
|
||||
public function test_admin_can_view_transaction_log(): void
|
||||
{
|
||||
$this->mock(BalanceService::class, function (MockInterface $mock): void {
|
||||
$mock->shouldReceive('adminTransactions')->once()->with(null)->andReturn(new Collection());
|
||||
$mock->shouldReceive('adminTransactions')->once()->with(null)->andReturn(new Collection);
|
||||
});
|
||||
|
||||
$this->actingAs($this->makeUser(3))
|
||||
->get(route('admin.balances.index'))
|
||||
->assertOk()
|
||||
->assertSee('Слёзы Элуны')
|
||||
->assertSee('Последние транзакции');
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Admin/Balances', false)
|
||||
->has('transactions', 0)
|
||||
->where('adjustUrl', route('admin.balances.adjust'))
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_admin_can_credit_account_balance(): void
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\GameAccountUser;
|
||||
use App\Models\News;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminNewsFeatureTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_admin_can_open_news_page_through_inertia(): void
|
||||
{
|
||||
News::query()->create([
|
||||
'title' => 'MoonWell Update',
|
||||
'body' => 'Подробности обновления.',
|
||||
'sort_order' => 5,
|
||||
'is_published' => true,
|
||||
'created_by_username' => 'ADMIN',
|
||||
]);
|
||||
|
||||
$this->actingAs($this->admin())
|
||||
->get(route('admin.news.index'))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Admin/News', false)
|
||||
->where('newsItems.0.title', 'MoonWell Update')
|
||||
->where('newsItems.0.is_published', true)
|
||||
->where('newsStats.published', 1)
|
||||
->where('storeUrl', route('admin.news.store'))
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_regular_player_cannot_open_news_admin(): void
|
||||
{
|
||||
$this->actingAs($this->admin(0))
|
||||
->get(route('admin.news.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
private function admin(int $gmLevel = 3): GameAccountUser
|
||||
{
|
||||
return new GameAccountUser(
|
||||
1,
|
||||
'ADMIN',
|
||||
'ADMIN@EXAMPLE.COM',
|
||||
'ADMIN@EXAMPLE.COM',
|
||||
$gmLevel,
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
str_repeat('AA', 32),
|
||||
str_repeat('BB', 32),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Models\GameAccountUser;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminShopFeatureTest extends TestCase
|
||||
@@ -66,7 +67,16 @@ class AdminShopFeatureTest extends TestCase
|
||||
|
||||
$this->assertDatabaseHas('store_services', ['name' => 'Спектральный тигр', 'price' => 3000], 'store');
|
||||
$this->assertDatabaseHas('store_category_service_link', ['category' => $categoryId], 'store');
|
||||
$this->actingAs($admin)->get(route('admin.shop.index'))->assertOk()->assertSee('Спектральный тигр');
|
||||
$this->actingAs($admin)
|
||||
->get(route('admin.shop.index'))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Admin/Shop', false)
|
||||
->where('categories.0.name', 'Маунты')
|
||||
->where('products.0.name', 'Спектральный тигр')
|
||||
->where('products.0.category_ids.0', $categoryId)
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_regular_player_cannot_manage_store(): void
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Services\AzerothCoreAccountService;
|
||||
use App\Services\BalanceService;
|
||||
use App\Services\GameClientDownloadService;
|
||||
use Illuminate\Support\Collection;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Mockery\MockInterface;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -48,9 +49,15 @@ class CabinetFeatureTest extends TestCase
|
||||
$response = $this->actingAs($user)->get(route('cabinet.index'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('Arthion');
|
||||
$response->assertSee('1 250,00');
|
||||
$response->assertSee('Скачать лаунчер');
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('Cabinet/Index', false)
|
||||
->where('account.username', 'PLAYERONE')
|
||||
->where('wallet.formatted_amount', '1 250,00')
|
||||
->where('characters.0.name', 'Arthion')
|
||||
->has('characters', 1)
|
||||
->where('urls.client', route('cabinet.client'))
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_authenticated_user_can_change_password(): void
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class InertiaPublicPagesFeatureTest extends TestCase
|
||||
{
|
||||
public function test_login_page_uses_inertia(): void
|
||||
{
|
||||
$this->get(route('login'))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Auth/Login', false)
|
||||
->where('auth.authenticated', false)
|
||||
->where('urls.login_store', route('login.store'))
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_hidden_legal_pages_return_not_found(): void
|
||||
{
|
||||
$this->get(route('legal.offer'))->assertNotFound();
|
||||
$this->get(route('legal.privacy'))->assertNotFound();
|
||||
}
|
||||
|
||||
public function test_legal_pages_can_be_published_by_configuration(): void
|
||||
{
|
||||
config(['moonwell.legal.published' => true]);
|
||||
|
||||
$this->get(route('legal.offer'))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Legal/Offer', false)
|
||||
->where('legal.operator_name', config('moonwell.legal.operator_name'))
|
||||
->where('urls.privacy', route('legal.privacy'))
|
||||
->etc()
|
||||
);
|
||||
|
||||
$this->get(route('legal.privacy'))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Legal/Privacy', false)
|
||||
->where('legal.contact_email', config('moonwell.legal.contact_email'))
|
||||
->where('urls.offer', route('legal.offer'))
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class LandingPageTest extends TestCase
|
||||
@@ -11,8 +12,14 @@ class LandingPageTest extends TestCase
|
||||
$response = $this->get(route('landing.index'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('Создать игровой аккаунт');
|
||||
$response->assertSee(config('moonwell.realm.server_name'));
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('Landing/Main', false)
|
||||
->where('realm.server_name', config('moonwell.realm.server_name'))
|
||||
->where('legalUrls.published', false)
|
||||
->where('legalUrls.offer', null)
|
||||
->where('legalUrls.privacy', null)
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_landing_page_uses_https_assets_behind_proxy(): void
|
||||
@@ -26,6 +33,6 @@ class LandingPageTest extends TestCase
|
||||
])->get(route('landing.index'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('href="https://moon-well.online/site.css"', false);
|
||||
$response->assertSee('href="https://moon-well.online/build/assets/', false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Models\GameAccountUser;
|
||||
use App\Models\LoginScreenNews;
|
||||
use App\Services\LoginScreenNewsService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class LoginScreenNewsFeatureTest extends TestCase
|
||||
@@ -86,9 +87,13 @@ class LoginScreenNewsFeatureTest extends TestCase
|
||||
$response = $this->actingAs($this->makeUser(3))->get(route('admin.login-screen-news.index'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('Новости логин-экрана WoW');
|
||||
$response->assertSee('Wrath Update');
|
||||
$response->assertSee(route('launcher.login-news.show'), false);
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('Admin/LoginScreenNews', false)
|
||||
->where('newsItems.0.title', 'Wrath Update')
|
||||
->where('feedUrl', route('launcher.login-news.show'))
|
||||
->where('newsStats.published', 1)
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_admin_page_always_renders_feed_link_with_http_scheme(): void
|
||||
@@ -102,7 +107,11 @@ class LoginScreenNewsFeatureTest extends TestCase
|
||||
])->actingAs($this->makeUser(3))->get(route('admin.login-screen-news.index'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('http://moon-well.online/launcher/login-news.txt', false);
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('Admin/LoginScreenNews', false)
|
||||
->where('feedUrl', 'http://moon-well.online/launcher/login-news.txt')
|
||||
->etc()
|
||||
);
|
||||
}
|
||||
|
||||
public function test_admin_can_create_update_and_delete_news_item(): void
|
||||
|
||||
Reference in New Issue
Block a user