1e7625783SGreg Roach<?php 2e7625783SGreg Roach 3e7625783SGreg Roach/** 4e7625783SGreg Roach * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 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 1589f7189bSGreg 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; 23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass; 24e7625783SGreg Roach 25*202c018bSGreg Roach#[CoversClass(CensusOfUnitedStates1950::class)] 26*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)] 27e7625783SGreg Roachclass CensusOfUnitedStates1950Test extends TestCase 28e7625783SGreg Roach{ 29e7625783SGreg Roach /** 30e7625783SGreg Roach * Test the census place and date 31e7625783SGreg Roach */ 32e7625783SGreg Roach public function testPlaceAndDate(): void 33e7625783SGreg Roach { 34e7625783SGreg Roach $census = new CensusOfUnitedStates1950(); 35e7625783SGreg Roach 365e933c21SGreg Roach self::assertSame('United States', $census->censusPlace()); 375e933c21SGreg Roach self::assertSame('APR 1950', $census->censusDate()); 38e7625783SGreg Roach } 39e7625783SGreg Roach 40e7625783SGreg Roach /** 41e7625783SGreg Roach * Test the census columns 42e7625783SGreg Roach */ 43e7625783SGreg Roach public function testColumns(): void 44e7625783SGreg Roach { 45e7625783SGreg Roach $census = new CensusOfUnitedStates1950(); 46e7625783SGreg Roach $columns = $census->columns(); 47e7625783SGreg Roach 485e933c21SGreg Roach self::assertCount(21, $columns); 495e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[0]); 505e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[1]); 515e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[2]); 525e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[3]); 535e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[4]); 545e933c21SGreg Roach self::assertInstanceOf(CensusColumnFullName::class, $columns[5]); 555e933c21SGreg Roach self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[6]); 565e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[7]); 575e933c21SGreg Roach self::assertInstanceOf(CensusColumnSexMF::class, $columns[8]); 585e933c21SGreg Roach self::assertInstanceOf(CensusColumnAge::class, $columns[9]); 595e933c21SGreg Roach self::assertInstanceOf(CensusColumnConditionUs::class, $columns[10]); 605e933c21SGreg Roach self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[11]); 615e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[12]); 625e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[13]); 635e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[14]); 645e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[15]); 655e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[16]); 665e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[17]); 675e933c21SGreg Roach self::assertInstanceOf(CensusColumnOccupation::class, $columns[18]); 685e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[19]); 695e933c21SGreg Roach self::assertInstanceOf(CensusColumnNull::class, $columns[20]); 70e7625783SGreg Roach 715e933c21SGreg Roach self::assertSame('Street', $columns[0]->abbreviation()); 725e933c21SGreg Roach self::assertSame('Number', $columns[1]->abbreviation()); 735e933c21SGreg Roach self::assertSame('Serial', $columns[2]->abbreviation()); 745e933c21SGreg Roach self::assertSame('Farm', $columns[3]->abbreviation()); 755e933c21SGreg Roach self::assertSame('Acres', $columns[4]->abbreviation()); 765e933c21SGreg Roach self::assertSame('Name', $columns[5]->abbreviation()); 775e933c21SGreg Roach self::assertSame('Relation', $columns[6]->abbreviation()); 785e933c21SGreg Roach self::assertSame('Race', $columns[7]->abbreviation()); 795e933c21SGreg Roach self::assertSame('Sex', $columns[8]->abbreviation()); 805e933c21SGreg Roach self::assertSame('Age', $columns[9]->abbreviation()); 815e933c21SGreg Roach self::assertSame('Cond', $columns[10]->abbreviation()); 825e933c21SGreg Roach self::assertSame('BP', $columns[11]->abbreviation()); 835e933c21SGreg Roach self::assertSame('Nat', $columns[12]->abbreviation()); 845e933c21SGreg Roach self::assertSame('Type', $columns[13]->abbreviation()); 855e933c21SGreg Roach self::assertSame('AnyWork', $columns[14]->abbreviation()); 865e933c21SGreg Roach self::assertSame('Seeking', $columns[15]->abbreviation()); 875e933c21SGreg Roach self::assertSame('Employed', $columns[16]->abbreviation()); 885e933c21SGreg Roach self::assertSame('Hours', $columns[17]->abbreviation()); 895e933c21SGreg Roach self::assertSame('Occupation', $columns[18]->abbreviation()); 905e933c21SGreg Roach self::assertSame('Industry', $columns[19]->abbreviation()); 915e933c21SGreg Roach self::assertSame('Class', $columns[20]->abbreviation()); 92e7625783SGreg Roach 935e933c21SGreg Roach self::assertSame('Name of street,avenue,or road', $columns[0]->title()); 945e933c21SGreg Roach self::assertSame('House (and apartment) number', $columns[1]->title()); 955e933c21SGreg Roach self::assertSame('Serial number of dwelling unit', $columns[2]->title()); 965e933c21SGreg Roach self::assertSame('Is this house on a farm (or ranch)?', $columns[3]->title()); 975e933c21SGreg Roach self::assertSame('If No in item 4-Is this house on a place of three or more acres?', $columns[4]->title()); 985e933c21SGreg 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()); 995e933c21SGreg Roach self::assertSame('Enter relationship of person to head of the household', $columns[6]->title()); 1005e933c21SGreg Roach self::assertSame('White(W) Negro(Neg) American Indian(Ind) Japanese(Jap) Chinese(Chi) Filipino(Fil) Other race-spell out', $columns[7]->title()); 1015e933c21SGreg Roach self::assertSame('Sex-Male (M),Female (F)', $columns[8]->title()); 1025e933c21SGreg Roach self::assertSame('How old was he on his last birthday?', $columns[9]->title()); 1035e933c21SGreg Roach self::assertSame('Is he now married,widowed,divorced,separated,or never married?', $columns[10]->title()); 1045e933c21SGreg Roach self::assertSame('What State (or foreign country) was he born in?', $columns[11]->title()); 1055e933c21SGreg Roach self::assertSame('If foreign born-Is he naturalized?', $columns[12]->title()); 1065e933c21SGreg Roach self::assertSame('What was this person doing most of last week-working,keeping house,or something else?', $columns[13]->title()); 1075e933c21SGreg 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()); 1085e933c21SGreg Roach self::assertSame('If No in item 16-Was this person looking for work?', $columns[15]->title()); 1095e933c21SGreg 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()); 1105e933c21SGreg Roach self::assertSame('If Wk in item 15 or Yes in item 16-How many hours did he work last week?', $columns[17]->title()); 1115e933c21SGreg Roach self::assertSame('What kind of work was he doing?', $columns[18]->title()); 1125e933c21SGreg Roach self::assertSame('What kind of business or industry was he working in?', $columns[19]->title()); 1135e933c21SGreg Roach self::assertSame('Class of worker', $columns[20]->title()); 114e7625783SGreg Roach } 115e7625783SGreg Roach} 116