1da3cb887Sglarwill<?php 2da3cb887Sglarwill 3da3cb887Sglarwill/** 4da3cb887Sglarwill * webtrees: online genealogy 5d11be702SGreg 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; 23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass; 24da3cb887Sglarwill 25*202c018bSGreg Roach#[CoversClass(CensusOfCanada1861::class)] 26*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)] 27da3cb887Sglarwillclass CensusOfCanada1861Test extends TestCase 28da3cb887Sglarwill{ 29da3cb887Sglarwill /** 30da3cb887Sglarwill * Test the census place and date 31da3cb887Sglarwill */ 32da3cb887Sglarwill public function testPlaceAndDate(): void 33da3cb887Sglarwill { 34da3cb887Sglarwill $census = new CensusOfCanada1861(); 35da3cb887Sglarwill 36da3cb887Sglarwill self::assertSame('Canada', $census->censusPlace()); 37da3cb887Sglarwill self::assertSame('14 JAN 1861', $census->censusDate()); 38da3cb887Sglarwill } 39da3cb887Sglarwill 40da3cb887Sglarwill /** 41da3cb887Sglarwill * Test the census columns 42da3cb887Sglarwill */ 43da3cb887Sglarwill public function testColumns(): void 44da3cb887Sglarwill { 45da3cb887Sglarwill $census = new CensusOfCanada1861(); 46da3cb887Sglarwill $columns = $census->columns(); 47da3cb887Sglarwill 48da3cb887Sglarwill self::assertCount(11, $columns); 49da3cb887Sglarwill self::assertInstanceOf(CensusColumnFullName::class, $columns[0]); 50da3cb887Sglarwill self::assertInstanceOf(CensusColumnOccupation::class, $columns[1]); 51da3cb887Sglarwill self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[2]); 52da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[3]); 53da3cb887Sglarwill self::assertInstanceOf(CensusColumnNull::class, $columns[4]); 54da3cb887Sglarwill self::assertInstanceOf(CensusColumnAgeNextBirthDay::class, $columns[5]); 55da3cb887Sglarwill self::assertInstanceOf(CensusColumnSexM::class, $columns[6]); 56da3cb887Sglarwill self::assertInstanceOf(CensusColumnSexF::class, $columns[7]); 57da3cb887Sglarwill self::assertInstanceOf(CensusColumnConditionCanadaMarriedSingle::class, $columns[8]); 58da3cb887Sglarwill self::assertInstanceOf(CensusColumnConditionCanadaWidowedMale::class, $columns[9]); 59da3cb887Sglarwill self::assertInstanceOf(CensusColumnConditionCanadaWidowedFemale::class, $columns[10]); 60da3cb887Sglarwill 61da3cb887Sglarwill self::assertSame('Name', $columns[0]->abbreviation()); 62da3cb887Sglarwill self::assertSame('Occupation', $columns[1]->abbreviation()); 63da3cb887Sglarwill self::assertSame('Birth Loc', $columns[2]->abbreviation()); 64da3cb887Sglarwill self::assertSame('Recent Married', $columns[3]->abbreviation()); 65da3cb887Sglarwill self::assertSame('Religion', $columns[4]->abbreviation()); 66da3cb887Sglarwill self::assertSame('Next BirthDay age', $columns[5]->abbreviation()); 67da3cb887Sglarwill self::assertSame('Sex: male', $columns[6]->abbreviation()); 68da3cb887Sglarwill self::assertSame('Sex: female', $columns[7]->abbreviation()); 69da3cb887Sglarwill self::assertSame('M/S', $columns[8]->abbreviation()); 70da3cb887Sglarwill self::assertSame('Widowers', $columns[9]->abbreviation()); 71da3cb887Sglarwill self::assertSame('Widows', $columns[10]->abbreviation()); 72da3cb887Sglarwill 73da3cb887Sglarwill self::assertSame('Name of inmates', $columns[0]->title()); 74da3cb887Sglarwill self::assertSame('Profession, trade or occupation', $columns[1]->title()); 75da3cb887Sglarwill self::assertSame('Place of birth. F indicates that the person was born of Canadian parents.', $columns[2]->title()); 76da3cb887Sglarwill self::assertSame('Married within the last twelve months', $columns[3]->title()); 77da3cb887Sglarwill self::assertSame('Religion', $columns[4]->title()); 78da3cb887Sglarwill self::assertSame('Age at NEXT birthday', $columns[5]->title()); 79da3cb887Sglarwill self::assertSame('Sex: male', $columns[6]->title()); 80da3cb887Sglarwill self::assertSame('Sex: female', $columns[7]->title()); 81da3cb887Sglarwill self::assertSame('Married or single', $columns[8]->title()); 82da3cb887Sglarwill self::assertSame('Widowers', $columns[9]->title()); 83da3cb887Sglarwill self::assertSame('Widows', $columns[10]->title()); 84da3cb887Sglarwill } 85da3cb887Sglarwill} 86