1*53a83c54Sglarwill<?php 2*53a83c54Sglarwill 3*53a83c54Sglarwill/** 4*53a83c54Sglarwill * webtrees: online genealogy 5*53a83c54Sglarwill * Copyright (C) 2021 webtrees development team 6*53a83c54Sglarwill * This program is free software: you can redistribute it and/or modify 7*53a83c54Sglarwill * it under the terms of the GNU General Public License as published by 8*53a83c54Sglarwill * the Free Software Foundation, either version 3 of the License, or 9*53a83c54Sglarwill * (at your option) any later version. 10*53a83c54Sglarwill * This program is distributed in the hope that it will be useful, 11*53a83c54Sglarwill * but WITHOUT ANY WARRANTY; without even the implied warranty of 12*53a83c54Sglarwill * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*53a83c54Sglarwill * GNU General Public License for more details. 14*53a83c54Sglarwill * You should have received a copy of the GNU General Public License 15*53a83c54Sglarwill * along with this program. If not, see <https://www.gnu.org/licenses/>. 16*53a83c54Sglarwill */ 17*53a83c54Sglarwill 18*53a83c54Sglarwilldeclare(strict_types=1); 19*53a83c54Sglarwill 20*53a83c54Sglarwillnamespace Fisharebest\Webtrees\Census; 21*53a83c54Sglarwill 22*53a83c54Sglarwilluse Fisharebest\Webtrees\TestCase; 23*53a83c54Sglarwill 24*53a83c54Sglarwill/** 25*53a83c54Sglarwill * Test harness for the class CensusOfCanada1901 26*53a83c54Sglarwill */ 27*53a83c54Sglarwillclass CensusOfCanada1901Test extends TestCase 28*53a83c54Sglarwill{ 29*53a83c54Sglarwill /** 30*53a83c54Sglarwill * Test the census place and date 31*53a83c54Sglarwill * 32*53a83c54Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusOfCanada1901 33*53a83c54Sglarwill * 34*53a83c54Sglarwill * @return void 35*53a83c54Sglarwill */ 36*53a83c54Sglarwill public function testPlaceAndDate(): void 37*53a83c54Sglarwill { 38*53a83c54Sglarwill $census = new CensusOfCanada1901(); 39*53a83c54Sglarwill 40*53a83c54Sglarwill self::assertSame('Canada', $census->censusPlace()); 41*53a83c54Sglarwill self::assertSame('31 MAR 1901', $census->censusDate()); 42*53a83c54Sglarwill } 43*53a83c54Sglarwill 44*53a83c54Sglarwill /** 45*53a83c54Sglarwill * Test the census columns 46*53a83c54Sglarwill * 47*53a83c54Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusOfCanada1901 48*53a83c54Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 49*53a83c54Sglarwill * 50*53a83c54Sglarwill * @return void 51*53a83c54Sglarwill */ 52*53a83c54Sglarwill public function testColumns(): void 53*53a83c54Sglarwill { 54*53a83c54Sglarwill $census = new CensusOfCanada1901(); 55*53a83c54Sglarwill $columns = $census->columns(); 56*53a83c54Sglarwill 57*53a83c54Sglarwill self::assertCount(30, $columns); 58*53a83c54Sglarwill self::assertInstanceOf(CensusColumnFullName::class, $columns[0]); 59*53a83c54Sglarwill self::assertInstanceOf(CensusColumnSexMF::class, $columns[1]); 60*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[2]); 61*53a83c54Sglarwill self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[3]); 62*53a83c54Sglarwill self::assertInstanceOf(CensusColumnConditionUs::class, $columns[4]); 63*53a83c54Sglarwill self::assertInstanceOf(CensusColumnBirthMonthDay::class, $columns[5]); 64*53a83c54Sglarwill self::assertInstanceOf(CensusColumnBirthYear::class, $columns[6]); 65*53a83c54Sglarwill self::assertInstanceOf(CensusColumnAge::class, $columns[7]); 66*53a83c54Sglarwill self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[8]); 67*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[9]); 68*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNationality::class, $columns[10]); 69*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[11]); 70*53a83c54Sglarwill self::assertInstanceOf(CensusColumnOccupation::class, $columns[12]); 71*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[13]); 72*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[14]); 73*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[15]); 74*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[16]); 75*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[17]); 76*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[18]); 77*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[19]); 78*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[20]); 79*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[21]); 80*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[22]); 81*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[23]); 82*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[24]); 83*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[25]); 84*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[26]); 85*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[27]); 86*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[28]); 87*53a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[29]); 88*53a83c54Sglarwill 89*53a83c54Sglarwill self::assertSame('Name', $columns[0]->abbreviation()); 90*53a83c54Sglarwill self::assertSame('Sex', $columns[1]->abbreviation()); 91*53a83c54Sglarwill self::assertSame('Color', $columns[2]->abbreviation()); 92*53a83c54Sglarwill self::assertSame('Relation', $columns[3]->abbreviation()); 93*53a83c54Sglarwill self::assertSame('S/M/W/D', $columns[4]->abbreviation()); 94*53a83c54Sglarwill self::assertSame('M/D', $columns[5]->abbreviation()); 95*53a83c54Sglarwill self::assertSame('Year', $columns[6]->abbreviation()); 96*53a83c54Sglarwill self::assertSame('Age', $columns[7]->abbreviation()); 97*53a83c54Sglarwill self::assertSame('Birth Loc', $columns[8]->abbreviation()); 98*53a83c54Sglarwill self::assertSame('Origin', $columns[9]->abbreviation()); 99*53a83c54Sglarwill self::assertSame('Nationality', $columns[10]->abbreviation()); 100*53a83c54Sglarwill self::assertSame('Religion', $columns[11]->abbreviation()); 101*53a83c54Sglarwill self::assertSame('Occupation', $columns[12]->abbreviation()); 102*53a83c54Sglarwill self::assertSame('Retired', $columns[13]->abbreviation()); 103*53a83c54Sglarwill self::assertSame('Employer', $columns[14]->abbreviation()); 104*53a83c54Sglarwill self::assertSame('Employee', $columns[15]->abbreviation()); 105*53a83c54Sglarwill self::assertSame('Work on own', $columns[16]->abbreviation()); 106*53a83c54Sglarwill self::assertSame('Trade', $columns[17]->abbreviation()); 107*53a83c54Sglarwill self::assertSame('Ms Fac', $columns[18]->abbreviation()); 108*53a83c54Sglarwill self::assertSame('Ms Home', $columns[19]->abbreviation()); 109*53a83c54Sglarwill self::assertSame('Ms Other', $columns[20]->abbreviation()); 110*53a83c54Sglarwill self::assertSame('Earnings', $columns[21]->abbreviation()); 111*53a83c54Sglarwill self::assertSame('Extra Earn', $columns[22]->abbreviation()); 112*53a83c54Sglarwill self::assertSame('Edu Month', $columns[23]->abbreviation()); 113*53a83c54Sglarwill self::assertSame('Read', $columns[24]->abbreviation()); 114*53a83c54Sglarwill self::assertSame('Write', $columns[25]->abbreviation()); 115*53a83c54Sglarwill self::assertSame('English', $columns[26]->abbreviation()); 116*53a83c54Sglarwill self::assertSame('French', $columns[27]->abbreviation()); 117*53a83c54Sglarwill self::assertSame('Mother toungue', $columns[28]->abbreviation()); 118*53a83c54Sglarwill self::assertSame('Infirmities', $columns[29]->abbreviation()); 119*53a83c54Sglarwill 120*53a83c54Sglarwill self::assertSame('Name', $columns[0]->title()); 121*53a83c54Sglarwill self::assertSame('Sex', $columns[1]->title()); 122*53a83c54Sglarwill self::assertSame('Colour', $columns[2]->title()); 123*53a83c54Sglarwill self::assertSame('Relationship to Head of Family', $columns[3]->title()); 124*53a83c54Sglarwill self::assertSame('Single, married, widowed or divorced', $columns[4]->title()); 125*53a83c54Sglarwill self::assertSame('Month and date of birth', $columns[5]->title()); 126*53a83c54Sglarwill self::assertSame('Year of birth', $columns[6]->title()); 127*53a83c54Sglarwill self::assertSame('Age at last birthday', $columns[7]->title()); 128*53a83c54Sglarwill self::assertSame('Country or Place of Birth, plus Rural or Urban', $columns[8]->title()); 129*53a83c54Sglarwill self::assertSame('Racial or Tribal origin', $columns[9]->title()); 130*53a83c54Sglarwill self::assertSame('Nationality', $columns[10]->title()); 131*53a83c54Sglarwill self::assertSame('Religion', $columns[11]->title()); 132*53a83c54Sglarwill self::assertSame('Profession, Occupation or Trade', $columns[12]->title()); 133*53a83c54Sglarwill self::assertSame('Living on own means', $columns[13]->title()); 134*53a83c54Sglarwill self::assertSame('Employer', $columns[14]->title()); 135*53a83c54Sglarwill self::assertSame('Employee', $columns[15]->title()); 136*53a83c54Sglarwill self::assertSame('Working on own account', $columns[16]->title()); 137*53a83c54Sglarwill self::assertSame('Working at trade in factory or home', $columns[17]->title()); 138*53a83c54Sglarwill self::assertSame('Months employed at trade in factory', $columns[18]->title()); 139*53a83c54Sglarwill self::assertSame('Months employed at trade in home', $columns[19]->title()); 140*53a83c54Sglarwill self::assertSame('Months employed in other than trade in factory or home', $columns[20]->title()); 141*53a83c54Sglarwill self::assertSame('Earnings from occupation or trade $', $columns[21]->title()); 142*53a83c54Sglarwill self::assertSame('Extra earnings (from other than occupation or trade) $', $columns[22]->title()); 143*53a83c54Sglarwill self::assertSame('Months at school in year', $columns[23]->title()); 144*53a83c54Sglarwill self::assertSame('Can Read', $columns[24]->title()); 145*53a83c54Sglarwill self::assertSame('Can Write', $columns[25]->title()); 146*53a83c54Sglarwill self::assertSame('Speaks English', $columns[26]->title()); 147*53a83c54Sglarwill self::assertSame('Speaks French', $columns[27]->title()); 148*53a83c54Sglarwill self::assertSame('Mother toungue', $columns[28]->title()); 149*53a83c54Sglarwill self::assertSame('Infirmities - a. Deaf and dumb, b. Blind, c. Unsound mind', $columns[29]->title()); 150*53a83c54Sglarwill } 151*53a83c54Sglarwill} 152