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