xref: /webtrees/tests/app/Census/CensusTest.php (revision da3cb887318b253ac0a743309ac1b537880d6ba2)
1a53db70dSGreg Roach<?php
23976b470SGreg Roach
3a53db70dSGreg Roach/**
4a53db70dSGreg Roach * webtrees: online genealogy
589f7189bSGreg Roach * Copyright (C) 2021 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/**
25*da3cb887Sglarwill * 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
3853a83c54Sglarwill        self::assertCount(10, $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]);
47af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
4853a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
49af7ed6cbSGreg Roach    }
50af7ed6cbSGreg Roach
51af7ed6cbSGreg Roach    /**
52af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
53af7ed6cbSGreg Roach     *
54af7ed6cbSGreg Roach     * @return void
55af7ed6cbSGreg Roach     */
56af7ed6cbSGreg Roach    public function testCensusPlacesDanish(): void
57af7ed6cbSGreg Roach    {
58af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('da');
59af7ed6cbSGreg Roach
6053a83c54Sglarwill        self::assertCount(10, $censuses);
61af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDenmark::class, $censuses[0]);
62af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[1]);
63af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
64af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[3]);
65af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[4]);
66af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[5]);
67af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
68af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
69af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
7053a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
71af7ed6cbSGreg Roach    }
72af7ed6cbSGreg Roach
73af7ed6cbSGreg Roach    /**
74af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
75af7ed6cbSGreg Roach     *
76af7ed6cbSGreg Roach     * @return void
77af7ed6cbSGreg Roach     */
78af7ed6cbSGreg Roach    public function testCensusPlacesGerman(): void
79af7ed6cbSGreg Roach    {
80af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('de');
81af7ed6cbSGreg Roach
82af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[0]);
83af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
84af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
85af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[3]);
86af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[4]);
87af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[5]);
88af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
89af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
90af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
9153a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
92af7ed6cbSGreg Roach    }
93af7ed6cbSGreg Roach
94af7ed6cbSGreg Roach    /**
95af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
96af7ed6cbSGreg Roach     *
97af7ed6cbSGreg Roach     * @return void
98af7ed6cbSGreg Roach     */
99af7ed6cbSGreg Roach    public function testCensusPlacesAustralianEnglish(): void
100af7ed6cbSGreg Roach    {
101af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('en-AU');
102af7ed6cbSGreg Roach
10353a83c54Sglarwill        self::assertCount(10, $censuses);
104af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[0]);
105af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[1]);
106af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[2]);
10753a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[3]);
10853a83c54Sglarwill        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]);
10953a83c54Sglarwill        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[5]);
11053a83c54Sglarwill        self::assertInstanceOf(CensusOfDenmark::class, $censuses[6]);
11153a83c54Sglarwill        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[7]);
11253a83c54Sglarwill        self::assertInstanceOf(CensusOfFrance::class, $censuses[8]);
11353a83c54Sglarwill        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[9]);
114af7ed6cbSGreg Roach    }
115af7ed6cbSGreg Roach
116af7ed6cbSGreg Roach    /**
117af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
118af7ed6cbSGreg Roach     *
119af7ed6cbSGreg Roach     * @return void
120af7ed6cbSGreg Roach     */
121af7ed6cbSGreg Roach    public function testCensusPlacesBritishEnglish(): void
122af7ed6cbSGreg Roach    {
123af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('en-GB');
124af7ed6cbSGreg Roach
12553a83c54Sglarwill        self::assertCount(10, $censuses);
126af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[0]);
127af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[1]);
128af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[2]);
12953a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[3]);
13053a83c54Sglarwill        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]);
13153a83c54Sglarwill        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[5]);
13253a83c54Sglarwill        self::assertInstanceOf(CensusOfDenmark::class, $censuses[6]);
13353a83c54Sglarwill        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[7]);
13453a83c54Sglarwill        self::assertInstanceOf(CensusOfFrance::class, $censuses[8]);
13553a83c54Sglarwill        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[9]);
136af7ed6cbSGreg Roach    }
137af7ed6cbSGreg Roach
138af7ed6cbSGreg Roach    /**
139af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
140af7ed6cbSGreg Roach     *
141af7ed6cbSGreg Roach     * @return void
142af7ed6cbSGreg Roach     */
143af7ed6cbSGreg Roach    public function testCensusPlacesUSEnglish(): void
144af7ed6cbSGreg Roach    {
145af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('en-US');
146af7ed6cbSGreg Roach
14753a83c54Sglarwill        self::assertCount(10, $censuses);
148af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]);
14953a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[1]);
15053a83c54Sglarwill        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
15153a83c54Sglarwill        self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
15253a83c54Sglarwill        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
15353a83c54Sglarwill        self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
15453a83c54Sglarwill        self::assertInstanceOf(CensusOfFrance::class, $censuses[6]);
15553a83c54Sglarwill        self::assertInstanceOf(CensusOfScotland::class, $censuses[7]);
15653a83c54Sglarwill        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[8]);
15753a83c54Sglarwill        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
158af7ed6cbSGreg Roach    }
159af7ed6cbSGreg Roach
160af7ed6cbSGreg Roach    /**
161af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
162af7ed6cbSGreg Roach     *
163af7ed6cbSGreg Roach     * @return void
164af7ed6cbSGreg Roach     */
165af7ed6cbSGreg Roach    public function testCensusPlacesFrench(): void
166af7ed6cbSGreg Roach    {
167af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('fr');
168af7ed6cbSGreg Roach
16953a83c54Sglarwill        self::assertCount(10, $censuses);
170af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[0]);
17153a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[1]);
17253a83c54Sglarwill        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
17353a83c54Sglarwill        self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
17453a83c54Sglarwill        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
17553a83c54Sglarwill        self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
17653a83c54Sglarwill        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
17753a83c54Sglarwill        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
17853a83c54Sglarwill        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]);
17953a83c54Sglarwill        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
180af7ed6cbSGreg Roach    }
181af7ed6cbSGreg Roach
182af7ed6cbSGreg Roach    /**
183af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
184af7ed6cbSGreg Roach     *
185af7ed6cbSGreg Roach     * @return void
186af7ed6cbSGreg Roach     */
187af7ed6cbSGreg Roach    public function testCensusPlacesCanadianFrench(): void
188af7ed6cbSGreg Roach    {
189af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('fr-CA');
190af7ed6cbSGreg Roach
19153a83c54Sglarwill        self::assertCount(10, $censuses);
19253a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[0]);
19353a83c54Sglarwill        self::assertInstanceOf(CensusOfFrance::class, $censuses[1]);
19453a83c54Sglarwill        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
19553a83c54Sglarwill        self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
19653a83c54Sglarwill        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
19753a83c54Sglarwill        self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
19853a83c54Sglarwill        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
19953a83c54Sglarwill        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
20053a83c54Sglarwill        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]);
20153a83c54Sglarwill        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
202af7ed6cbSGreg Roach    }
203af7ed6cbSGreg Roach
204af7ed6cbSGreg Roach    /**
205af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
206af7ed6cbSGreg Roach     *
207af7ed6cbSGreg Roach     * @return void
208af7ed6cbSGreg Roach     */
209af7ed6cbSGreg Roach    public function testCensusPlacesSlovak(): void
210af7ed6cbSGreg Roach    {
211af7ed6cbSGreg Roach        $censuses = Census::censusPlaces('sk');
212af7ed6cbSGreg Roach
21353a83c54Sglarwill        self::assertCount(10, $censuses);
214af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[0]);
215af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
216af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
217af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]);
218af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[4]);
219af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[5]);
220af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
221af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
222af7ed6cbSGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
22353a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
224af7ed6cbSGreg Roach    }
225af7ed6cbSGreg Roach
226af7ed6cbSGreg Roach    /**
227af7ed6cbSGreg Roach     * @covers \Fisharebest\Webtrees\Census\Census
228af7ed6cbSGreg Roach     *
229af7ed6cbSGreg Roach     * @return void
230af7ed6cbSGreg Roach     */
231af7ed6cbSGreg Roach    public function testCensusPlacesDefault(): void
232c1010edaSGreg Roach    {
23316e7dcbfSGreg Roach        $censuses = Census::censusPlaces('XX');
234a53db70dSGreg Roach
23553a83c54Sglarwill        self::assertCount(10, $censuses);
2365e933c21SGreg Roach        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]);
2375e933c21SGreg Roach        self::assertInstanceOf(CensusOfEngland::class, $censuses[1]);
2385e933c21SGreg Roach        self::assertInstanceOf(CensusOfScotland::class, $censuses[2]);
2395e933c21SGreg Roach        self::assertInstanceOf(CensusOfWales::class, $censuses[3]);
2405e933c21SGreg Roach        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
2415e933c21SGreg Roach        self::assertInstanceOf(CensusOfFrance::class, $censuses[5]);
2425e933c21SGreg Roach        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]);
2435e933c21SGreg Roach        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
2445e933c21SGreg Roach        self::assertInstanceOf(CensusOfDenmark::class, $censuses[8]);
24553a83c54Sglarwill        self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
246a53db70dSGreg Roach    }
247a53db70dSGreg Roach}
248