xref: /webtrees/tests/app/Census/CensusOfUnitedStates1940Test.php (revision 15d603e7c7c15d20f055d3d9c38d6b133453c5be)
181d1be7aSGreg Roach<?php
281d1be7aSGreg Roach
381d1be7aSGreg Roach/**
481d1be7aSGreg Roach * webtrees: online genealogy
56bdf7674SGreg Roach * Copyright (C) 2017 webtrees development team
681d1be7aSGreg Roach * This program is free software: you can redistribute it and/or modify
781d1be7aSGreg Roach * it under the terms of the GNU General Public License as published by
881d1be7aSGreg Roach * the Free Software Foundation, either version 3 of the License, or
981d1be7aSGreg Roach * (at your option) any later version.
1081d1be7aSGreg Roach * This program is distributed in the hope that it will be useful,
1181d1be7aSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1281d1be7aSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1381d1be7aSGreg Roach * GNU General Public License for more details.
1481d1be7aSGreg Roach * You should have received a copy of the GNU General Public License
1581d1be7aSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1681d1be7aSGreg Roach */
1781d1be7aSGreg Roachnamespace Fisharebest\Webtrees\Census;
1881d1be7aSGreg Roach
1981d1be7aSGreg Roach/**
2081d1be7aSGreg Roach * Test harness for the class CensusOfUnitedStates1940
2181d1be7aSGreg Roach */
2281d1be7aSGreg Roachclass CensusOfUnitedStates1940Test extends \PHPUnit_Framework_TestCase {
2381d1be7aSGreg Roach	/**
2481d1be7aSGreg Roach	 * Test the census place and date
2581d1be7aSGreg Roach	 *
26*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\CensusOfUnitedStates1940
2781d1be7aSGreg Roach	 */
2881d1be7aSGreg Roach	public function testPlaceAndDate() {
2981d1be7aSGreg Roach		$census = new CensusOfUnitedStates1940;
3081d1be7aSGreg Roach
3181d1be7aSGreg Roach		$this->assertSame('United States', $census->censusPlace());
3281d1be7aSGreg Roach		$this->assertSame('APR 1940', $census->censusDate());
3381d1be7aSGreg Roach	}
3481d1be7aSGreg Roach
3581d1be7aSGreg Roach	/**
3681d1be7aSGreg Roach	 * Test the census columns
3781d1be7aSGreg Roach	 *
38*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\CensusOfUnitedStates1940
39*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4081d1be7aSGreg Roach	 */
4181d1be7aSGreg Roach	public function testColumns() {
4281d1be7aSGreg Roach		$census  = new CensusOfUnitedStates1940;
4381d1be7aSGreg Roach		$columns = $census->columns();
4481d1be7aSGreg Roach
4581d1be7aSGreg Roach		$this->assertCount(27, $columns);
4681d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFullName', $columns[0]);
4781d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnRelationToHead', $columns[1]);
4881d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[2]);
4981d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]);
5081d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[4]);
5181d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[5]);
5281d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[6]);
5381d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAge', $columns[7]);
5481d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionUs', $columns[8]);
5581d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAgeMarried', $columns[9]);
5681d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[10]);
5781d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[11]);
5881d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthPlaceSimple', $columns[12]);
5981d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFatherBirthPlaceSimple', $columns[13]);
6081d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnMotherBirthPlaceSimple', $columns[14]);
6181d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[15]);
6281d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[16]);
6381d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[17]);
6481d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[18]);
6581d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[19]);
6681d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[20]);
6781d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[21]);
6881d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[22]);
6981d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[23]);
7081d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[24]);
7181d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[25]);
7281d1be7aSGreg Roach		$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[26]);
7381d1be7aSGreg Roach
7481d1be7aSGreg Roach		$this->assertSame('Name', $columns[0]->abbreviation());
7581d1be7aSGreg Roach		$this->assertSame('Relation', $columns[1]->abbreviation());
7681d1be7aSGreg Roach		$this->assertSame('Home', $columns[2]->abbreviation());
7781d1be7aSGreg Roach		$this->assertSame('V/R', $columns[3]->abbreviation());
7881d1be7aSGreg Roach		$this->assertSame('Farm', $columns[4]->abbreviation());
7981d1be7aSGreg Roach		$this->assertSame('Sex', $columns[5]->abbreviation());
8081d1be7aSGreg Roach		$this->assertSame('Race', $columns[6]->abbreviation());
8181d1be7aSGreg Roach		$this->assertSame('Age', $columns[7]->abbreviation());
8281d1be7aSGreg Roach		$this->assertSame('Cond', $columns[8]->abbreviation());
8381d1be7aSGreg Roach		$this->assertSame('AM', $columns[9]->abbreviation());
8481d1be7aSGreg Roach		$this->assertSame('School', $columns[10]->abbreviation());
8581d1be7aSGreg Roach		$this->assertSame('R/W', $columns[11]->abbreviation());
8681d1be7aSGreg Roach		$this->assertSame('BP', $columns[12]->abbreviation());
8781d1be7aSGreg Roach		$this->assertSame('FBP', $columns[13]->abbreviation());
8881d1be7aSGreg Roach		$this->assertSame('MBP', $columns[14]->abbreviation());
8981d1be7aSGreg Roach		$this->assertSame('Lang', $columns[15]->abbreviation());
9081d1be7aSGreg Roach		$this->assertSame('Imm', $columns[16]->abbreviation());
9181d1be7aSGreg Roach		$this->assertSame('Nat', $columns[17]->abbreviation());
9281d1be7aSGreg Roach		$this->assertSame('Eng', $columns[18]->abbreviation());
9381d1be7aSGreg Roach		$this->assertSame('Occupation', $columns[19]->abbreviation());
9481d1be7aSGreg Roach		$this->assertSame('Industry', $columns[20]->abbreviation());
9581d1be7aSGreg Roach		$this->assertSame('Code', $columns[21]->abbreviation());
9681d1be7aSGreg Roach		$this->assertSame('Emp', $columns[22]->abbreviation());
9781d1be7aSGreg Roach		$this->assertSame('Work', $columns[23]->abbreviation());
9881d1be7aSGreg Roach		$this->assertSame('Unemp', $columns[24]->abbreviation());
9981d1be7aSGreg Roach		$this->assertSame('Vet', $columns[25]->abbreviation());
10081d1be7aSGreg Roach		$this->assertSame('War', $columns[26]->abbreviation());
10181d1be7aSGreg Roach
10281d1be7aSGreg Roach		$this->assertSame('Name', $columns[0]->title());
10381d1be7aSGreg Roach		$this->assertSame('Relationship of each person to the head of the family', $columns[1]->title());
10481d1be7aSGreg Roach		$this->assertSame('Home owned or rented', $columns[2]->title());
10581d1be7aSGreg Roach		$this->assertSame('Value of house, if owned, or monthly rental if rented', $columns[3]->title());
10681d1be7aSGreg Roach		$this->assertSame('Does this family live on a farm', $columns[4]->title());
10781d1be7aSGreg Roach		$this->assertSame('Sex', $columns[5]->title());
10881d1be7aSGreg Roach		$this->assertSame('Color or race', $columns[6]->title());
10981d1be7aSGreg Roach		$this->assertSame('Age at last birthday', $columns[7]->title());
11081d1be7aSGreg Roach		$this->assertSame('Whether single, married, widowed, or divorced', $columns[8]->title());
11181d1be7aSGreg Roach		$this->assertSame('Age at first marriage', $columns[9]->title());
11281d1be7aSGreg Roach		$this->assertSame('Attended school since Sept. 1, 1929', $columns[10]->title());
11381d1be7aSGreg Roach		$this->assertSame('Whether able to read and write', $columns[11]->title());
11481d1be7aSGreg Roach		$this->assertSame('Place of birth', $columns[12]->title());
11581d1be7aSGreg Roach		$this->assertSame('Place of birth of father', $columns[13]->title());
11681d1be7aSGreg Roach		$this->assertSame('Place of birth of mother', $columns[14]->title());
11781d1be7aSGreg Roach		$this->assertSame('Language spoken in home before coming to the United States', $columns[15]->title());
11881d1be7aSGreg Roach		$this->assertSame('Year of immigration to the United States', $columns[16]->title());
11981d1be7aSGreg Roach		$this->assertSame('Naturalization', $columns[17]->title());
12081d1be7aSGreg Roach		$this->assertSame('Whether able to speak English', $columns[18]->title());
12181d1be7aSGreg Roach		$this->assertSame('Trade, profession, or particular kind of work done', $columns[19]->title());
12281d1be7aSGreg Roach		$this->assertSame('Industry, business of establishment in which at work', $columns[20]->title());
12381d1be7aSGreg Roach		$this->assertSame('Industry code', $columns[21]->title());
12481d1be7aSGreg Roach		$this->assertSame('Class of worker', $columns[22]->title());
12581d1be7aSGreg Roach		$this->assertSame('Whether normally at work yesterday or the last regular working day', $columns[23]->title());
12681d1be7aSGreg Roach		$this->assertSame('If not, …', $columns[24]->title());
12781d1be7aSGreg Roach		$this->assertSame('Whether a veteran of U.S. military or …', $columns[25]->title());
12881d1be7aSGreg Roach		$this->assertSame('What war or …', $columns[26]->title());
12981d1be7aSGreg Roach	}
13081d1be7aSGreg Roach}
131