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