1da3cb887Sglarwill<?php 2da3cb887Sglarwill 3da3cb887Sglarwill/** 4da3cb887Sglarwill * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6da3cb887Sglarwill * This program is free software: you can redistribute it and/or modify 7da3cb887Sglarwill * it under the terms of the GNU General Public License as published by 8da3cb887Sglarwill * the Free Software Foundation, either version 3 of the License, or 9da3cb887Sglarwill * (at your option) any later version. 10da3cb887Sglarwill * This program is distributed in the hope that it will be useful, 11da3cb887Sglarwill * but WITHOUT ANY WARRANTY; without even the implied warranty of 12da3cb887Sglarwill * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13da3cb887Sglarwill * GNU General Public License for more details. 14da3cb887Sglarwill * You should have received a copy of the GNU General Public License 15da3cb887Sglarwill * along with this program. If not, see <https://www.gnu.org/licenses/>. 16da3cb887Sglarwill */ 17da3cb887Sglarwill 18da3cb887Sglarwilldeclare(strict_types=1); 19da3cb887Sglarwill 20da3cb887Sglarwillnamespace Fisharebest\Webtrees\Census; 21da3cb887Sglarwill 22da3cb887Sglarwilluse Fisharebest\Webtrees\TestCase; 23da3cb887Sglarwill 24da3cb887Sglarwill/** 25da3cb887Sglarwill * Test harness for the class CensusOfCanadaPraries1916 26da3cb887Sglarwill */ 27da3cb887Sglarwillclass CensusOfCanadaPraries1916Test extends TestCase 28da3cb887Sglarwill{ 29da3cb887Sglarwill /** 30da3cb887Sglarwill * Test the census place and date 31da3cb887Sglarwill * 32da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusOfCanadaPraries1916 33da3cb887Sglarwill * 34da3cb887Sglarwill * @return void 35da3cb887Sglarwill */ 36da3cb887Sglarwill public function testPlaceAndDate(): void 37da3cb887Sglarwill { 38da3cb887Sglarwill $census = new CensusOfCanadaPraries1916(); 39da3cb887Sglarwill 40da3cb887Sglarwill self::assertSame('Canada', $census->censusPlace()); 41da3cb887Sglarwill self::assertSame('01 JUN 1916', $census->censusDate()); 42da3cb887Sglarwill } 43da3cb887Sglarwill 44da3cb887Sglarwill /** 45da3cb887Sglarwill * Test the census columns 46da3cb887Sglarwill * 47da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusOfCanadaPraries1916 48da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 49da3cb887Sglarwill * 50da3cb887Sglarwill * @return void 51da3cb887Sglarwill */ 52da3cb887Sglarwill public function testColumns(): void 53da3cb887Sglarwill { 54da3cb887Sglarwill $census = new CensusOfCanadaPraries1916(); 55da3cb887Sglarwill $columns = $census->columns(); 56da3cb887Sglarwill 57da3cb887Sglarwill self::assertCount(19, $columns); 58da3cb887Sglarwill self::assertInstanceOf(CensusColumnFullName::class, $columns[0]); 59da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[1]); 60da3cb887Sglarwill self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[2]); 61da3cb887Sglarwill self::assertInstanceOf(CensusColumnSexMF::class, $columns[3]); 62da3cb887Sglarwill self::assertInstanceOf(CensusColumnConditionCanada::class, $columns[4]); 63da3cb887Sglarwill self::assertInstanceOf(CensusColumnAge::class, $columns[5]); 64da3cb887Sglarwill self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[6]); 65da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[7]); 66da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[8]); 67da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[11]); 68da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[12]); 69da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[13]); 70da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[14]); 71da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[15]); 72da3cb887Sglarwill self::assertInstanceOf(CensusColumnOccupation::class, $columns[16]); 73da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[17]); 74da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[18]); 75da3cb887Sglarwill 76da3cb887Sglarwill self::assertSame('Name', $columns[0]->abbreviation()); 77da3cb887Sglarwill self::assertSame('Mil', $columns[1]->abbreviation()); 78da3cb887Sglarwill self::assertSame('Relation', $columns[2]->abbreviation()); 79da3cb887Sglarwill self::assertSame('Sex', $columns[3]->abbreviation()); 80da3cb887Sglarwill self::assertSame('S/M/W/D/L', $columns[4]->abbreviation()); 81da3cb887Sglarwill self::assertSame('Age', $columns[5]->abbreviation()); 82da3cb887Sglarwill self::assertSame('Birth Loc', $columns[6]->abbreviation()); 83da3cb887Sglarwill self::assertSame('Religion', $columns[7]->abbreviation()); 84da3cb887Sglarwill self::assertSame('Yr. immigrated', $columns[8]->abbreviation()); 85da3cb887Sglarwill self::assertSame('Nationality', $columns[9]->abbreviation()); 86da3cb887Sglarwill self::assertSame('Origin', $columns[10]->abbreviation()); 87da3cb887Sglarwill self::assertSame('English', $columns[11]->abbreviation()); 88da3cb887Sglarwill self::assertSame('French', $columns[12]->abbreviation()); 89da3cb887Sglarwill self::assertSame('Language', $columns[13]->abbreviation()); 90da3cb887Sglarwill self::assertSame('Read', $columns[14]->abbreviation()); 91da3cb887Sglarwill self::assertSame('Write', $columns[15]->abbreviation()); 92da3cb887Sglarwill self::assertSame('Occupation', $columns[16]->abbreviation()); 93da3cb887Sglarwill self::assertSame('E/W/OA', $columns[17]->abbreviation()); 94da3cb887Sglarwill self::assertSame('Where employed', $columns[18]->abbreviation()); 95da3cb887Sglarwill 96da3cb887Sglarwill self::assertSame('Name of each person in family, household or institution', $columns[0]->title()); 97da3cb887Sglarwill self::assertSame('Military Service', $columns[1]->title()); 98da3cb887Sglarwill self::assertSame('Relationship to Head of Family or household', $columns[2]->title()); 99da3cb887Sglarwill self::assertSame('Sex', $columns[3]->title()); 100da3cb887Sglarwill self::assertSame('Single, Married, Widowed, Divorced or Legally Separated', $columns[4]->title()); 101da3cb887Sglarwill self::assertSame('Age at last birthday - on June 1, 1916', $columns[5]->title()); 102da3cb887Sglarwill self::assertSame('Country or place of birth', $columns[6]->title()); 103da3cb887Sglarwill self::assertSame('Religion', $columns[7]->title()); 104da3cb887Sglarwill self::assertSame('Year of immigration to Canada', $columns[8]->title()); 105da3cb887Sglarwill self::assertSame('Nationality', $columns[9]->title()); 106da3cb887Sglarwill self::assertSame('Racial or tribal origin', $columns[10]->title()); 107da3cb887Sglarwill self::assertSame('Can speak English', $columns[11]->title()); 108da3cb887Sglarwill self::assertSame('Can speak French', $columns[12]->title()); 109da3cb887Sglarwill self::assertSame('Mother tongue', $columns[13]->title()); 110da3cb887Sglarwill self::assertSame('Can read', $columns[14]->title()); 111da3cb887Sglarwill self::assertSame('Can write', $columns[15]->title()); 112da3cb887Sglarwill self::assertSame('Chief occupation or trade', $columns[16]->title()); 113da3cb887Sglarwill self::assertSame('Employer "e", Employee or worker "w", Working on own account "o.a."', $columns[17]->title()); 114da3cb887Sglarwill self::assertSame('State where person was employed as "on farm", "in cotton mill", "in foundry", "in dry goods store", "in saw-mill", etc.', $columns[18]->title()); 115da3cb887Sglarwill } 116da3cb887Sglarwill} 117