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), ); } }