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#[CoversClass(Census::class)] 263cfcc809SGreg Roachclass CensusTest extends TestCase 27c1010edaSGreg Roach{ 28af7ed6cbSGreg Roach public function testCensusPlacesCzech(): void 29af7ed6cbSGreg Roach { 30af7ed6cbSGreg Roach $censuses = Census::censusPlaces('cs'); 31af7ed6cbSGreg Roach 326de2fb6bSKirk Gartside self::assertCount(11, $censuses); 33af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[0]); 34af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfSlovakia::class, $censuses[1]); 35af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]); 36af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]); 37af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[4]); 38af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[5]); 39af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[6]); 40af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]); 416de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]); 426de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[9]); 436de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 44af7ed6cbSGreg Roach } 45af7ed6cbSGreg Roach 46af7ed6cbSGreg Roach public function testCensusPlacesDanish(): void 47af7ed6cbSGreg Roach { 48af7ed6cbSGreg Roach $censuses = Census::censusPlaces('da'); 49af7ed6cbSGreg Roach 506de2fb6bSKirk Gartside self::assertCount(11, $censuses); 51af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDenmark::class, $censuses[0]); 52af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDeutschland::class, $censuses[1]); 53af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]); 54af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[3]); 55af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[4]); 56af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[5]); 57af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]); 58af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]); 596de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]); 606de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[9]); 616de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 62af7ed6cbSGreg Roach } 63af7ed6cbSGreg Roach 64af7ed6cbSGreg Roach public function testCensusPlacesGerman(): void 65af7ed6cbSGreg Roach { 66af7ed6cbSGreg Roach $censuses = Census::censusPlaces('de'); 67af7ed6cbSGreg Roach 686de2fb6bSKirk Gartside self::assertCount(11, $censuses); 69af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDeutschland::class, $censuses[0]); 70af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]); 71af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]); 72af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[3]); 73af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[4]); 74af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[5]); 75af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]); 76af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]); 776de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]); 786de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[9]); 796de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 80af7ed6cbSGreg Roach } 81af7ed6cbSGreg Roach 82af7ed6cbSGreg Roach public function testCensusPlacesAustralianEnglish(): void 83af7ed6cbSGreg Roach { 84af7ed6cbSGreg Roach $censuses = Census::censusPlaces('en-AU'); 85af7ed6cbSGreg Roach 866de2fb6bSKirk Gartside self::assertCount(11, $censuses); 87af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[0]); 88af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[1]); 89af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfWales::class, $censuses[2]); 9053a83c54Sglarwill self::assertInstanceOf(CensusOfCanada::class, $censuses[3]); 9153a83c54Sglarwill self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]); 926de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[5]); 936de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]); 946de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDenmark::class, $censuses[7]); 956de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDeutschland::class, $censuses[8]); 966de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfFrance::class, $censuses[9]); 976de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfSlovakia::class, $censuses[10]); 98af7ed6cbSGreg Roach } 99af7ed6cbSGreg Roach 100af7ed6cbSGreg Roach public function testCensusPlacesBritishEnglish(): void 101af7ed6cbSGreg Roach { 102af7ed6cbSGreg Roach $censuses = Census::censusPlaces('en-GB'); 103af7ed6cbSGreg Roach 1046de2fb6bSKirk Gartside self::assertCount(11, $censuses); 105af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[0]); 106af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[1]); 107af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfWales::class, $censuses[2]); 10853a83c54Sglarwill self::assertInstanceOf(CensusOfCanada::class, $censuses[3]); 10953a83c54Sglarwill self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]); 1106de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[5]); 1116de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]); 1126de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDenmark::class, $censuses[7]); 1136de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDeutschland::class, $censuses[8]); 1146de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfFrance::class, $censuses[9]); 1156de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfSlovakia::class, $censuses[10]); 116af7ed6cbSGreg Roach } 117af7ed6cbSGreg Roach 118af7ed6cbSGreg Roach public function testCensusPlacesUSEnglish(): void 119af7ed6cbSGreg Roach { 120af7ed6cbSGreg Roach $censuses = Census::censusPlaces('en-US'); 121af7ed6cbSGreg Roach 1226de2fb6bSKirk Gartside self::assertCount(11, $censuses); 123af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]); 1246de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[1]); 1256de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[2]); 1266de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[3]); 1276de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDenmark::class, $censuses[4]); 1286de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDeutschland::class, $censuses[5]); 1296de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfEngland::class, $censuses[6]); 1306de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfFrance::class, $censuses[7]); 1316de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfScotland::class, $censuses[8]); 1326de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfSlovakia::class, $censuses[9]); 1336de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[10]); 134af7ed6cbSGreg Roach } 135af7ed6cbSGreg Roach 136af7ed6cbSGreg Roach public function testCensusPlacesFrench(): void 137af7ed6cbSGreg Roach { 138af7ed6cbSGreg Roach $censuses = Census::censusPlaces('fr'); 139af7ed6cbSGreg Roach 1406de2fb6bSKirk Gartside self::assertCount(11, $censuses); 141af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[0]); 14253a83c54Sglarwill self::assertInstanceOf(CensusOfCanada::class, $censuses[1]); 14353a83c54Sglarwill self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]); 14453a83c54Sglarwill self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]); 14553a83c54Sglarwill self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]); 14653a83c54Sglarwill self::assertInstanceOf(CensusOfEngland::class, $censuses[5]); 14753a83c54Sglarwill self::assertInstanceOf(CensusOfScotland::class, $censuses[6]); 14853a83c54Sglarwill self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]); 14953a83c54Sglarwill self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]); 1506de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[9]); 1516de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[10]); 152af7ed6cbSGreg Roach } 153af7ed6cbSGreg Roach 154af7ed6cbSGreg Roach public function testCensusPlacesCanadianFrench(): void 155af7ed6cbSGreg Roach { 156af7ed6cbSGreg Roach $censuses = Census::censusPlaces('fr-CA'); 157af7ed6cbSGreg Roach 1586de2fb6bSKirk Gartside self::assertCount(11, $censuses); 15953a83c54Sglarwill self::assertInstanceOf(CensusOfCanada::class, $censuses[0]); 16053a83c54Sglarwill self::assertInstanceOf(CensusOfFrance::class, $censuses[1]); 16153a83c54Sglarwill self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]); 16253a83c54Sglarwill self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]); 16353a83c54Sglarwill self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]); 16453a83c54Sglarwill self::assertInstanceOf(CensusOfEngland::class, $censuses[5]); 16553a83c54Sglarwill self::assertInstanceOf(CensusOfScotland::class, $censuses[6]); 16653a83c54Sglarwill self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]); 16753a83c54Sglarwill self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]); 1686de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[9]); 1696de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[10]); 170af7ed6cbSGreg Roach } 171af7ed6cbSGreg Roach 172af7ed6cbSGreg Roach public function testCensusPlacesSlovak(): void 173af7ed6cbSGreg Roach { 174af7ed6cbSGreg Roach $censuses = Census::censusPlaces('sk'); 175af7ed6cbSGreg Roach 1766de2fb6bSKirk Gartside self::assertCount(11, $censuses); 177af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfSlovakia::class, $censuses[0]); 178af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]); 179af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]); 180af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]); 181af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfEngland::class, $censuses[4]); 182af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfFrance::class, $censuses[5]); 183af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfScotland::class, $censuses[6]); 184af7ed6cbSGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]); 1856de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[8]); 1866de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[9]); 1876de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 188af7ed6cbSGreg Roach } 189af7ed6cbSGreg Roach 190af7ed6cbSGreg Roach public function testCensusPlacesDefault(): void 191c1010edaSGreg Roach { 19216e7dcbfSGreg Roach $censuses = Census::censusPlaces('XX'); 193a53db70dSGreg Roach 1946de2fb6bSKirk Gartside self::assertCount(11, $censuses); 1955e933c21SGreg Roach self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]); 1966de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfRhodeIsland::class, $censuses[1]); 1976de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfEngland::class, $censuses[2]); 1986de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfScotland::class, $censuses[3]); 1996de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfWales::class, $censuses[4]); 2006de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDeutschland::class, $censuses[5]); 2016de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfFrance::class, $censuses[6]); 2026de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[7]); 2036de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfSlovakia::class, $censuses[8]); 2046de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfDenmark::class, $censuses[9]); 2056de2fb6bSKirk Gartside self::assertInstanceOf(CensusOfCanada::class, $censuses[10]); 206a53db70dSGreg Roach } 207a53db70dSGreg Roach} 208