xref: /webtrees/tests/app/Census/CensusOfCanada1891Test.php (revision 5a8afed46297e8105e3e5a33ce37e6a8e88bc79d)
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(CensusOfCanada1891::class)]
26*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)]
2753a83c54Sglarwillclass CensusOfCanada1891Test extends TestCase
2853a83c54Sglarwill{
2953a83c54Sglarwill    /**
3053a83c54Sglarwill     * Test the census place and date
3153a83c54Sglarwill     */
3253a83c54Sglarwill    public function testPlaceAndDate(): void
3353a83c54Sglarwill    {
3453a83c54Sglarwill        $census = new CensusOfCanada1891();
3553a83c54Sglarwill
3653a83c54Sglarwill        self::assertSame('Canada', $census->censusPlace());
3753a83c54Sglarwill        self::assertSame('06 APR 1891', $census->censusDate());
3853a83c54Sglarwill    }
3953a83c54Sglarwill
4053a83c54Sglarwill    /**
4153a83c54Sglarwill     * Test the census columns
4253a83c54Sglarwill     */
4353a83c54Sglarwill    public function testColumns(): void
4453a83c54Sglarwill    {
4553a83c54Sglarwill        $census  = new CensusOfCanada1891();
4653a83c54Sglarwill        $columns = $census->columns();
4753a83c54Sglarwill
4853a83c54Sglarwill        self::assertCount(20, $columns);
4953a83c54Sglarwill        self::assertInstanceOf(CensusColumnFullName::class, $columns[0]);
5053a83c54Sglarwill        self::assertInstanceOf(CensusColumnSexMF::class, $columns[1]);
5153a83c54Sglarwill        self::assertInstanceOf(CensusColumnAge::class, $columns[2]);
52da3cb887Sglarwill        self::assertInstanceOf(CensusColumnConditionCanadaMarriedWidowed::class, $columns[3]);
5353a83c54Sglarwill        self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[4]);
5453a83c54Sglarwill        self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[5]);
5553a83c54Sglarwill        self::assertInstanceOf(CensusColumnNull::class, $columns[6]);
5653a83c54Sglarwill        self::assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[7]);
5753a83c54Sglarwill        self::assertInstanceOf(CensusColumnMotherBirthPlaceSimple::class, $columns[8]);
5853a83c54Sglarwill        self::assertInstanceOf(CensusColumnNull::class, $columns[9]);
5953a83c54Sglarwill        self::assertInstanceOf(CensusColumnOccupation::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        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
7053a83c54Sglarwill        self::assertSame('Name', $columns[0]->abbreviation());
7153a83c54Sglarwill        self::assertSame('Sex', $columns[1]->abbreviation());
7253a83c54Sglarwill        self::assertSame('Age', $columns[2]->abbreviation());
7353a83c54Sglarwill        self::assertSame('M/W', $columns[3]->abbreviation());
7453a83c54Sglarwill        self::assertSame('Relation', $columns[4]->abbreviation());
7553a83c54Sglarwill        self::assertSame('Birth Loc', $columns[5]->abbreviation());
7653a83c54Sglarwill        self::assertSame('French', $columns[6]->abbreviation());
7753a83c54Sglarwill        self::assertSame('FBP', $columns[7]->abbreviation());
7853a83c54Sglarwill        self::assertSame('MBP', $columns[8]->abbreviation());
7953a83c54Sglarwill        self::assertSame('Religion', $columns[9]->abbreviation());
8053a83c54Sglarwill        self::assertSame('Occupation', $columns[10]->abbreviation());
8153a83c54Sglarwill        self::assertSame('Employers', $columns[11]->abbreviation());
8253a83c54Sglarwill        self::assertSame('Earner', $columns[12]->abbreviation());
8353a83c54Sglarwill        self::assertSame('UnEmp', $columns[13]->abbreviation());
8453a83c54Sglarwill        self::assertSame('AvgEmp', $columns[14]->abbreviation());
8553a83c54Sglarwill        self::assertSame('Read', $columns[15]->abbreviation());
8653a83c54Sglarwill        self::assertSame('Write', $columns[16]->abbreviation());
8753a83c54Sglarwill        self::assertSame('Deaf', $columns[17]->abbreviation());
8853a83c54Sglarwill        self::assertSame('Blind', $columns[18]->abbreviation());
8953a83c54Sglarwill        self::assertSame('Unsound', $columns[19]->abbreviation());
9053a83c54Sglarwill
9153a83c54Sglarwill        self::assertSame('Name', $columns[0]->title());
9253a83c54Sglarwill        self::assertSame('Sex', $columns[1]->title());
9353a83c54Sglarwill        self::assertSame('Age at last birthday', $columns[2]->title());
9453a83c54Sglarwill        self::assertSame('Married or Widowed', $columns[3]->title());
9553a83c54Sglarwill        self::assertSame('Relationship to Head of Family', $columns[4]->title());
9653a83c54Sglarwill        self::assertSame('Country or Province of Birth', $columns[5]->title());
9753a83c54Sglarwill        self::assertSame('French Canadians', $columns[6]->title());
9853a83c54Sglarwill        self::assertSame('Place of birth of father', $columns[7]->title());
9953a83c54Sglarwill        self::assertSame('Place of birth of mother', $columns[8]->title());
10053a83c54Sglarwill        self::assertSame('Religion', $columns[9]->title());
10153a83c54Sglarwill        self::assertSame('Profession, Occupation, or Trade', $columns[10]->title());
10253a83c54Sglarwill        self::assertSame('Employers', $columns[11]->title());
10353a83c54Sglarwill        self::assertSame('Wage Earner', $columns[12]->title());
10453a83c54Sglarwill        self::assertSame('Unemployed during week preceeding Census', $columns[13]->title());
10553a83c54Sglarwill        self::assertSame('Employer to state average number of hands employed during year', $columns[14]->title());
10653a83c54Sglarwill        self::assertSame('Instruction - Read', $columns[15]->title());
10753a83c54Sglarwill        self::assertSame('Instruction - Write', $columns[16]->title());
10853a83c54Sglarwill        self::assertSame('Infirmities - Deaf and Dumb', $columns[17]->title());
10953a83c54Sglarwill        self::assertSame('Infirmities - Blind', $columns[18]->title());
11053a83c54Sglarwill        self::assertSame('Infirmities - Unsound Mind', $columns[19]->title());
11153a83c54Sglarwill    }
11253a83c54Sglarwill}
113