xref: /webtrees/tests/app/Http/RequestHandlers/MapDataExportCSVTest.php (revision 202c018b592d5a516e4a465dc6dc515f3be37399)
190949315SGreg Roach<?php
290949315SGreg Roach
390949315SGreg Roach/**
490949315SGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
690949315SGreg Roach * This program is free software: you can redistribute it and/or modify
790949315SGreg Roach * it under the terms of the GNU General Public License as published by
890949315SGreg Roach * the Free Software Foundation, either version 3 of the License, or
990949315SGreg Roach * (at your option) any later version.
1090949315SGreg Roach * This program is distributed in the hope that it will be useful,
1190949315SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1290949315SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1390949315SGreg Roach * GNU General Public License for more details.
1490949315SGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
1690949315SGreg Roach */
1790949315SGreg Roach
1890949315SGreg Roachdeclare(strict_types=1);
1990949315SGreg Roach
2090949315SGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
2190949315SGreg Roach
2290949315SGreg Roachuse Fig\Http\Message\StatusCodeInterface;
2390949315SGreg Roachuse Fisharebest\Webtrees\Services\MapDataService;
2490949315SGreg Roachuse Fisharebest\Webtrees\TestCase;
25*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
2690949315SGreg Roach
27*202c018bSGreg Roach
28*202c018bSGreg Roach#[CoversClass(MapDataExportCSV::class)]
2990949315SGreg Roachclass MapDataExportCSVTest extends TestCase
3090949315SGreg Roach{
31cd94ca66SGreg Roach    protected static bool $uses_database = true;
3290949315SGreg Roach
3390949315SGreg Roach    public function testExportCSV(): void
3490949315SGreg Roach    {
3590949315SGreg Roach        $map_data_service = new MapDataService();
3690949315SGreg Roach        $handler          = new MapDataExportCSV($map_data_service);
3790949315SGreg Roach        $request          = self::createRequest();
3890949315SGreg Roach        $response         = $handler->handle($request);
3990949315SGreg Roach
4090949315SGreg Roach        self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode());
416172e7f6SGreg Roach        self::assertSame($response->getHeaderLine('content-type'), 'text/csv; charset=UTF-8');
4290949315SGreg Roach    }
4390949315SGreg Roach}
44