xref: /webtrees/tests/app/Census/CensusOfScotland1911Test.php (revision 5a8afed46297e8105e3e5a33ce37e6a8e88bc79d)
1db7d25eeSGreg Roach<?php
23976b470SGreg Roach
3db7d25eeSGreg Roach/**
4db7d25eeSGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6db7d25eeSGreg Roach * This program is free software: you can redistribute it and/or modify
7db7d25eeSGreg Roach * it under the terms of the GNU General Public License as published by
8db7d25eeSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9db7d25eeSGreg Roach * (at your option) any later version.
10db7d25eeSGreg Roach * This program is distributed in the hope that it will be useful,
11db7d25eeSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12db7d25eeSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13db7d25eeSGreg Roach * GNU General Public License for more details.
14db7d25eeSGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16db7d25eeSGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
20db7d25eeSGreg Roachnamespace Fisharebest\Webtrees\Census;
21db7d25eeSGreg Roach
223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
243cfcc809SGreg Roach
25*202c018bSGreg Roach#[CoversClass(CensusOfScotland1911::class)]
26*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)]
273cfcc809SGreg Roachclass CensusOfScotland1911Test extends TestCase
28c1010edaSGreg Roach{
29db7d25eeSGreg Roach    /**
30db7d25eeSGreg Roach     * Test the census place and date
31db7d25eeSGreg Roach     */
329b802b22SGreg Roach    public function testPlaceAndDate(): void
33c1010edaSGreg Roach    {
3474d6dc0eSGreg Roach        $census = new CensusOfScotland1911();
35db7d25eeSGreg Roach
365e933c21SGreg Roach        self::assertSame('Scotland', $census->censusPlace());
375e933c21SGreg Roach        self::assertSame('02 APR 1911', $census->censusDate());
38db7d25eeSGreg Roach    }
39ef21b467SGreg Roach
40ef21b467SGreg Roach    /**
41ef21b467SGreg Roach     * Test the census columns
42ef21b467SGreg Roach     */
439b802b22SGreg Roach    public function testColumns(): void
44c1010edaSGreg Roach    {
4574d6dc0eSGreg Roach        $census  = new CensusOfScotland1911();
46ef21b467SGreg Roach        $columns = $census->columns();
47ef21b467SGreg Roach
480c91cc18SDavid Drury        self::assertCount(18, $columns);
490c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnNull::class, $columns[0]);
500c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnFullName::class, $columns[1]);
510c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnNull::class, $columns[2]);
520c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[3]);
530c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnAgeMale::class, $columns[4]);
540c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnAgeFemale::class, $columns[5]);
550c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnNull::class, $columns[6]);
560c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnConditionEnglish::class, $columns[7]);
570c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnYearsMarried::class, $columns[8]);
580c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnChildrenBornAlive::class, $columns[9]);
590c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnChildrenLiving::class, $columns[10]);
600c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnOccupation::class, $columns[11]);
615e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[12]);
625e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[13]);
630c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnNull::class, $columns[14]);
640c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnBirthPlace::class, $columns[15]);
650c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnNationality::class, $columns[16]);
660c91cc18SDavid Drury        self::assertInstanceOf(CensusColumnNull::class, $columns[17]);
67289506e3SGreg Roach
680c91cc18SDavid Drury        self::assertSame('Rooms', $columns[0]->abbreviation());
690c91cc18SDavid Drury        self::assertSame('Name', $columns[1]->abbreviation());
700c91cc18SDavid Drury        self::assertSame('NoPers', $columns[2]->abbreviation());
710c91cc18SDavid Drury        self::assertSame('Relation', $columns[3]->abbreviation());
720c91cc18SDavid Drury        self::assertSame('AgeM', $columns[4]->abbreviation());
730c91cc18SDavid Drury        self::assertSame('AgeF', $columns[5]->abbreviation());
740c91cc18SDavid Drury        self::assertSame('Lang', $columns[6]->abbreviation());
750c91cc18SDavid Drury        self::assertSame('Condition', $columns[7]->abbreviation());
760c91cc18SDavid Drury        self::assertSame('YrM', $columns[8]->abbreviation());
770c91cc18SDavid Drury        self::assertSame('ChA', $columns[9]->abbreviation());
780c91cc18SDavid Drury        self::assertSame('ChL', $columns[10]->abbreviation());
790c91cc18SDavid Drury        self::assertSame('Occupation', $columns[11]->abbreviation());
800c91cc18SDavid Drury        self::assertSame('Ind', $columns[12]->abbreviation());
810c91cc18SDavid Drury        self::assertSame('Emp', $columns[13]->abbreviation());
820c91cc18SDavid Drury        self::assertSame('Home', $columns[14]->abbreviation());
830c91cc18SDavid Drury        self::assertSame('Birthplace', $columns[15]->abbreviation());
840c91cc18SDavid Drury        self::assertSame('Nat', $columns[16]->abbreviation());
850c91cc18SDavid Drury        self::assertSame('Infirm', $columns[17]->abbreviation());
86289506e3SGreg Roach
870c91cc18SDavid Drury        self::assertSame('Rooms with one or more windows', $columns[0]->title());
880c91cc18SDavid Drury        self::assertSame('Name and surname', $columns[1]->title());
890c91cc18SDavid Drury        self::assertSame('Number of persons in the house', $columns[2]->title());
900c91cc18SDavid Drury        self::assertSame('Relation to head of household', $columns[3]->title());
910c91cc18SDavid Drury        self::assertSame('Age (males)', $columns[4]->title());
920c91cc18SDavid Drury        self::assertSame('Age (females)', $columns[5]->title());
930c91cc18SDavid Drury        self::assertSame('Gaelic or G & E', $columns[6]->title());
940c91cc18SDavid Drury        self::assertSame('Condition', $columns[7]->title());
950c91cc18SDavid Drury        self::assertSame('Years married', $columns[8]->title());
960c91cc18SDavid Drury        self::assertSame('Children born alive', $columns[9]->title());
970c91cc18SDavid Drury        self::assertSame('Children who are still alive', $columns[10]->title());
980c91cc18SDavid Drury        self::assertSame('Rank, profession or occupation', $columns[11]->title());
990c91cc18SDavid Drury        self::assertSame('Industry', $columns[12]->title());
1000c91cc18SDavid Drury        self::assertSame('Employer, worker or own account', $columns[13]->title());
1010c91cc18SDavid Drury        self::assertSame('Working at home', $columns[14]->title());
1020c91cc18SDavid Drury        self::assertSame('Where born', $columns[15]->title());
1030c91cc18SDavid Drury        self::assertSame('Nationality', $columns[16]->title());
1040c91cc18SDavid Drury        self::assertSame('Infirmity', $columns[17]->title());
105ef21b467SGreg Roach    }
106db7d25eeSGreg Roach}
107