xref: /webtrees/tests/app/Census/RegisterOfEngland1939Test.php (revision fcfa147e10aaa6c7ff580c29bd6e5b88666befc1)
15df8e840SDavid Drury<?php
23976b470SGreg Roach
35df8e840SDavid Drury/**
45df8e840SDavid Drury * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
65df8e840SDavid Drury * This program is free software: you can redistribute it and/or modify
75df8e840SDavid Drury * it under the terms of the GNU General Public License as published by
85df8e840SDavid Drury * the Free Software Foundation, either version 3 of the License, or
95df8e840SDavid Drury * (at your option) any later version.
105df8e840SDavid Drury * This program is distributed in the hope that it will be useful,
115df8e840SDavid Drury * but WITHOUT ANY WARRANTY; without even the implied warranty of
125df8e840SDavid Drury * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
135df8e840SDavid Drury * GNU General Public License for more details.
145df8e840SDavid Drury * You should have received a copy of the GNU General Public License
155df8e840SDavid Drury * along with this program. If not, see <http://www.gnu.org/licenses/>.
165df8e840SDavid Drury */
17*fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
205df8e840SDavid Drurynamespace Fisharebest\Webtrees\Census;
215df8e840SDavid Drury
223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
233cfcc809SGreg Roach
245df8e840SDavid Drury/**
255df8e840SDavid Drury * Test harness for the class RegisterOfEngland1939
265df8e840SDavid Drury */
273cfcc809SGreg Roachclass RegisterOfEngland1939Test extends TestCase
28c1010edaSGreg Roach{
295df8e840SDavid Drury    /**
305df8e840SDavid Drury     * Test the census place and date
315df8e840SDavid Drury     *
3215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\RegisterOfEngland1939
3352348eb8SGreg Roach     *
3452348eb8SGreg Roach     * @return void
355df8e840SDavid Drury     */
369b802b22SGreg Roach    public function testPlaceAndDate(): void
37c1010edaSGreg Roach    {
3874d6dc0eSGreg Roach        $census = new RegisterOfEngland1939();
395df8e840SDavid Drury
405df8e840SDavid Drury        $this->assertSame('England', $census->censusPlace());
415df8e840SDavid Drury        $this->assertSame('29 SEP 1939', $census->censusDate());
425df8e840SDavid Drury    }
435df8e840SDavid Drury
445df8e840SDavid Drury    /**
455df8e840SDavid Drury     * Test the census columns
465df8e840SDavid Drury     *
4715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\RegisterOfEngland1939
4815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4952348eb8SGreg Roach     *
5052348eb8SGreg Roach     * @return void
515df8e840SDavid Drury     */
529b802b22SGreg Roach    public function testColumns(): void
53c1010edaSGreg Roach    {
5474d6dc0eSGreg Roach        $census  = new RegisterOfEngland1939();
555df8e840SDavid Drury        $columns = $census->columns();
565df8e840SDavid Drury
575df8e840SDavid Drury        $this->assertCount(8, $columns);
583cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[0]);
593cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[1]);
603cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnSurnameGivenNames::class, $columns[2]);
613cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[3]);
623cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnSexMF::class, $columns[4]);
633cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnBirthDayMonthSlashYear::class, $columns[5]);
643cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnConditionEnglish::class, $columns[6]);
653cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnOccupation::class, $columns[7]);
665df8e840SDavid Drury
675df8e840SDavid Drury        $this->assertSame('Schedule', $columns[0]->abbreviation());
685df8e840SDavid Drury        $this->assertSame('SubNum', $columns[1]->abbreviation());
695df8e840SDavid Drury        $this->assertSame('Name', $columns[2]->abbreviation());
705df8e840SDavid Drury        $this->assertSame('Role', $columns[3]->abbreviation());
71eb2a4ab4SDavid Drury        $this->assertSame('Sex', $columns[4]->abbreviation());
72eb2a4ab4SDavid Drury        $this->assertSame('DOB', $columns[5]->abbreviation());
73eb2a4ab4SDavid Drury        $this->assertSame('MC', $columns[6]->abbreviation());
745df8e840SDavid Drury        $this->assertSame('Occupation', $columns[7]->abbreviation());
755df8e840SDavid Drury
765df8e840SDavid Drury        $this->assertSame('Schedule Number', $columns[0]->title());
775df8e840SDavid Drury        $this->assertSame('Schedule Sub Number', $columns[1]->title());
785df8e840SDavid Drury        $this->assertSame('Surname & other names', $columns[2]->title());
79eb2a4ab4SDavid Drury        $this->assertSame('For institutions only – for example, Officer, Visitor, Servant, Patient, Inmate', $columns[3]->title());
805df8e840SDavid Drury        $this->assertSame('Male or Female', $columns[4]->title());
815df8e840SDavid Drury        $this->assertSame('Date of birth', $columns[5]->title());
82eb2a4ab4SDavid Drury        $this->assertSame('Marital Condition - Married, Single, Unmarried, Widowed or Divorced', $columns[6]->title());
835df8e840SDavid Drury        $this->assertSame('Occupation', $columns[7]->title());
845df8e840SDavid Drury    }
855df8e840SDavid Drury}
86