xref: /webtrees/tests/app/Census/RegisterOfEngland1939Test.php (revision 8fcd0d32e56ee262912bbdb593202cfd1cbc1615)
15df8e840SDavid Drury<?php
25df8e840SDavid Drury/**
35df8e840SDavid Drury * webtrees: online genealogy
4*8fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
55df8e840SDavid Drury * This program is free software: you can redistribute it and/or modify
65df8e840SDavid Drury * it under the terms of the GNU General Public License as published by
75df8e840SDavid Drury * the Free Software Foundation, either version 3 of the License, or
85df8e840SDavid Drury * (at your option) any later version.
95df8e840SDavid Drury * This program is distributed in the hope that it will be useful,
105df8e840SDavid Drury * but WITHOUT ANY WARRANTY; without even the implied warranty of
115df8e840SDavid Drury * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
125df8e840SDavid Drury * GNU General Public License for more details.
135df8e840SDavid Drury * You should have received a copy of the GNU General Public License
145df8e840SDavid Drury * along with this program. If not, see <http://www.gnu.org/licenses/>.
155df8e840SDavid Drury */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
185df8e840SDavid Drurynamespace Fisharebest\Webtrees\Census;
195df8e840SDavid Drury
205df8e840SDavid Drury/**
215df8e840SDavid Drury * Test harness for the class RegisterOfEngland1939
225df8e840SDavid Drury */
2384e2cf4eSGreg Roachclass RegisterOfEngland1939Test extends \Fisharebest\Webtrees\TestCase
24c1010edaSGreg Roach{
255df8e840SDavid Drury    /**
265df8e840SDavid Drury     * Test the census place and date
275df8e840SDavid Drury     *
2815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\RegisterOfEngland1939
2952348eb8SGreg Roach     *
3052348eb8SGreg Roach     * @return void
315df8e840SDavid Drury     */
32c1010edaSGreg Roach    public function testPlaceAndDate()
33c1010edaSGreg Roach    {
345df8e840SDavid Drury        $census = new RegisterOfEngland1939;
355df8e840SDavid Drury
365df8e840SDavid Drury        $this->assertSame('England', $census->censusPlace());
375df8e840SDavid Drury        $this->assertSame('29 SEP 1939', $census->censusDate());
385df8e840SDavid Drury    }
395df8e840SDavid Drury
405df8e840SDavid Drury    /**
415df8e840SDavid Drury     * Test the census columns
425df8e840SDavid Drury     *
4315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\RegisterOfEngland1939
4415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4552348eb8SGreg Roach     *
4652348eb8SGreg Roach     * @return void
475df8e840SDavid Drury     */
48c1010edaSGreg Roach    public function testColumns()
49c1010edaSGreg Roach    {
505df8e840SDavid Drury        $census  = new RegisterOfEngland1939;
515df8e840SDavid Drury        $columns = $census->columns();
525df8e840SDavid Drury
535df8e840SDavid Drury        $this->assertCount(8, $columns);
545df8e840SDavid Drury        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[0]);
555df8e840SDavid Drury        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[1]);
565df8e840SDavid Drury        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNames', $columns[2]);
575df8e840SDavid Drury        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]);
585df8e840SDavid Drury        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[4]);
595df8e840SDavid Drury        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthDayMonthSlashYear', $columns[5]);
605df8e840SDavid Drury        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionEnglish', $columns[6]);
615df8e840SDavid Drury        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[7]);
625df8e840SDavid Drury
635df8e840SDavid Drury        $this->assertSame('Schedule', $columns[0]->abbreviation());
645df8e840SDavid Drury        $this->assertSame('SubNum', $columns[1]->abbreviation());
655df8e840SDavid Drury        $this->assertSame('Name', $columns[2]->abbreviation());
665df8e840SDavid Drury        $this->assertSame('Role', $columns[3]->abbreviation());
67eb2a4ab4SDavid Drury        $this->assertSame('Sex', $columns[4]->abbreviation());
68eb2a4ab4SDavid Drury        $this->assertSame('DOB', $columns[5]->abbreviation());
69eb2a4ab4SDavid Drury        $this->assertSame('MC', $columns[6]->abbreviation());
705df8e840SDavid Drury        $this->assertSame('Occupation', $columns[7]->abbreviation());
715df8e840SDavid Drury
725df8e840SDavid Drury        $this->assertSame('Schedule Number', $columns[0]->title());
735df8e840SDavid Drury        $this->assertSame('Schedule Sub Number', $columns[1]->title());
745df8e840SDavid Drury        $this->assertSame('Surname & other names', $columns[2]->title());
75eb2a4ab4SDavid Drury        $this->assertSame('For institutions only – for example, Officer, Visitor, Servant, Patient, Inmate', $columns[3]->title());
765df8e840SDavid Drury        $this->assertSame('Male or Female', $columns[4]->title());
775df8e840SDavid Drury        $this->assertSame('Date of birth', $columns[5]->title());
78eb2a4ab4SDavid Drury        $this->assertSame('Marital Condition - Married, Single, Unmarried, Widowed or Divorced', $columns[6]->title());
795df8e840SDavid Drury        $this->assertSame('Occupation', $columns[7]->title());
805df8e840SDavid Drury    }
815df8e840SDavid Drury}
82