xref: /webtrees/tests/app/Census/RegisterOfEngland1939Test.php (revision 3e983931fdde6db78f1490364106d7d46e77dea7)
15df8e840SDavid Drury<?php
25df8e840SDavid Drury
35df8e840SDavid Drury/**
45df8e840SDavid Drury * webtrees: online genealogy
5825270d6SGreg Roach * Copyright (C) 2017 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 */
175df8e840SDavid Drurynamespace Fisharebest\Webtrees\Census;
185df8e840SDavid Drury
195df8e840SDavid Drury/**
205df8e840SDavid Drury * Test harness for the class RegisterOfEngland1939
215df8e840SDavid Drury */
22*3e983931SGreg Roachclass RegisterOfEngland1939Test extends \PHPUnit\Framework\TestCase {
235df8e840SDavid Drury	/**
245df8e840SDavid Drury	 * Test the census place and date
255df8e840SDavid Drury	 *
2615d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\RegisterOfEngland1939
275df8e840SDavid Drury	 */
285df8e840SDavid Drury	public function testPlaceAndDate() {
295df8e840SDavid Drury		$census = new RegisterOfEngland1939;
305df8e840SDavid Drury
315df8e840SDavid Drury		$this->assertSame('England', $census->censusPlace());
325df8e840SDavid Drury		$this->assertSame('29 SEP 1939', $census->censusDate());
335df8e840SDavid Drury	}
345df8e840SDavid Drury
355df8e840SDavid Drury	/**
365df8e840SDavid Drury	 * Test the census columns
375df8e840SDavid Drury	 *
3815d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\RegisterOfEngland1939
3915d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
405df8e840SDavid Drury	 */
415df8e840SDavid Drury	public function testColumns() {
425df8e840SDavid Drury		$census  = new RegisterOfEngland1939;
435df8e840SDavid Drury		$columns = $census->columns();
445df8e840SDavid Drury
455df8e840SDavid Drury		$this->assertCount(8, $columns);
465df8e840SDavid Drury		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[0]);
475df8e840SDavid Drury		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[1]);
485df8e840SDavid Drury		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNames', $columns[2]);
495df8e840SDavid Drury		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]);
505df8e840SDavid Drury		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[4]);
515df8e840SDavid Drury		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthDayMonthSlashYear', $columns[5]);
525df8e840SDavid Drury		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionEnglish', $columns[6]);
535df8e840SDavid Drury		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[7]);
545df8e840SDavid Drury
555df8e840SDavid Drury		$this->assertSame('Schedule', $columns[0]->abbreviation());
565df8e840SDavid Drury		$this->assertSame('SubNum', $columns[1]->abbreviation());
575df8e840SDavid Drury		$this->assertSame('Name', $columns[2]->abbreviation());
585df8e840SDavid Drury		$this->assertSame('Role', $columns[3]->abbreviation());
59eb2a4ab4SDavid Drury		$this->assertSame('Sex', $columns[4]->abbreviation());
60eb2a4ab4SDavid Drury		$this->assertSame('DOB', $columns[5]->abbreviation());
61eb2a4ab4SDavid Drury		$this->assertSame('MC', $columns[6]->abbreviation());
625df8e840SDavid Drury		$this->assertSame('Occupation', $columns[7]->abbreviation());
635df8e840SDavid Drury
645df8e840SDavid Drury		$this->assertSame('Schedule Number', $columns[0]->title());
655df8e840SDavid Drury		$this->assertSame('Schedule Sub Number', $columns[1]->title());
665df8e840SDavid Drury		$this->assertSame('Surname & other names', $columns[2]->title());
67eb2a4ab4SDavid Drury		$this->assertSame('For institutions only – for example, Officer, Visitor, Servant, Patient, Inmate', $columns[3]->title());
685df8e840SDavid Drury		$this->assertSame('Male or Female', $columns[4]->title());
695df8e840SDavid Drury		$this->assertSame('Date of birth', $columns[5]->title());
70eb2a4ab4SDavid Drury		$this->assertSame('Marital Condition - Married, Single, Unmarried, Widowed or Divorced', $columns[6]->title());
715df8e840SDavid Drury		$this->assertSame('Occupation', $columns[7]->title());
725df8e840SDavid Drury	}
735df8e840SDavid Drury}
74