153a83c54Sglarwill<?php 253a83c54Sglarwill 353a83c54Sglarwill/** 453a83c54Sglarwill * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 653a83c54Sglarwill * This program is free software: you can redistribute it and/or modify 753a83c54Sglarwill * it under the terms of the GNU General Public License as published by 853a83c54Sglarwill * the Free Software Foundation, either version 3 of the License, or 953a83c54Sglarwill * (at your option) any later version. 1053a83c54Sglarwill * This program is distributed in the hope that it will be useful, 1153a83c54Sglarwill * but WITHOUT ANY WARRANTY; without even the implied warranty of 1253a83c54Sglarwill * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1353a83c54Sglarwill * GNU General Public License for more details. 1453a83c54Sglarwill * You should have received a copy of the GNU General Public License 1553a83c54Sglarwill * along with this program. If not, see <https://www.gnu.org/licenses/>. 1653a83c54Sglarwill */ 1753a83c54Sglarwill 1853a83c54Sglarwilldeclare(strict_types=1); 1953a83c54Sglarwill 2053a83c54Sglarwillnamespace Fisharebest\Webtrees\Census; 2153a83c54Sglarwill 2253a83c54Sglarwilluse Fisharebest\Webtrees\TestCase; 23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass; 2453a83c54Sglarwill 25*202c018bSGreg Roach#[CoversClass(CensusOfCanada1901::class)] 26*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)] 2753a83c54Sglarwillclass CensusOfCanada1901Test extends TestCase 2853a83c54Sglarwill{ 2953a83c54Sglarwill /** 3053a83c54Sglarwill * Test the census place and date 3153a83c54Sglarwill */ 3253a83c54Sglarwill public function testPlaceAndDate(): void 3353a83c54Sglarwill { 3453a83c54Sglarwill $census = new CensusOfCanada1901(); 3553a83c54Sglarwill 3653a83c54Sglarwill self::assertSame('Canada', $census->censusPlace()); 3753a83c54Sglarwill self::assertSame('31 MAR 1901', $census->censusDate()); 3853a83c54Sglarwill } 3953a83c54Sglarwill 4053a83c54Sglarwill /** 4153a83c54Sglarwill * Test the census columns 4253a83c54Sglarwill */ 4353a83c54Sglarwill public function testColumns(): void 4453a83c54Sglarwill { 4553a83c54Sglarwill $census = new CensusOfCanada1901(); 4653a83c54Sglarwill $columns = $census->columns(); 4753a83c54Sglarwill 4853a83c54Sglarwill self::assertCount(30, $columns); 4953a83c54Sglarwill self::assertInstanceOf(CensusColumnFullName::class, $columns[0]); 5053a83c54Sglarwill self::assertInstanceOf(CensusColumnSexMF::class, $columns[1]); 5153a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[2]); 5253a83c54Sglarwill self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[3]); 53da3cb887Sglarwill self::assertInstanceOf(CensusColumnConditionCanada::class, $columns[4]); 5453a83c54Sglarwill self::assertInstanceOf(CensusColumnBirthMonthDay::class, $columns[5]); 5553a83c54Sglarwill self::assertInstanceOf(CensusColumnBirthYear::class, $columns[6]); 5653a83c54Sglarwill self::assertInstanceOf(CensusColumnAge::class, $columns[7]); 5753a83c54Sglarwill self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[8]); 5853a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[9]); 5953a83c54Sglarwill self::assertInstanceOf(CensusColumnNationality::class, $columns[10]); 6053a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[11]); 6153a83c54Sglarwill self::assertInstanceOf(CensusColumnOccupation::class, $columns[12]); 6253a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[13]); 6353a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[14]); 6453a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[15]); 6553a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[16]); 6653a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[17]); 6753a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[18]); 6853a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[19]); 6953a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[20]); 7053a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[21]); 7153a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[22]); 7253a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[23]); 7353a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[24]); 7453a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[25]); 7553a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[26]); 7653a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[27]); 7753a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[28]); 7853a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[29]); 7953a83c54Sglarwill 8053a83c54Sglarwill self::assertSame('Name', $columns[0]->abbreviation()); 8153a83c54Sglarwill self::assertSame('Sex', $columns[1]->abbreviation()); 8253a83c54Sglarwill self::assertSame('Color', $columns[2]->abbreviation()); 8353a83c54Sglarwill self::assertSame('Relation', $columns[3]->abbreviation()); 8453a83c54Sglarwill self::assertSame('S/M/W/D', $columns[4]->abbreviation()); 8553a83c54Sglarwill self::assertSame('M/D', $columns[5]->abbreviation()); 8653a83c54Sglarwill self::assertSame('Year', $columns[6]->abbreviation()); 8753a83c54Sglarwill self::assertSame('Age', $columns[7]->abbreviation()); 8853a83c54Sglarwill self::assertSame('Birth Loc', $columns[8]->abbreviation()); 8953a83c54Sglarwill self::assertSame('Origin', $columns[9]->abbreviation()); 9053a83c54Sglarwill self::assertSame('Nationality', $columns[10]->abbreviation()); 9153a83c54Sglarwill self::assertSame('Religion', $columns[11]->abbreviation()); 9253a83c54Sglarwill self::assertSame('Occupation', $columns[12]->abbreviation()); 9353a83c54Sglarwill self::assertSame('Retired', $columns[13]->abbreviation()); 9453a83c54Sglarwill self::assertSame('Employer', $columns[14]->abbreviation()); 9553a83c54Sglarwill self::assertSame('Employee', $columns[15]->abbreviation()); 9653a83c54Sglarwill self::assertSame('Work on own', $columns[16]->abbreviation()); 9753a83c54Sglarwill self::assertSame('Trade', $columns[17]->abbreviation()); 9853a83c54Sglarwill self::assertSame('Ms Fac', $columns[18]->abbreviation()); 9953a83c54Sglarwill self::assertSame('Ms Home', $columns[19]->abbreviation()); 10053a83c54Sglarwill self::assertSame('Ms Other', $columns[20]->abbreviation()); 10153a83c54Sglarwill self::assertSame('Earnings', $columns[21]->abbreviation()); 10253a83c54Sglarwill self::assertSame('Extra Earn', $columns[22]->abbreviation()); 10353a83c54Sglarwill self::assertSame('Edu Month', $columns[23]->abbreviation()); 10453a83c54Sglarwill self::assertSame('Read', $columns[24]->abbreviation()); 10553a83c54Sglarwill self::assertSame('Write', $columns[25]->abbreviation()); 10653a83c54Sglarwill self::assertSame('English', $columns[26]->abbreviation()); 10753a83c54Sglarwill self::assertSame('French', $columns[27]->abbreviation()); 10853a83c54Sglarwill self::assertSame('Mother toungue', $columns[28]->abbreviation()); 10953a83c54Sglarwill self::assertSame('Infirmities', $columns[29]->abbreviation()); 11053a83c54Sglarwill 11153a83c54Sglarwill self::assertSame('Name', $columns[0]->title()); 11253a83c54Sglarwill self::assertSame('Sex', $columns[1]->title()); 11353a83c54Sglarwill self::assertSame('Colour', $columns[2]->title()); 11453a83c54Sglarwill self::assertSame('Relationship to Head of Family', $columns[3]->title()); 11553a83c54Sglarwill self::assertSame('Single, married, widowed or divorced', $columns[4]->title()); 11653a83c54Sglarwill self::assertSame('Month and date of birth', $columns[5]->title()); 11753a83c54Sglarwill self::assertSame('Year of birth', $columns[6]->title()); 11853a83c54Sglarwill self::assertSame('Age at last birthday', $columns[7]->title()); 11953a83c54Sglarwill self::assertSame('Country or Place of Birth, plus Rural or Urban', $columns[8]->title()); 12053a83c54Sglarwill self::assertSame('Racial or Tribal origin', $columns[9]->title()); 12153a83c54Sglarwill self::assertSame('Nationality', $columns[10]->title()); 12253a83c54Sglarwill self::assertSame('Religion', $columns[11]->title()); 12353a83c54Sglarwill self::assertSame('Profession, Occupation or Trade', $columns[12]->title()); 12453a83c54Sglarwill self::assertSame('Living on own means', $columns[13]->title()); 12553a83c54Sglarwill self::assertSame('Employer', $columns[14]->title()); 12653a83c54Sglarwill self::assertSame('Employee', $columns[15]->title()); 12753a83c54Sglarwill self::assertSame('Working on own account', $columns[16]->title()); 12853a83c54Sglarwill self::assertSame('Working at trade in factory or home', $columns[17]->title()); 12953a83c54Sglarwill self::assertSame('Months employed at trade in factory', $columns[18]->title()); 13053a83c54Sglarwill self::assertSame('Months employed at trade in home', $columns[19]->title()); 13153a83c54Sglarwill self::assertSame('Months employed in other than trade in factory or home', $columns[20]->title()); 13253a83c54Sglarwill self::assertSame('Earnings from occupation or trade $', $columns[21]->title()); 13353a83c54Sglarwill self::assertSame('Extra earnings (from other than occupation or trade) $', $columns[22]->title()); 13453a83c54Sglarwill self::assertSame('Months at school in year', $columns[23]->title()); 13553a83c54Sglarwill self::assertSame('Can Read', $columns[24]->title()); 13653a83c54Sglarwill self::assertSame('Can Write', $columns[25]->title()); 13753a83c54Sglarwill self::assertSame('Speaks English', $columns[26]->title()); 13853a83c54Sglarwill self::assertSame('Speaks French', $columns[27]->title()); 13953a83c54Sglarwill self::assertSame('Mother toungue', $columns[28]->title()); 14053a83c54Sglarwill self::assertSame('Infirmities - a. Deaf and dumb, b. Blind, c. Unsound mind', $columns[29]->title()); 14153a83c54Sglarwill } 14253a83c54Sglarwill} 143