вкладка для ботов в админке

This commit is contained in:
2026-03-14 02:06:27 +04:00
parent 5a346a312d
commit d4880d2f05
8 changed files with 170 additions and 20 deletions
+53 -1
View File
@@ -28,9 +28,14 @@ class AdminAccountsFeatureTest extends TestCase
public function test_admin_can_open_accounts_page(): void
{
$this->mock(AzerothCoreAccountService::class, function (MockInterface $mock): void {
$mock->shouldReceive('listAccounts')
$mock->shouldReceive('accountTypeStats')
->once()
->with(null)
->andReturn(['players' => 1, 'bots' => 1]);
$mock->shouldReceive('listAccounts')
->once()
->with(null, 'players')
->andReturn(new Collection([
[
'id' => 1,
@@ -72,6 +77,53 @@ class AdminAccountsFeatureTest extends TestCase
$response->assertSee('Stormmage');
$response->assertSee('Аккаунты и персонажи');
$response->assertSee('Управление инвайт-кодами');
$response->assertSee('Игроки · 1');
$response->assertSee('Боты · 1');
}
public function test_admin_can_open_bots_tab(): void
{
$this->mock(AzerothCoreAccountService::class, function (MockInterface $mock): void {
$mock->shouldReceive('accountTypeStats')
->once()
->with(null)
->andReturn(['players' => 4, 'bots' => 2]);
$mock->shouldReceive('listAccounts')
->once()
->with(null, 'bots')
->andReturn(new Collection([
[
'id' => 7,
'username' => 'RNDBOT0007',
'email' => '',
'reg_mail' => '',
'gm_level' => 0,
'access_label' => 'Игрок',
'locked' => false,
'online' => false,
'joined_at' => '14.03.2026 01:00',
'last_login_at' => '14.03.2026 01:30',
'characters' => new Collection(),
],
]));
});
$this->mock(InviteCodeService::class, function (MockInterface $mock): void {
$mock->shouldReceive('latest')
->once()
->andReturn(new Collection());
$mock->shouldReceive('stats')
->once()
->andReturn(['total' => 0, 'available' => 0, 'redeemed' => 0]);
});
$response = $this->actingAs($this->makeUser(3))->get(route('admin.accounts.index', ['tab' => 'bots']));
$response->assertOk();
$response->assertSee('RNDBOT0007');
$response->assertSee('Боты · 2');
}
public function test_admin_can_update_access_level(): void