1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2015 webtrees development team 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18namespace Fisharebest\Webtrees\Census; 19 20/** 21 * Test harness for the class CensusOfUnitedStates1930 22 */ 23class CensusOfUnitedStates1930Test extends \PHPUnit_Framework_TestCase { 24 /** 25 * Test the census place and date 26 * 27 * @covers Fisharebest\Webtrees\Census\CensusOfUnitedStates1930 28 */ 29 public function testPlaceAndDate() { 30 $census = new CensusOfUnitedStates1930; 31 32 $this->assertSame('United States', $census->censusPlace()); 33 $this->assertSame('APR 1930', $census->censusDate()); 34 } 35 36 /** 37 * Test the census columns 38 * 39 * @covers Fisharebest\Webtrees\Census\CensusOfUnitedStates1930 40 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 41 */ 42 public function testColumns() { 43 $census = new CensusOfUnitedStates1930; 44 $columns = $census->columns(); 45 46 $this->assertCount(32, $columns); 47 $this->assertInstanceOf(CensusColumnSurnameGivenNameInitial::class, $columns[0]); 48 $this->assertInstanceOf(CensusColumnRelationToHead::class, $columns[1]); 49 $this->assertInstanceOf(CensusColumnNull::class, $columns[2]); 50 $this->assertInstanceOf(CensusColumnNull::class, $columns[3]); 51 $this->assertInstanceOf(CensusColumnNull::class, $columns[4]); 52 $this->assertInstanceOf(CensusColumnNull::class, $columns[5]); 53 $this->assertInstanceOf(CensusColumnSexMF::class, $columns[6]); 54 $this->assertInstanceOf(CensusColumnNull::class, $columns[7]); 55 $this->assertInstanceOf(CensusColumnAge::class, $columns[8]); 56 $this->assertInstanceOf(CensusColumnNull::class, $columns[9]); 57 $this->assertInstanceOf(CensusColumnNull::class, $columns[10]); 58 $this->assertInstanceOf(CensusColumnNull::class, $columns[11]); 59 $this->assertInstanceOf(CensusColumnNull::class, $columns[12]); 60 $this->assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[13]); 61 $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[14]); 62 $this->assertInstanceOf(CensusColumnMotherBirthPlaceSimple::class, $columns[15]); 63 $this->assertInstanceOf(CensusColumnNull::class, $columns[16]); 64 $this->assertInstanceOf(CensusColumnNull::class, $columns[17]); 65 $this->assertInstanceOf(CensusColumnNull::class, $columns[18]); 66 $this->assertInstanceOf(CensusColumnNull::class, $columns[19]); 67 $this->assertInstanceOf(CensusColumnNull::class, $columns[20]); 68 $this->assertInstanceOf(CensusColumnNull::class, $columns[21]); 69 $this->assertInstanceOf(CensusColumnNull::class, $columns[22]); 70 $this->assertInstanceOf(CensusColumnOccupation::class, $columns[23]); 71 $this->assertInstanceOf(CensusColumnNull::class, $columns[24]); 72 $this->assertInstanceOf(CensusColumnNull::class, $columns[25]); 73 $this->assertInstanceOf(CensusColumnNull::class, $columns[26]); 74 $this->assertInstanceOf(CensusColumnNull::class, $columns[27]); 75 $this->assertInstanceOf(CensusColumnNull::class, $columns[28]); 76 $this->assertInstanceOf(CensusColumnNull::class, $columns[29]); 77 $this->assertInstanceOf(CensusColumnNull::class, $columns[30]); 78 $this->assertInstanceOf(CensusColumnNull::class, $columns[31]); 79 80 $this->assertSame('Name', $columns[0]->abbreviation()); 81 $this->assertSame('Relation', $columns[1]->abbreviation()); 82 $this->assertSame('Home', $columns[2]->abbreviation()); 83 $this->assertSame('Value/rent', $columns[3]->abbreviation()); 84 $this->assertSame('Radio', $columns[4]->abbreviation()); 85 $this->assertSame('Farm', $columns[5]->abbreviation()); 86 $this->assertSame('Sex', $columns[6]->abbreviation()); 87 $this->assertSame('Race', $columns[7]->abbreviation()); 88 $this->assertSame('Age', $columns[8]->abbreviation()); 89 $this->assertSame('Condition', $columns[9]->abbreviation()); 90 $this->assertSame('Age married', $columns[10]->abbreviation()); 91 $this->assertSame('School', $columns[11]->abbreviation()); 92 $this->assertSame('Read/write', $columns[12]->abbreviation()); 93 $this->assertSame('Birthplace', $columns[13]->abbreviation()); 94 $this->assertSame('Father’s birthplace', $columns[14]->abbreviation()); 95 $this->assertSame('Mother’s birthplace', $columns[15]->abbreviation()); 96 $this->assertSame('Language', $columns[16]->abbreviation()); 97 $this->assertSame('?', $columns[17]->abbreviation()); 98 $this->assertSame('?', $columns[18]->abbreviation()); 99 $this->assertSame('?', $columns[19]->abbreviation()); 100 $this->assertSame('Imm', $columns[20]->abbreviation()); 101 $this->assertSame('Nat', $columns[21]->abbreviation()); 102 $this->assertSame('English', $columns[22]->abbreviation()); 103 $this->assertSame('Occupation', $columns[23]->abbreviation()); 104 $this->assertSame('Industry', $columns[24]->abbreviation()); 105 $this->assertSame('Code', $columns[25]->abbreviation()); 106 $this->assertSame('Emp', $columns[26]->abbreviation()); 107 $this->assertSame('Work', $columns[27]->abbreviation()); 108 $this->assertSame('Unemp', $columns[28]->abbreviation()); 109 $this->assertSame('Veteran', $columns[29]->abbreviation()); 110 $this->assertSame('War', $columns[30]->abbreviation()); 111 $this->assertSame('?', $columns[31]->abbreviation()); 112 113 $this->assertSame('Name', $columns[0]->title()); 114 $this->assertSame('Relationship of each person to the head of the family', $columns[1]->title()); 115 $this->assertSame('Home owned or rented', $columns[2]->title()); 116 $this->assertSame('Value of house, if owned, or monthly rental if rented', $columns[3]->title()); 117 $this->assertSame('Radio set', $columns[4]->title()); 118 $this->assertSame('Does this family live on a farm', $columns[5]->title()); 119 $this->assertSame('Sex', $columns[6]->title()); 120 $this->assertSame('Color or race', $columns[7]->title()); 121 $this->assertSame('Age at last birthday', $columns[8]->title()); 122 $this->assertSame('Whether single, married, widowed, or divorced', $columns[9]->title()); 123 $this->assertSame('Age at first marriage', $columns[10]->title()); 124 $this->assertSame('Attended school since Sept. 1, 1929', $columns[11]->title()); 125 $this->assertSame('Whether able to read and write', $columns[12]->title()); 126 $this->assertSame('Place of birth', $columns[13]->title()); 127 $this->assertSame('Place of birth of father', $columns[14]->title()); 128 $this->assertSame('Place of birth of mother', $columns[15]->title()); 129 $this->assertSame('Language spoken in home before coming to the United States', $columns[16]->title()); 130 $this->assertSame('Code', $columns[17]->title()); 131 $this->assertSame('Code', $columns[18]->title()); 132 $this->assertSame('Code', $columns[19]->title()); 133 $this->assertSame('Year of immigration to the United States', $columns[20]->title()); 134 $this->assertSame('Naturalization', $columns[21]->title()); 135 $this->assertSame('Whether able to speak English', $columns[22]->title()); 136 $this->assertSame('Trade, profession, or particular kind of work done', $columns[23]->title()); 137 $this->assertSame('Industry, business of establishment in which at work', $columns[24]->title()); 138 $this->assertSame('Industry code', $columns[25]->title()); 139 $this->assertSame('Class of worker', $columns[26]->title()); 140 $this->assertSame('Whether normally at work yesterday or the last regular working day', $columns[27]->title()); 141 $this->assertSame('If not, …', $columns[28]->title()); 142 $this->assertSame('Whether a veteran of U.S. military or …', $columns[29]->title()); 143 $this->assertSame('What war or …', $columns[30]->title()); 144 $this->assertSame('…', $columns[31]->title()); 145 } 146} 147