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(CensusOfCanada1881::class)] 26*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)] 2753a83c54Sglarwillclass CensusOfCanada1881Test extends TestCase 2853a83c54Sglarwill{ 2953a83c54Sglarwill /** 3053a83c54Sglarwill * Test the census place and date 3153a83c54Sglarwill */ 3253a83c54Sglarwill public function testPlaceAndDate(): void 3353a83c54Sglarwill { 3453a83c54Sglarwill $census = new CensusOfCanada1881(); 3553a83c54Sglarwill 3653a83c54Sglarwill self::assertSame('Canada', $census->censusPlace()); 3753a83c54Sglarwill self::assertSame('04 APR 1881', $census->censusDate()); 3853a83c54Sglarwill } 3953a83c54Sglarwill 4053a83c54Sglarwill /** 4153a83c54Sglarwill * Test the census columns 4253a83c54Sglarwill */ 4353a83c54Sglarwill public function testColumns(): void 4453a83c54Sglarwill { 4553a83c54Sglarwill $census = new CensusOfCanada1881(); 4653a83c54Sglarwill $columns = $census->columns(); 4753a83c54Sglarwill 4853a83c54Sglarwill self::assertCount(14, $columns); 4953a83c54Sglarwill self::assertInstanceOf(CensusColumnFullName::class, $columns[0]); 5053a83c54Sglarwill self::assertInstanceOf(CensusColumnSexMF::class, $columns[1]); 5153a83c54Sglarwill self::assertInstanceOf(CensusColumnAge::class, $columns[2]); 5253a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[3]); 5353a83c54Sglarwill self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[4]); 5453a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[5]); 5553a83c54Sglarwill self::assertInstanceOf(CensusColumnNationality::class, $columns[6]); 5653a83c54Sglarwill self::assertInstanceOf(CensusColumnOccupation::class, $columns[7]); 57da3cb887Sglarwill self::assertInstanceOf(CensusColumnConditionCanadaMarriedWidowed::class, $columns[8]); 5853a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[9]); 5953a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[10]); 6053a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[11]); 6153a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[12]); 6253a83c54Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[13]); 6353a83c54Sglarwill 6453a83c54Sglarwill self::assertSame('Name', $columns[0]->abbreviation()); 6553a83c54Sglarwill self::assertSame('Sex', $columns[1]->abbreviation()); 6653a83c54Sglarwill self::assertSame('Age', $columns[2]->abbreviation()); 6753a83c54Sglarwill self::assertSame('Born', $columns[3]->abbreviation()); 6853a83c54Sglarwill self::assertSame('Birth Loc', $columns[4]->abbreviation()); 6953a83c54Sglarwill self::assertSame('Religion', $columns[5]->abbreviation()); 7053a83c54Sglarwill self::assertSame('Origin', $columns[6]->abbreviation()); 7153a83c54Sglarwill self::assertSame('Occupation', $columns[7]->abbreviation()); 7253a83c54Sglarwill self::assertSame('M/W', $columns[8]->abbreviation()); 7353a83c54Sglarwill self::assertSame('School', $columns[9]->abbreviation()); 7453a83c54Sglarwill self::assertSame('Deaf', $columns[10]->abbreviation()); 7553a83c54Sglarwill self::assertSame('Blind', $columns[11]->abbreviation()); 7653a83c54Sglarwill self::assertSame('Unsound', $columns[12]->abbreviation()); 7753a83c54Sglarwill self::assertSame('Date', $columns[13]->abbreviation()); 7853a83c54Sglarwill 7953a83c54Sglarwill self::assertSame('Name', $columns[0]->title()); 8053a83c54Sglarwill self::assertSame('Sex', $columns[1]->title()); 8153a83c54Sglarwill self::assertSame('Age at last birthday', $columns[2]->title()); 8253a83c54Sglarwill self::assertSame('Born within last twelve months', $columns[3]->title()); 8353a83c54Sglarwill self::assertSame('Country or Province of Birth', $columns[4]->title()); 8453a83c54Sglarwill self::assertSame('Religion', $columns[5]->title()); 8553a83c54Sglarwill self::assertSame('Origin', $columns[6]->title()); 8653a83c54Sglarwill self::assertSame('Profession, Occupation, or Trade', $columns[7]->title()); 8753a83c54Sglarwill self::assertSame('Married or Widowed', $columns[8]->title()); 8853a83c54Sglarwill self::assertSame('Instruction - Going to School', $columns[9]->title()); 8953a83c54Sglarwill self::assertSame('Infirmities - Deaf and Dumb', $columns[10]->title()); 9053a83c54Sglarwill self::assertSame('Infirmities - Blind', $columns[11]->title()); 9153a83c54Sglarwill self::assertSame('Infirmities - Unsound Mind', $columns[12]->title()); 9253a83c54Sglarwill self::assertSame('Dates of Operations and Remarks', $columns[13]->title()); 9353a83c54Sglarwill } 9453a83c54Sglarwill} 95