xref: /webtrees/tests/app/Factories/RouteFactoryTest.php (revision ecfd3ae4041d94c244c6fc9f61845311cd931fd0)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2022 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\Factories;
21
22use DomainException;
23use Fisharebest\Webtrees\Encodings\ANSEL;
24use Fisharebest\Webtrees\Encodings\ASCII;
25use Fisharebest\Webtrees\Encodings\CP437;
26use Fisharebest\Webtrees\Encodings\CP850;
27use Fisharebest\Webtrees\Encodings\EncodingInterface;
28use Fisharebest\Webtrees\Encodings\MacRoman;
29use Fisharebest\Webtrees\Encodings\UTF16BE;
30use Fisharebest\Webtrees\Encodings\UTF16LE;
31use Fisharebest\Webtrees\Encodings\UTF8;
32use Fisharebest\Webtrees\Encodings\Windows1250;
33use Fisharebest\Webtrees\Encodings\Windows1251;
34use Fisharebest\Webtrees\Encodings\Windows1252;
35use Fisharebest\Webtrees\Http\RequestHandlers\HomePage;
36use Fisharebest\Webtrees\TestCase;
37
38use function parse_url;
39
40/**
41 * Test harness for the class RouteFactory
42 *
43 * @covers \Fisharebest\Webtrees\Factories\RouteFactory
44 */
45class RouteFactoryTest extends TestCase
46{
47    /**
48     */
49    public function testEmptyQueryParameterInURL(): void
50    {
51        $route_factory = new RouteFactory();
52
53        $url = $route_factory->route(HomePage::class, ['foo' => null, 'bar' => '']);
54
55        $this->assertStringNotContainsString('foo=', $url);
56        $this->assertStringContainsString('bar=', $url);
57    }
58}
59