1d3fc2f7aSDavid Drury<?php 2d3fc2f7aSDavid Drury 3d3fc2f7aSDavid Drury/** 4d3fc2f7aSDavid Drury * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6d3fc2f7aSDavid Drury * This program is free software: you can redistribute it and/or modify 7d3fc2f7aSDavid Drury * it under the terms of the GNU General Public License as published by 8d3fc2f7aSDavid Drury * the Free Software Foundation, either version 3 of the License, or 9d3fc2f7aSDavid Drury * (at your option) any later version. 10d3fc2f7aSDavid Drury * This program is distributed in the hope that it will be useful, 11d3fc2f7aSDavid Drury * but WITHOUT ANY WARRANTY; without even the implied warranty of 12d3fc2f7aSDavid Drury * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13d3fc2f7aSDavid Drury * GNU General Public License for more details. 14d3fc2f7aSDavid Drury * You should have received a copy of the GNU General Public License 15d3fc2f7aSDavid Drury * along with this program. If not, see <https://www.gnu.org/licenses/>. 16d3fc2f7aSDavid Drury */ 17d3fc2f7aSDavid Drury 18d3fc2f7aSDavid Drurydeclare(strict_types=1); 19d3fc2f7aSDavid Drury 20d3fc2f7aSDavid Drurynamespace Fisharebest\Webtrees\Census; 21d3fc2f7aSDavid Drury 22d3fc2f7aSDavid Druryuse Fisharebest\Webtrees\TestCase; 23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass; 24d3fc2f7aSDavid Drury 25*202c018bSGreg Roach#[CoversClass(RegisterOfScotland1939::class)] 26*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)] 27d3fc2f7aSDavid Druryclass RegisterOfScotland1939Test extends TestCase 28d3fc2f7aSDavid Drury{ 29d3fc2f7aSDavid Drury /** 30d3fc2f7aSDavid Drury * Test the census place and date 31d3fc2f7aSDavid Drury */ 32d3fc2f7aSDavid Drury public function testPlaceAndDate(): void 33d3fc2f7aSDavid Drury { 34d3fc2f7aSDavid Drury $census = new RegisterOfScotland1939(); 35d3fc2f7aSDavid Drury 36d3fc2f7aSDavid Drury self::assertSame('Scotland', $census->censusPlace()); 37d3fc2f7aSDavid Drury self::assertSame('29 SEP 1939', $census->censusDate()); 38d3fc2f7aSDavid Drury } 39d3fc2f7aSDavid Drury 40d3fc2f7aSDavid Drury /** 41d3fc2f7aSDavid Drury * Test the census columns 42d3fc2f7aSDavid Drury */ 43d3fc2f7aSDavid Drury public function testColumns(): void 44d3fc2f7aSDavid Drury { 45d3fc2f7aSDavid Drury $census = new RegisterOfScotland1939(); 46d3fc2f7aSDavid Drury $columns = $census->columns(); 47d3fc2f7aSDavid Drury 48d3fc2f7aSDavid Drury self::assertCount(8, $columns); 49d3fc2f7aSDavid Drury self::assertInstanceOf(CensusColumnNull::class, $columns[0]); 50d3fc2f7aSDavid Drury self::assertInstanceOf(CensusColumnNull::class, $columns[1]); 51d3fc2f7aSDavid Drury self::assertInstanceOf(CensusColumnSurnameGivenNames::class, $columns[2]); 52d3fc2f7aSDavid Drury self::assertInstanceOf(CensusColumnNull::class, $columns[3]); 53d3fc2f7aSDavid Drury self::assertInstanceOf(CensusColumnSexMF::class, $columns[4]); 54d3fc2f7aSDavid Drury self::assertInstanceOf(CensusColumnBirthDayMonthYear::class, $columns[5]); 55d3fc2f7aSDavid Drury self::assertInstanceOf(CensusColumnConditionEnglish::class, $columns[6]); 56d3fc2f7aSDavid Drury self::assertInstanceOf(CensusColumnOccupation::class, $columns[7]); 57d3fc2f7aSDavid Drury 58d3fc2f7aSDavid Drury self::assertSame('Schedule', $columns[0]->abbreviation()); 59d3fc2f7aSDavid Drury self::assertSame('SubNum', $columns[1]->abbreviation()); 60d3fc2f7aSDavid Drury self::assertSame('Name', $columns[2]->abbreviation()); 61d3fc2f7aSDavid Drury self::assertSame('Role', $columns[3]->abbreviation()); 62d3fc2f7aSDavid Drury self::assertSame('Sex', $columns[4]->abbreviation()); 63d3fc2f7aSDavid Drury self::assertSame('DOB', $columns[5]->abbreviation()); 64d3fc2f7aSDavid Drury self::assertSame('MC', $columns[6]->abbreviation()); 65d3fc2f7aSDavid Drury self::assertSame('Occupation', $columns[7]->abbreviation()); 66d3fc2f7aSDavid Drury 67d3fc2f7aSDavid Drury self::assertSame('Schedule Number', $columns[0]->title()); 68d3fc2f7aSDavid Drury self::assertSame('Schedule Sub Number', $columns[1]->title()); 69d3fc2f7aSDavid Drury self::assertSame('Surname & other names', $columns[2]->title()); 70d3fc2f7aSDavid Drury self::assertSame('For institutions only – for example, Officer, Visitor, Servant, Patient, Inmate', $columns[3]->title()); 71d3fc2f7aSDavid Drury self::assertSame('Male or Female', $columns[4]->title()); 72d3fc2f7aSDavid Drury self::assertSame('Date of birth', $columns[5]->title()); 73d3fc2f7aSDavid Drury self::assertSame('Marital Condition - Married, Single, Unmarried, Widowed or Divorced', $columns[6]->title()); 74d3fc2f7aSDavid Drury self::assertSame('Occupation', $columns[7]->title()); 75d3fc2f7aSDavid Drury } 76d3fc2f7aSDavid Drury} 77