xref: /webtrees/tests/app/Census/CensusOfUnitedStates1940Test.php (revision 5a8afed46297e8105e3e5a33ce37e6a8e88bc79d)
181d1be7aSGreg Roach<?php
23976b470SGreg Roach
381d1be7aSGreg Roach/**
481d1be7aSGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 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
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
1681d1be7aSGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2081d1be7aSGreg Roachnamespace Fisharebest\Webtrees\Census;
2181d1be7aSGreg Roach
223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
23*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
243cfcc809SGreg Roach
25*202c018bSGreg Roach#[CoversClass(CensusOfUnitedStates1940::class)]
26*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)]
273cfcc809SGreg Roachclass CensusOfUnitedStates1940Test extends TestCase
28c1010edaSGreg Roach{
2981d1be7aSGreg Roach    /**
3081d1be7aSGreg Roach     * Test the census place and date
3181d1be7aSGreg Roach     */
329b802b22SGreg Roach    public function testPlaceAndDate(): void
33c1010edaSGreg Roach    {
3474d6dc0eSGreg Roach        $census = new CensusOfUnitedStates1940();
3581d1be7aSGreg Roach
365e933c21SGreg Roach        self::assertSame('United States', $census->censusPlace());
375e933c21SGreg Roach        self::assertSame('APR 1940', $census->censusDate());
3881d1be7aSGreg Roach    }
3981d1be7aSGreg Roach
4081d1be7aSGreg Roach    /**
4181d1be7aSGreg Roach     * Test the census columns
4281d1be7aSGreg Roach     */
439b802b22SGreg Roach    public function testColumns(): void
44c1010edaSGreg Roach    {
4574d6dc0eSGreg Roach        $census  = new CensusOfUnitedStates1940();
4681d1be7aSGreg Roach        $columns = $census->columns();
4781d1be7aSGreg Roach
485e933c21SGreg Roach        self::assertCount(31, $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(CensusColumnSexMF::class, $columns[7]);
575e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[8]);
585e933c21SGreg Roach        self::assertInstanceOf(CensusColumnAge::class, $columns[9]);
595e933c21SGreg Roach        self::assertInstanceOf(CensusColumnConditionUs::class, $columns[10]);
605e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[11]);
615e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[12]);
625e933c21SGreg Roach        self::assertInstanceOf(CensusColumnBirthPlaceSimple::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(CensusColumnNull::class, $columns[18]);
685e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[19]);
695e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[20]);
705e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[21]);
715e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[22]);
725e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[23]);
735e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[24]);
745e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[25]);
755e933c21SGreg Roach        self::assertInstanceOf(CensusColumnOccupation::class, $columns[26]);
765e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[27]);
775e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[28]);
785e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[29]);
795e933c21SGreg Roach        self::assertInstanceOf(CensusColumnNull::class, $columns[30]);
8081d1be7aSGreg Roach
815e933c21SGreg Roach        self::assertSame('Street', $columns[0]->abbreviation());
825e933c21SGreg Roach        self::assertSame('Number', $columns[1]->abbreviation());
835e933c21SGreg Roach        self::assertSame('Home', $columns[2]->abbreviation());
845e933c21SGreg Roach        self::assertSame('Value', $columns[3]->abbreviation());
855e933c21SGreg Roach        self::assertSame('Farm', $columns[4]->abbreviation());
865e933c21SGreg Roach        self::assertSame('Name', $columns[5]->abbreviation());
875e933c21SGreg Roach        self::assertSame('Relation', $columns[6]->abbreviation());
885e933c21SGreg Roach        self::assertSame('Sex', $columns[7]->abbreviation());
895e933c21SGreg Roach        self::assertSame('Race', $columns[8]->abbreviation());
905e933c21SGreg Roach        self::assertSame('Age', $columns[9]->abbreviation());
915e933c21SGreg Roach        self::assertSame('Cond', $columns[10]->abbreviation());
925e933c21SGreg Roach        self::assertSame('School', $columns[11]->abbreviation());
935e933c21SGreg Roach        self::assertSame('Grade', $columns[12]->abbreviation());
945e933c21SGreg Roach        self::assertSame('BP', $columns[13]->abbreviation());
955e933c21SGreg Roach        self::assertSame('Citizen', $columns[14]->abbreviation());
965e933c21SGreg Roach        self::assertSame('City', $columns[15]->abbreviation());
975e933c21SGreg Roach        self::assertSame('County', $columns[16]->abbreviation());
985e933c21SGreg Roach        self::assertSame('State', $columns[17]->abbreviation());
995e933c21SGreg Roach        self::assertSame('OnFarm', $columns[18]->abbreviation());
1005e933c21SGreg Roach        self::assertSame('Work', $columns[19]->abbreviation());
1015e933c21SGreg Roach        self::assertSame('Emerg', $columns[20]->abbreviation());
1025e933c21SGreg Roach        self::assertSame('Seeking', $columns[21]->abbreviation());
1035e933c21SGreg Roach        self::assertSame('Job', $columns[22]->abbreviation());
1045e933c21SGreg Roach        self::assertSame('Type', $columns[23]->abbreviation());
1055e933c21SGreg Roach        self::assertSame('Hours', $columns[24]->abbreviation());
1065e933c21SGreg Roach        self::assertSame('Unemp', $columns[25]->abbreviation());
1075e933c21SGreg Roach        self::assertSame('Occupation', $columns[26]->abbreviation());
1085e933c21SGreg Roach        self::assertSame('Industry', $columns[27]->abbreviation());
1095e933c21SGreg Roach        self::assertSame('Weeks', $columns[28]->abbreviation());
1105e933c21SGreg Roach        self::assertSame('Salary', $columns[29]->abbreviation());
1115e933c21SGreg Roach        self::assertSame('Extra', $columns[30]->abbreviation());
11281d1be7aSGreg Roach
1135e933c21SGreg Roach        self::assertSame('Street,avenue,road,etc', $columns[0]->title());
1145e933c21SGreg Roach        self::assertSame('House number (in cities and towns)', $columns[1]->title());
1155e933c21SGreg Roach        self::assertSame('Home owned (O) or rented (R)', $columns[2]->title());
1165e933c21SGreg Roach        self::assertSame('Value of home, if owned, or monthly rental if rented', $columns[3]->title());
1175e933c21SGreg Roach        self::assertSame('Does this household live on a farm?', $columns[4]->title());
1185e933c21SGreg Roach        self::assertSame('Name of each person whose usual place of residence on April 1, 1940, was in this household', $columns[5]->title());
1195e933c21SGreg Roach        self::assertSame('Relationship of this person to the head of the household', $columns[6]->title());
1205e933c21SGreg Roach        self::assertSame('Sex-Male (M),Female (F)', $columns[7]->title());
1215e933c21SGreg Roach        self::assertSame('Color or race', $columns[8]->title());
1225e933c21SGreg Roach        self::assertSame('Age at last birthday', $columns[9]->title());
1235e933c21SGreg Roach        self::assertSame('Marital Status-Single (S), Married (M), Widowed (W), Divorced (D)', $columns[10]->title());
1245e933c21SGreg Roach        self::assertSame('Attended school or college any time since March 1, 1940?', $columns[11]->title());
1255e933c21SGreg Roach        self::assertSame('Highest grade of school completed', $columns[12]->title());
1265e933c21SGreg Roach        self::assertSame('Place of birth', $columns[13]->title());
1275e933c21SGreg Roach        self::assertSame('Citizenship of the foreign born', $columns[14]->title());
1285e933c21SGreg Roach        self::assertSame('City, town, or village having 2,500 or more inhabitants. Enter "R" for all other places.', $columns[15]->title());
1295e933c21SGreg Roach        self::assertSame('County', $columns[16]->title());
1305e933c21SGreg Roach        self::assertSame('State (or Territory or foreign country)', $columns[17]->title());
1315e933c21SGreg Roach        self::assertSame('On a farm?', $columns[18]->title());
1325e933c21SGreg Roach        self::assertSame('Was this person AT WORK for pay or profit in private or nonemergency Govt. work during week of March 24-30?', $columns[19]->title());
1335e933c21SGreg Roach        self::assertSame('If not, was he at work on, or assigned to, public EMERGENCY WORK (WPA,NYA,CCC,etc.) during week of March 24-30?', $columns[20]->title());
1345e933c21SGreg Roach        self::assertSame('Was this person SEEKING WORK?', $columns[21]->title());
1355e933c21SGreg Roach        self::assertSame('If not seeking work, did he HAVE A JOB, business, etc.?', $columns[22]->title());
1365e933c21SGreg Roach        self::assertSame('Indicate whether engaged in home housework (H), in school (S), unable to work (U), or other (Ot)', $columns[23]->title());
1375e933c21SGreg Roach        self::assertSame('Numbers of hours worked during week of March 24-30, 1940', $columns[24]->title());
1385e933c21SGreg Roach        self::assertSame('Duration of unemployment up to March 30, 1940-in weeks', $columns[25]->title());
1395e933c21SGreg Roach        self::assertSame('Trade, profession, or particular kind of work', $columns[26]->title());
1405e933c21SGreg Roach        self::assertSame('Industry or business', $columns[27]->title());
1415e933c21SGreg Roach        self::assertSame('Number of weeks worked in 1939 (Equivalent full-time weeks)', $columns[28]->title());
1425e933c21SGreg Roach        self::assertSame('Amount of money wages or salary received (including commissions)', $columns[29]->title());
1435e933c21SGreg Roach        self::assertSame('Did this person receive income of $50 or more from sources other than money wages or salary?', $columns[30]->title());
14481d1be7aSGreg Roach    }
14581d1be7aSGreg Roach}
146