. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Services\DatatablesService; use Fisharebest\Webtrees\Services\SiteLogsService; use Fisharebest\Webtrees\TestCase; use Illuminate\Database\Query\Builder; use PHPUnit\Framework\Attributes\CoversClass; use Psr\Http\Message\ResponseInterface; #[CoversClass(SiteLogsData::class)] class SiteLogsDataTest extends TestCase { public function testResponse(): void { $request = self::createRequest( RequestMethodInterface::METHOD_GET, ['tree' => 'a', 'from' => 'b', 'to' => 'c', 'type' => 'd', 'text' => 'e', 'ip' => 'f', 'username' => 'g'] ); $query = $this->createStub(Builder::class); $site_logs_service = $this->createStub(SiteLogsService::class); $site_logs_service->method('logsQuery')->willReturn($query); $response = $this->createStub(ResponseInterface::class); $response->method('getStatusCode')->willReturn(StatusCodeInterface::STATUS_OK); $data_tables_service = $this->createStub(DatatablesService::class); $data_tables_service->method('handleQuery')->willReturn($response); $handler = new SiteLogsData($data_tables_service, $site_logs_service); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); } }