xref: /webtrees/tests/app/Census/CensusTest.php (revision d11be7027e34e3121be11cc025421873364403f9)
1a53db70dSGreg Roach<?php
23976b470SGreg Roach
3a53db70dSGreg Roach/**
4a53db70dSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6a53db70dSGreg Roach * This program is free software: you can redistribute it and/or modify
7a53db70dSGreg Roach * it under the terms of the GNU General Public License as published by
8a53db70dSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9a53db70dSGreg Roach * (at your option) any later version.
10a53db70dSGreg Roach * This program is distributed in the hope that it will be useful,
11a53db70dSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12a53db70dSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13a53db70dSGreg Roach * GNU General Public License for more details.
14a53db70dSGreg 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/>.
16a53db70dSGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
20a53db70dSGreg Roachnamespace Fisharebest\Webtrees\Census;
21a53db70dSGreg Roach
223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
233cfcc809SGreg Roach
24a53db70dSGreg Roach/**
25da3cb887Sglarwill * Test harness for the class Census
26a53db70dSGreg Roach */
273cfcc809SGreg Roachclass CensusTest extends TestCase
28c1010edaSGreg Roach{
29a53db70dSGreg Roach    /**
3015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
3152348eb8SGreg Roach     *
3252348eb8SGreg Roach     * @return void
33a53db70dSGreg Roach     */
34af7ed6cbSGreg Roach    public function testCensusPlacesCzech(): void
35af7ed6cbSGreg Roach    {
36af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('cs');
37af7ed6cbSGreg Roach
386de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
39af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[0]);
40af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[1]);
41af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
42af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]);
43af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[4]);
44af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[5]);
45af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
46af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
476de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]);
486de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
496de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
50af7ed6cbSGreg Roach    }
51af7ed6cbSGreg Roach
52af7ed6cbSGreg Roach    /**
53af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
54af7ed6cbSGreg Roach     *
55af7ed6cbSGreg Roach     * @return void
56af7ed6cbSGreg Roach     */
57af7ed6cbSGreg Roach    public function testCensusPlacesDanish(): void
58af7ed6cbSGreg Roach    {
59af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('da');
60af7ed6cbSGreg Roach
616de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
62af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDenmark::class, $censuses[0]);
63af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[1]);
64af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
65af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[3]);
66af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[4]);
67af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[5]);
68af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
69af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
706de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]);
716de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
726de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
73af7ed6cbSGreg Roach    }
74af7ed6cbSGreg Roach
75af7ed6cbSGreg Roach    /**
76af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
77af7ed6cbSGreg Roach     *
78af7ed6cbSGreg Roach     * @return void
79af7ed6cbSGreg Roach     */
80af7ed6cbSGreg Roach    public function testCensusPlacesGerman(): void
81af7ed6cbSGreg Roach    {
82af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('de');
83af7ed6cbSGreg Roach
846de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
85af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[0]);
86af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
87af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
88af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[3]);
89af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[4]);
90af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[5]);
91af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
92af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
936de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]);
946de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
956de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
96af7ed6cbSGreg Roach    }
97af7ed6cbSGreg Roach
98af7ed6cbSGreg Roach    /**
99af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
100af7ed6cbSGreg Roach     *
101af7ed6cbSGreg Roach     * @return void
102af7ed6cbSGreg Roach     */
103af7ed6cbSGreg Roach    public function testCensusPlacesAustralianEnglish(): void
104af7ed6cbSGreg Roach    {
105af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('en-AU');
106af7ed6cbSGreg Roach
1076de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
108af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[0]);
109af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[1]);
110af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[2]);
11153a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[3]);
11253a83c54Sglarwill        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]);
1136de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[5]);
1146de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]);
1156de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfDenmark::class, $censuses[7]);
1166de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[8]);
1176de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfFrance::class, $censuses[9]);
1186de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[10]);
119af7ed6cbSGreg Roach    }
120af7ed6cbSGreg Roach
121af7ed6cbSGreg Roach    /**
122af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
123af7ed6cbSGreg Roach     *
124af7ed6cbSGreg Roach     * @return void
125af7ed6cbSGreg Roach     */
126af7ed6cbSGreg Roach    public function testCensusPlacesBritishEnglish(): void
127af7ed6cbSGreg Roach    {
128af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('en-GB');
129af7ed6cbSGreg Roach
1306de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
131af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[0]);
132af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[1]);
133af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[2]);
13453a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[3]);
13553a83c54Sglarwill        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]);
1366de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[5]);
1376de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]);
1386de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfDenmark::class, $censuses[7]);
1396de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[8]);
1406de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfFrance::class, $censuses[9]);
1416de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[10]);
142af7ed6cbSGreg Roach    }
143af7ed6cbSGreg Roach
144af7ed6cbSGreg Roach    /**
145af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
146af7ed6cbSGreg Roach     *
147af7ed6cbSGreg Roach     * @return void
148af7ed6cbSGreg Roach     */
149af7ed6cbSGreg Roach    public function testCensusPlacesUSEnglish(): void
150af7ed6cbSGreg Roach    {
151af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('en-US');
152af7ed6cbSGreg Roach
1536de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
154af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]);
1556de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[1]);
1566de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCanada::class, $censuses[2]);
1576de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[3]);
1586de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfDenmark::class, $censuses[4]);
1596de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[5]);
1606de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfEngland::class, $censuses[6]);
1616de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfFrance::class, $censuses[7]);
1626de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfScotland::class, $censuses[8]);
1636de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[9]);
1646de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfWales::class, $censuses[10]);
165af7ed6cbSGreg Roach    }
166af7ed6cbSGreg Roach
167af7ed6cbSGreg Roach    /**
168af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
169af7ed6cbSGreg Roach     *
170af7ed6cbSGreg Roach     * @return void
171af7ed6cbSGreg Roach     */
172af7ed6cbSGreg Roach    public function testCensusPlacesFrench(): void
173af7ed6cbSGreg Roach    {
174af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('fr');
175af7ed6cbSGreg Roach
1766de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
177af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[0]);
17853a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[1]);
17953a83c54Sglarwill        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
18053a83c54Sglarwill        self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
18153a83c54Sglarwill        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
18253a83c54Sglarwill        self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
18353a83c54Sglarwill        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
18453a83c54Sglarwill        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
18553a83c54Sglarwill        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]);
1866de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[9]);
1876de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfWales::class, $censuses[10]);
188af7ed6cbSGreg Roach    }
189af7ed6cbSGreg Roach
190af7ed6cbSGreg Roach    /**
191af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
192af7ed6cbSGreg Roach     *
193af7ed6cbSGreg Roach     * @return void
194af7ed6cbSGreg Roach     */
195af7ed6cbSGreg Roach    public function testCensusPlacesCanadianFrench(): void
196af7ed6cbSGreg Roach    {
197af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('fr-CA');
198af7ed6cbSGreg Roach
1996de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
20053a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[0]);
20153a83c54Sglarwill        self::assertInstanceOf(CensusOfFrance::class, $censuses[1]);
20253a83c54Sglarwill        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
20353a83c54Sglarwill        self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
20453a83c54Sglarwill        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
20553a83c54Sglarwill        self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
20653a83c54Sglarwill        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
20753a83c54Sglarwill        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
20853a83c54Sglarwill        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]);
2096de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[9]);
2106de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfWales::class, $censuses[10]);
211af7ed6cbSGreg Roach    }
212af7ed6cbSGreg Roach
213af7ed6cbSGreg Roach    /**
214af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
215af7ed6cbSGreg Roach     *
216af7ed6cbSGreg Roach     * @return void
217af7ed6cbSGreg Roach     */
218af7ed6cbSGreg Roach    public function testCensusPlacesSlovak(): void
219af7ed6cbSGreg Roach    {
220af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('sk');
221af7ed6cbSGreg Roach
2226de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
223af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[0]);
224af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
225af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
226af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]);
227af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[4]);
228af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[5]);
229af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
230af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
2316de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]);
2326de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
2336de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
234af7ed6cbSGreg Roach    }
235af7ed6cbSGreg Roach
236af7ed6cbSGreg Roach    /**
237af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
238af7ed6cbSGreg Roach     *
239af7ed6cbSGreg Roach     * @return void
240af7ed6cbSGreg Roach     */
241af7ed6cbSGreg Roach    public function testCensusPlacesDefault(): void
242c1010edaSGreg Roach    {
24316e7dcbfSGreg Roach        $censuses = Census::censusPlaces('XX');
244a53db70dSGreg Roach
2456de2fb6bSKirk Gartside        self::assertCount(11, $censuses);
2465e933c21SGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]);
2476de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[1]);
2486de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfEngland::class, $censuses[2]);
2496de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfScotland::class, $censuses[3]);
2506de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfWales::class, $censuses[4]);
2516de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[5]);
2526de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfFrance::class, $censuses[6]);
2536de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[7]);
2546de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[8]);
2556de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfDenmark::class, $censuses[9]);
2566de2fb6bSKirk Gartside        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
257a53db70dSGreg Roach    }
258a53db70dSGreg Roach}
259