1a53db70dSGreg Roach<?php 23976b470SGreg Roach 3a53db70dSGreg Roach/** 4a53db70dSGreg Roach * webtrees: online genealogy 5d11be702SGreg 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; 23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass; 243cfcc809SGreg Roach 25*202c018bSGreg Roach 26*202c018bSGreg Roach#[CoversClass(Census::class)] 273cfcc809SGreg Roachclass CensusTest extends TestCase 28c1010edaSGreg Roach{ 29af7ed6cbSGreg Roach public function testCensusPlacesCzech(): void 30af7ed6cbSGreg Roach { 31af7ed6cbSGreg Roach $censuses = Census::censusPlaces('cs'); 32af7ed6cbSGreg Roach 336de2fb6bSKirk Gartside self::assertCount(11, $censuses); 34af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[0]); 35af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfSlovakia::class, $censuses[1]); 36af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]); 37af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]); 38af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[4]); 39af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[5]); 40af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[6]); 41af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]); 426de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]); 436de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[9]); 446de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 45af7ed6cbSGreg Roach } 46af7ed6cbSGreg Roach 47af7ed6cbSGreg Roach public function testCensusPlacesDanish(): void 48af7ed6cbSGreg Roach { 49af7ed6cbSGreg Roach $censuses = Census::censusPlaces('da'); 50af7ed6cbSGreg Roach 516de2fb6bSKirk Gartside self::assertCount(11, $censuses); 52af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDenmark::class, $censuses[0]); 53af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDeutschland::class, $censuses[1]); 54af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]); 55af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[3]); 56af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[4]); 57af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[5]); 58af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]); 59af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]); 606de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]); 616de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[9]); 626de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 63af7ed6cbSGreg Roach } 64af7ed6cbSGreg Roach 65af7ed6cbSGreg Roach public function testCensusPlacesGerman(): void 66af7ed6cbSGreg Roach { 67af7ed6cbSGreg Roach $censuses = Census::censusPlaces('de'); 68af7ed6cbSGreg Roach 696de2fb6bSKirk Gartside self::assertCount(11, $censuses); 70af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDeutschland::class, $censuses[0]); 71af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]); 72af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]); 73af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[3]); 74af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[4]); 75af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[5]); 76af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]); 77af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]); 786de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]); 796de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[9]); 806de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 81af7ed6cbSGreg Roach } 82af7ed6cbSGreg Roach 83af7ed6cbSGreg Roach public function testCensusPlacesAustralianEnglish(): void 84af7ed6cbSGreg Roach { 85af7ed6cbSGreg Roach $censuses = Census::censusPlaces('en-AU'); 86af7ed6cbSGreg Roach 876de2fb6bSKirk Gartside self::assertCount(11, $censuses); 88af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[0]); 89af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[1]); 90af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfWales::class, $censuses[2]); 9153a83c54Sglarwill self::assertInstanceOf(CensusOfCanada::class, $censuses[3]); 9253a83c54Sglarwill self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]); 936de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[5]); 946de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]); 956de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDenmark::class, $censuses[7]); 966de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDeutschland::class, $censuses[8]); 976de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfFrance::class, $censuses[9]); 986de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfSlovakia::class, $censuses[10]); 99af7ed6cbSGreg Roach } 100af7ed6cbSGreg Roach 101af7ed6cbSGreg Roach public function testCensusPlacesBritishEnglish(): void 102af7ed6cbSGreg Roach { 103af7ed6cbSGreg Roach $censuses = Census::censusPlaces('en-GB'); 104af7ed6cbSGreg Roach 1056de2fb6bSKirk Gartside self::assertCount(11, $censuses); 106af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[0]); 107af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[1]); 108af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfWales::class, $censuses[2]); 10953a83c54Sglarwill self::assertInstanceOf(CensusOfCanada::class, $censuses[3]); 11053a83c54Sglarwill self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]); 1116de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[5]); 1126de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]); 1136de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDenmark::class, $censuses[7]); 1146de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDeutschland::class, $censuses[8]); 1156de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfFrance::class, $censuses[9]); 1166de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfSlovakia::class, $censuses[10]); 117af7ed6cbSGreg Roach } 118af7ed6cbSGreg Roach 119af7ed6cbSGreg Roach public function testCensusPlacesUSEnglish(): void 120af7ed6cbSGreg Roach { 121af7ed6cbSGreg Roach $censuses = Census::censusPlaces('en-US'); 122af7ed6cbSGreg Roach 1236de2fb6bSKirk Gartside self::assertCount(11, $censuses); 124af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]); 1256de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[1]); 1266de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[2]); 1276de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[3]); 1286de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDenmark::class, $censuses[4]); 1296de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDeutschland::class, $censuses[5]); 1306de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfEngland::class, $censuses[6]); 1316de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfFrance::class, $censuses[7]); 1326de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfScotland::class, $censuses[8]); 1336de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfSlovakia::class, $censuses[9]); 1346de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[10]); 135af7ed6cbSGreg Roach } 136af7ed6cbSGreg Roach 137af7ed6cbSGreg Roach public function testCensusPlacesFrench(): void 138af7ed6cbSGreg Roach { 139af7ed6cbSGreg Roach $censuses = Census::censusPlaces('fr'); 140af7ed6cbSGreg Roach 1416de2fb6bSKirk Gartside self::assertCount(11, $censuses); 142af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[0]); 14353a83c54Sglarwill self::assertInstanceOf(CensusOfCanada::class, $censuses[1]); 14453a83c54Sglarwill self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]); 14553a83c54Sglarwill self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]); 14653a83c54Sglarwill self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]); 14753a83c54Sglarwill self::assertInstanceOf(CensusOfEngland::class, $censuses[5]); 14853a83c54Sglarwill self::assertInstanceOf(CensusOfScotland::class, $censuses[6]); 14953a83c54Sglarwill self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]); 15053a83c54Sglarwill self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]); 1516de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[9]); 1526de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[10]); 153af7ed6cbSGreg Roach } 154af7ed6cbSGreg Roach 155af7ed6cbSGreg Roach public function testCensusPlacesCanadianFrench(): void 156af7ed6cbSGreg Roach { 157af7ed6cbSGreg Roach $censuses = Census::censusPlaces('fr-CA'); 158af7ed6cbSGreg Roach 1596de2fb6bSKirk Gartside self::assertCount(11, $censuses); 16053a83c54Sglarwill self::assertInstanceOf(CensusOfCanada::class, $censuses[0]); 16153a83c54Sglarwill self::assertInstanceOf(CensusOfFrance::class, $censuses[1]); 16253a83c54Sglarwill self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]); 16353a83c54Sglarwill self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]); 16453a83c54Sglarwill self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]); 16553a83c54Sglarwill self::assertInstanceOf(CensusOfEngland::class, $censuses[5]); 16653a83c54Sglarwill self::assertInstanceOf(CensusOfScotland::class, $censuses[6]); 16753a83c54Sglarwill self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]); 16853a83c54Sglarwill self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]); 1696de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[9]); 1706de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[10]); 171af7ed6cbSGreg Roach } 172af7ed6cbSGreg Roach 173af7ed6cbSGreg Roach public function testCensusPlacesSlovak(): void 174af7ed6cbSGreg Roach { 175af7ed6cbSGreg Roach $censuses = Census::censusPlaces('sk'); 176af7ed6cbSGreg Roach 1776de2fb6bSKirk Gartside self::assertCount(11, $censuses); 178af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfSlovakia::class, $censuses[0]); 179af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]); 180af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]); 181af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]); 182af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[4]); 183af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[5]); 184af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[6]); 185af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]); 1866de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]); 1876de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[9]); 1886de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 189af7ed6cbSGreg Roach } 190af7ed6cbSGreg Roach 191af7ed6cbSGreg Roach public function testCensusPlacesDefault(): void 192c1010edaSGreg Roach { 19316e7dcbfSGreg Roach $censuses = Census::censusPlaces('XX'); 194a53db70dSGreg Roach 1956de2fb6bSKirk Gartside self::assertCount(11, $censuses); 1965e933c21SGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]); 1976de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[1]); 1986de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfEngland::class, $censuses[2]); 1996de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfScotland::class, $censuses[3]); 2006de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[4]); 2016de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDeutschland::class, $censuses[5]); 2026de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfFrance::class, $censuses[6]); 2036de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[7]); 2046de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfSlovakia::class, $censuses[8]); 2056de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDenmark::class, $censuses[9]); 2066de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 207a53db70dSGreg Roach } 208a53db70dSGreg Roach} 209