1e7625783SGreg Roach<?php 2e7625783SGreg Roach 3e7625783SGreg Roach/** 4e7625783SGreg Roach * webtrees: online genealogy 5*89f7189bSGreg Roach * Copyright (C) 2021 webtrees development team 6e7625783SGreg Roach * This program is free software: you can redistribute it and/or modify 7e7625783SGreg Roach * it under the terms of the GNU General Public License as published by 8e7625783SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9e7625783SGreg Roach * (at your option) any later version. 10e7625783SGreg Roach * This program is distributed in the hope that it will be useful, 11e7625783SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12e7625783SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13e7625783SGreg Roach * GNU General Public License for more details. 14e7625783SGreg Roach * You should have received a copy of the GNU General Public License 15*89f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16e7625783SGreg Roach */ 17e7625783SGreg Roach 18e7625783SGreg Roachdeclare(strict_types=1); 19e7625783SGreg Roach 20e7625783SGreg Roachnamespace Fisharebest\Webtrees\Census; 21e7625783SGreg Roach 22e7625783SGreg Roachuse Fisharebest\Webtrees\TestCase; 23e7625783SGreg Roach 24e7625783SGreg Roach/** 25e7625783SGreg Roach * Test harness for the class CensusOfUnitedStates1950 26e7625783SGreg Roach */ 27e7625783SGreg Roach 28e7625783SGreg Roachclass CensusOfUnitedStates1950Test extends TestCase 29e7625783SGreg Roach{ 30e7625783SGreg Roach /** 31e7625783SGreg Roach * Test the census place and date 32e7625783SGreg Roach * 33e7625783SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusOfUnitedStates1950 34e7625783SGreg Roach * 35e7625783SGreg Roach * @return void 36e7625783SGreg Roach */ 37e7625783SGreg Roach public function testPlaceAndDate(): void 38e7625783SGreg Roach { 39e7625783SGreg Roach $census = new CensusOfUnitedStates1950(); 40e7625783SGreg Roach 415e933c21SGreg Roach self::assertSame('United States', $census->censusPlace()); 425e933c21SGreg Roach self::assertSame('APR 1950', $census->censusDate()); 43e7625783SGreg Roach } 44e7625783SGreg Roach 45e7625783SGreg Roach /** 46e7625783SGreg Roach * Test the census columns 47e7625783SGreg Roach * 48e7625783SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusOfUnitedStates1950 49e7625783SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 50e7625783SGreg Roach * 51e7625783SGreg Roach * @return void 52e7625783SGreg Roach */ 53e7625783SGreg Roach public function testColumns(): void 54e7625783SGreg Roach { 55e7625783SGreg Roach $census = new CensusOfUnitedStates1950(); 56e7625783SGreg Roach $columns = $census->columns(); 57e7625783SGreg Roach 585e933c21SGreg Roach self::assertCount(21, $columns); 595e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[0]); 605e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[1]); 615e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[2]); 625e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[3]); 635e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[4]); 645e933c21SGreg Roach self::assertInstanceOf(CensusColumnFullName::class, $columns[5]); 655e933c21SGreg Roach self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[6]); 665e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[7]); 675e933c21SGreg Roach self::assertInstanceOf(CensusColumnSexMF::class, $columns[8]); 685e933c21SGreg Roach self::assertInstanceOf(CensusColumnAge::class, $columns[9]); 695e933c21SGreg Roach self::assertInstanceOf(CensusColumnConditionUs::class, $columns[10]); 705e933c21SGreg Roach self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[11]); 715e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[12]); 725e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[13]); 735e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[14]); 745e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[15]); 755e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[16]); 765e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[17]); 775e933c21SGreg Roach self::assertInstanceOf(CensusColumnOccupation::class, $columns[18]); 785e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[19]); 795e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[20]); 80e7625783SGreg Roach 815e933c21SGreg Roach self::assertSame('Street', $columns[0]->abbreviation()); 825e933c21SGreg Roach self::assertSame('Number', $columns[1]->abbreviation()); 835e933c21SGreg Roach self::assertSame('Serial', $columns[2]->abbreviation()); 845e933c21SGreg Roach self::assertSame('Farm', $columns[3]->abbreviation()); 855e933c21SGreg Roach self::assertSame('Acres', $columns[4]->abbreviation()); 865e933c21SGreg Roach self::assertSame('Name', $columns[5]->abbreviation()); 875e933c21SGreg Roach self::assertSame('Relation', $columns[6]->abbreviation()); 885e933c21SGreg Roach self::assertSame('Race', $columns[7]->abbreviation()); 895e933c21SGreg Roach self::assertSame('Sex', $columns[8]->abbreviation()); 905e933c21SGreg Roach self::assertSame('Age', $columns[9]->abbreviation()); 915e933c21SGreg Roach self::assertSame('Cond', $columns[10]->abbreviation()); 925e933c21SGreg Roach self::assertSame('BP', $columns[11]->abbreviation()); 935e933c21SGreg Roach self::assertSame('Nat', $columns[12]->abbreviation()); 945e933c21SGreg Roach self::assertSame('Type', $columns[13]->abbreviation()); 955e933c21SGreg Roach self::assertSame('AnyWork', $columns[14]->abbreviation()); 965e933c21SGreg Roach self::assertSame('Seeking', $columns[15]->abbreviation()); 975e933c21SGreg Roach self::assertSame('Employed', $columns[16]->abbreviation()); 985e933c21SGreg Roach self::assertSame('Hours', $columns[17]->abbreviation()); 995e933c21SGreg Roach self::assertSame('Occupation', $columns[18]->abbreviation()); 1005e933c21SGreg Roach self::assertSame('Industry', $columns[19]->abbreviation()); 1015e933c21SGreg Roach self::assertSame('Class', $columns[20]->abbreviation()); 102e7625783SGreg Roach 1035e933c21SGreg Roach self::assertSame('Name of street,avenue,or road', $columns[0]->title()); 1045e933c21SGreg Roach self::assertSame('House (and apartment) number', $columns[1]->title()); 1055e933c21SGreg Roach self::assertSame('Serial number of dwelling unit', $columns[2]->title()); 1065e933c21SGreg Roach self::assertSame('Is this house on a farm (or ranch)?', $columns[3]->title()); 1075e933c21SGreg Roach self::assertSame('If No in item 4-Is this house on a place of three or more acres?', $columns[4]->title()); 1085e933c21SGreg Roach self::assertSame('What is the name of the had of this household? What are the names of all other personsl who live here?', $columns[5]->title()); 1095e933c21SGreg Roach self::assertSame('Enter relationship of person to head of the household', $columns[6]->title()); 1105e933c21SGreg Roach self::assertSame('White(W) Negro(Neg) American Indian(Ind) Japanese(Jap) Chinese(Chi) Filipino(Fil) Other race-spell out', $columns[7]->title()); 1115e933c21SGreg Roach self::assertSame('Sex-Male (M),Female (F)', $columns[8]->title()); 1125e933c21SGreg Roach self::assertSame('How old was he on his last birthday?', $columns[9]->title()); 1135e933c21SGreg Roach self::assertSame('Is he now married,widowed,divorced,separated,or never married?', $columns[10]->title()); 1145e933c21SGreg Roach self::assertSame('What State (or foreign country) was he born in?', $columns[11]->title()); 1155e933c21SGreg Roach self::assertSame('If foreign born-Is he naturalized?', $columns[12]->title()); 1165e933c21SGreg Roach self::assertSame('What was this person doing most of last week-working,keeping house,or something else?', $columns[13]->title()); 1175e933c21SGreg Roach self::assertSame('If H or Ot in item 15-Did this person do any work at all last week,not counting work around the house?', $columns[14]->title()); 1185e933c21SGreg Roach self::assertSame('If No in item 16-Was this person looking for work?', $columns[15]->title()); 1195e933c21SGreg Roach self::assertSame('If No in item 17-Even though he didn’t work last week,does he have a job or business?', $columns[16]->title()); 1205e933c21SGreg Roach self::assertSame('If Wk in item 15 or Yes in item 16-How many hours did he work last week?', $columns[17]->title()); 1215e933c21SGreg Roach self::assertSame('What kind of work was he doing?', $columns[18]->title()); 1225e933c21SGreg Roach self::assertSame('What kind of business or industry was he working in?', $columns[19]->title()); 1235e933c21SGreg Roach self::assertSame('Class of worker', $columns[20]->title()); 124e7625783SGreg Roach } 125e7625783SGreg Roach} 126