xref: /webtrees/tests/app/Http/RequestHandlers/SiteLogsDeleteTest.php (revision 62ff2f188c699b1144fb2ca2d6da1358d5e1a745)
16c21f8beSGreg Roach<?php
26c21f8beSGreg Roach
36c21f8beSGreg Roach/**
46c21f8beSGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
66c21f8beSGreg Roach * This program is free software: you can redistribute it and/or modify
76c21f8beSGreg Roach * it under the terms of the GNU General Public License as published by
86c21f8beSGreg Roach * the Free Software Foundation, either version 3 of the License, or
96c21f8beSGreg Roach * (at your option) any later version.
106c21f8beSGreg Roach * This program is distributed in the hope that it will be useful,
116c21f8beSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
126c21f8beSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136c21f8beSGreg Roach * GNU General Public License for more details.
146c21f8beSGreg Roach * You should have received a copy of the GNU General Public License
156c21f8beSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
166c21f8beSGreg Roach */
176c21f8beSGreg Roach
186c21f8beSGreg Roachdeclare(strict_types=1);
196c21f8beSGreg Roach
206c21f8beSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
216c21f8beSGreg Roach
226c21f8beSGreg Roachuse Fig\Http\Message\StatusCodeInterface;
236c21f8beSGreg Roachuse Fisharebest\Webtrees\Services\SiteLogsService;
246c21f8beSGreg Roachuse Fisharebest\Webtrees\TestCase;
256c21f8beSGreg Roachuse Illuminate\Database\Query\Builder;
26202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
276c21f8beSGreg Roach
28202c018bSGreg Roach#[CoversClass(SiteLogsDelete::class)]
296c21f8beSGreg Roachclass SiteLogsDeleteTest extends TestCase
306c21f8beSGreg Roach{
316c21f8beSGreg Roach    public function testResponse(): void
326c21f8beSGreg Roach    {
336c21f8beSGreg Roach        $request = self::createRequest();
346c21f8beSGreg Roach
35*62ff2f18SGreg Roach        $query = $this->createMock(Builder::class);
366c21f8beSGreg Roach        $query->method('delete');
376c21f8beSGreg Roach
38*62ff2f18SGreg Roach        $site_logs_service = $this->createMock(SiteLogsService::class);
396c21f8beSGreg Roach        $site_logs_service->method('logsQuery')->willReturn($query);
406c21f8beSGreg Roach
416c21f8beSGreg Roach        $handler  = new SiteLogsDelete($site_logs_service);
426c21f8beSGreg Roach        $response = $handler->handle($request);
436c21f8beSGreg Roach
44e1ade55dSGreg Roach        static::assertSame(StatusCodeInterface::STATUS_NO_CONTENT, $response->getStatusCode());
456c21f8beSGreg Roach    }
466c21f8beSGreg Roach}
47