xref: /webtrees/tests/app/Census/CensusTest.php (revision f24a8589f7d8400d503c5bb64be9ca10e1637659)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2023 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\Census;
21
22use Fisharebest\Webtrees\TestCase;
23
24/**
25 * Test harness for the class Census
26 */
27class CensusTest extends TestCase
28{
29    /**
30     * @covers \Fisharebest\Webtrees\Census\Census
31     */
32    public function testCensusPlacesCzech(): void
33    {
34        $censuses = Census::censusPlaces('cs');
35
36        self::assertCount(11, $censuses);
37        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[0]);
38        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[1]);
39        self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
40        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]);
41        self::assertInstanceOf(CensusOfEngland::class, $censuses[4]);
42        self::assertInstanceOf(CensusOfFrance::class, $censuses[5]);
43        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
44        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
45        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]);
46        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
47        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
48    }
49
50    /**
51     * @covers \Fisharebest\Webtrees\Census\Census
52     */
53    public function testCensusPlacesDanish(): void
54    {
55        $censuses = Census::censusPlaces('da');
56
57        self::assertCount(11, $censuses);
58        self::assertInstanceOf(CensusOfDenmark::class, $censuses[0]);
59        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[1]);
60        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
61        self::assertInstanceOf(CensusOfEngland::class, $censuses[3]);
62        self::assertInstanceOf(CensusOfFrance::class, $censuses[4]);
63        self::assertInstanceOf(CensusOfScotland::class, $censuses[5]);
64        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
65        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
66        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]);
67        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
68        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
69    }
70
71    /**
72     * @covers \Fisharebest\Webtrees\Census\Census
73     */
74    public function testCensusPlacesGerman(): void
75    {
76        $censuses = Census::censusPlaces('de');
77
78        self::assertCount(11, $censuses);
79        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[0]);
80        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
81        self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
82        self::assertInstanceOf(CensusOfEngland::class, $censuses[3]);
83        self::assertInstanceOf(CensusOfFrance::class, $censuses[4]);
84        self::assertInstanceOf(CensusOfScotland::class, $censuses[5]);
85        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
86        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
87        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]);
88        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
89        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
90    }
91
92    /**
93     * @covers \Fisharebest\Webtrees\Census\Census
94     */
95    public function testCensusPlacesAustralianEnglish(): void
96    {
97        $censuses = Census::censusPlaces('en-AU');
98
99        self::assertCount(11, $censuses);
100        self::assertInstanceOf(CensusOfEngland::class, $censuses[0]);
101        self::assertInstanceOf(CensusOfScotland::class, $censuses[1]);
102        self::assertInstanceOf(CensusOfWales::class, $censuses[2]);
103        self::assertInstanceOf(CensusOfCanada::class, $censuses[3]);
104        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]);
105        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[5]);
106        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]);
107        self::assertInstanceOf(CensusOfDenmark::class, $censuses[7]);
108        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[8]);
109        self::assertInstanceOf(CensusOfFrance::class, $censuses[9]);
110        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[10]);
111    }
112
113    /**
114     * @covers \Fisharebest\Webtrees\Census\Census
115     */
116    public function testCensusPlacesBritishEnglish(): void
117    {
118        $censuses = Census::censusPlaces('en-GB');
119
120        self::assertCount(11, $censuses);
121        self::assertInstanceOf(CensusOfEngland::class, $censuses[0]);
122        self::assertInstanceOf(CensusOfScotland::class, $censuses[1]);
123        self::assertInstanceOf(CensusOfWales::class, $censuses[2]);
124        self::assertInstanceOf(CensusOfCanada::class, $censuses[3]);
125        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]);
126        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[5]);
127        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]);
128        self::assertInstanceOf(CensusOfDenmark::class, $censuses[7]);
129        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[8]);
130        self::assertInstanceOf(CensusOfFrance::class, $censuses[9]);
131        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[10]);
132    }
133
134    /**
135     * @covers \Fisharebest\Webtrees\Census\Census
136     */
137    public function testCensusPlacesUSEnglish(): void
138    {
139        $censuses = Census::censusPlaces('en-US');
140
141        self::assertCount(11, $censuses);
142        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]);
143        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[1]);
144        self::assertInstanceOf(CensusOfCanada::class, $censuses[2]);
145        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[3]);
146        self::assertInstanceOf(CensusOfDenmark::class, $censuses[4]);
147        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[5]);
148        self::assertInstanceOf(CensusOfEngland::class, $censuses[6]);
149        self::assertInstanceOf(CensusOfFrance::class, $censuses[7]);
150        self::assertInstanceOf(CensusOfScotland::class, $censuses[8]);
151        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[9]);
152        self::assertInstanceOf(CensusOfWales::class, $censuses[10]);
153    }
154
155    /**
156     * @covers \Fisharebest\Webtrees\Census\Census
157     */
158    public function testCensusPlacesFrench(): void
159    {
160        $censuses = Census::censusPlaces('fr');
161
162        self::assertCount(11, $censuses);
163        self::assertInstanceOf(CensusOfFrance::class, $censuses[0]);
164        self::assertInstanceOf(CensusOfCanada::class, $censuses[1]);
165        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
166        self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
167        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
168        self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
169        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
170        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
171        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]);
172        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[9]);
173        self::assertInstanceOf(CensusOfWales::class, $censuses[10]);
174    }
175
176    /**
177     * @covers \Fisharebest\Webtrees\Census\Census
178     */
179    public function testCensusPlacesCanadianFrench(): void
180    {
181        $censuses = Census::censusPlaces('fr-CA');
182
183        self::assertCount(11, $censuses);
184        self::assertInstanceOf(CensusOfCanada::class, $censuses[0]);
185        self::assertInstanceOf(CensusOfFrance::class, $censuses[1]);
186        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
187        self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
188        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
189        self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
190        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
191        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
192        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]);
193        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[9]);
194        self::assertInstanceOf(CensusOfWales::class, $censuses[10]);
195    }
196
197    /**
198     * @covers \Fisharebest\Webtrees\Census\Census
199     */
200    public function testCensusPlacesSlovak(): void
201    {
202        $censuses = Census::censusPlaces('sk');
203
204        self::assertCount(11, $censuses);
205        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[0]);
206        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
207        self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
208        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]);
209        self::assertInstanceOf(CensusOfEngland::class, $censuses[4]);
210        self::assertInstanceOf(CensusOfFrance::class, $censuses[5]);
211        self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
212        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
213        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]);
214        self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
215        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
216    }
217
218    /**
219     * @covers \Fisharebest\Webtrees\Census\Census
220     */
221    public function testCensusPlacesDefault(): void
222    {
223        $censuses = Census::censusPlaces('XX');
224
225        self::assertCount(11, $censuses);
226        self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]);
227        self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[1]);
228        self::assertInstanceOf(CensusOfEngland::class, $censuses[2]);
229        self::assertInstanceOf(CensusOfScotland::class, $censuses[3]);
230        self::assertInstanceOf(CensusOfWales::class, $censuses[4]);
231        self::assertInstanceOf(CensusOfDeutschland::class, $censuses[5]);
232        self::assertInstanceOf(CensusOfFrance::class, $censuses[6]);
233        self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[7]);
234        self::assertInstanceOf(CensusOfSlovakia::class, $censuses[8]);
235        self::assertInstanceOf(CensusOfDenmark::class, $censuses[9]);
236        self::assertInstanceOf(CensusOfCanada::class, $censuses[10]);
237    }
238}
239