justReturn(false); Functions\when('post_type_exists')->justReturn(false); Functions\when('get_post')->justReturn(null); Functions\when('get_term')->justReturn(null); Functions\when('current_user_can')->justReturn(false); Functions\when('admin_url')->alias(static fn (string $path = ''): string => 'https://kunde.de/wp-admin/' . $path); } protected function tearDown(): void { unset($_GET['paged']); parent::tearDown(); } public function testPrepareItemsQueriesTheCurrentPageAndSetsPagination(): void { $_GET['paged'] = '3'; $log = Mockery::mock(ChangeLog::class); $log->expects('query') ->with(['ability' => 'lit/content-update', 'user_id' => 0], 50, 100) ->andReturn(['rows' => [['id' => '1']], 'total' => 120]); $table = new LogListTable($log, ['ability' => 'lit/content-update', 'user_id' => 0]); $table->prepare_items(); self::assertSame([['id' => '1']], $table->items); self::assertSame(['total_items' => 120, 'per_page' => 50], $table->pagination_args()); } public function testColumnDefaultEscapesUntrustedClientAndSummaryText(): void { $table = new LogListTable(Mockery::mock(ChangeLog::class), ['ability' => '', 'user_id' => 0]); $item = ['client' => 'Claude ', 'summary' => 'böse Zusammenfassung']; self::assertStringNotContainsString('