xref: /webtrees/tests/app/Census/CensusOfUnitedStates1940Test.php (revision 3cfcc809af53e831fa6cafac7b274a2cb407db6e)
181d1be7aSGreg Roach<?php
23976b470SGreg Roach
381d1be7aSGreg Roach/**
481d1be7aSGreg Roach * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 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
1581d1be7aSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1681d1be7aSGreg Roach */
17e7f56f2aSGreg Roachdeclare(strict_types=1);
18e7f56f2aSGreg Roach
1981d1be7aSGreg Roachnamespace Fisharebest\Webtrees\Census;
2081d1be7aSGreg Roach
21*3cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
22*3cfcc809SGreg Roach
2381d1be7aSGreg Roach/**
2481d1be7aSGreg Roach * Test harness for the class CensusOfUnitedStates1940
2581d1be7aSGreg Roach */
26*3cfcc809SGreg Roachclass CensusOfUnitedStates1940Test extends TestCase
27c1010edaSGreg Roach{
2881d1be7aSGreg Roach    /**
2981d1be7aSGreg Roach     * Test the census place and date
3081d1be7aSGreg Roach     *
3115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusOfUnitedStates1940
3252348eb8SGreg Roach     *
3352348eb8SGreg Roach     * @return void
3481d1be7aSGreg Roach     */
359b802b22SGreg Roach    public function testPlaceAndDate(): void
36c1010edaSGreg Roach    {
3774d6dc0eSGreg Roach        $census = new CensusOfUnitedStates1940();
3881d1be7aSGreg Roach
3981d1be7aSGreg Roach        $this->assertSame('United States', $census->censusPlace());
4081d1be7aSGreg Roach        $this->assertSame('APR 1940', $census->censusDate());
4181d1be7aSGreg Roach    }
4281d1be7aSGreg Roach
4381d1be7aSGreg Roach    /**
4481d1be7aSGreg Roach     * Test the census columns
4581d1be7aSGreg Roach     *
4615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusOfUnitedStates1940
4715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4852348eb8SGreg Roach     *
4952348eb8SGreg Roach     * @return void
5081d1be7aSGreg Roach     */
519b802b22SGreg Roach    public function testColumns(): void
52c1010edaSGreg Roach    {
5374d6dc0eSGreg Roach        $census  = new CensusOfUnitedStates1940();
5481d1be7aSGreg Roach        $columns = $census->columns();
5581d1be7aSGreg Roach
5681d1be7aSGreg Roach        $this->assertCount(27, $columns);
57*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnFullName::class, $columns[0]);
58*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnRelationToHead::class, $columns[1]);
59*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[2]);
60*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[3]);
61*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[4]);
62*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnSexMF::class, $columns[5]);
63*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[6]);
64*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnAge::class, $columns[7]);
65*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnConditionUs::class, $columns[8]);
66*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnAgeMarried::class, $columns[9]);
67*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[10]);
68*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[11]);
69*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[12]);
70*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[13]);
71*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnMotherBirthPlaceSimple::class, $columns[14]);
72*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[15]);
73*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[16]);
74*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[17]);
75*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[18]);
76*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnOccupation::class, $columns[19]);
77*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[20]);
78*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[21]);
79*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[22]);
80*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[23]);
81*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[24]);
82*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[25]);
83*3cfcc809SGreg Roach        $this->assertInstanceOf(CensusColumnNull::class, $columns[26]);
8481d1be7aSGreg Roach
8581d1be7aSGreg Roach        $this->assertSame('Name', $columns[0]->abbreviation());
8681d1be7aSGreg Roach        $this->assertSame('Relation', $columns[1]->abbreviation());
8781d1be7aSGreg Roach        $this->assertSame('Home', $columns[2]->abbreviation());
8881d1be7aSGreg Roach        $this->assertSame('V/R', $columns[3]->abbreviation());
8981d1be7aSGreg Roach        $this->assertSame('Farm', $columns[4]->abbreviation());
9081d1be7aSGreg Roach        $this->assertSame('Sex', $columns[5]->abbreviation());
9181d1be7aSGreg Roach        $this->assertSame('Race', $columns[6]->abbreviation());
9281d1be7aSGreg Roach        $this->assertSame('Age', $columns[7]->abbreviation());
9381d1be7aSGreg Roach        $this->assertSame('Cond', $columns[8]->abbreviation());
9481d1be7aSGreg Roach        $this->assertSame('AM', $columns[9]->abbreviation());
9581d1be7aSGreg Roach        $this->assertSame('School', $columns[10]->abbreviation());
9681d1be7aSGreg Roach        $this->assertSame('R/W', $columns[11]->abbreviation());
9781d1be7aSGreg Roach        $this->assertSame('BP', $columns[12]->abbreviation());
9881d1be7aSGreg Roach        $this->assertSame('FBP', $columns[13]->abbreviation());
9981d1be7aSGreg Roach        $this->assertSame('MBP', $columns[14]->abbreviation());
10081d1be7aSGreg Roach        $this->assertSame('Lang', $columns[15]->abbreviation());
10181d1be7aSGreg Roach        $this->assertSame('Imm', $columns[16]->abbreviation());
10281d1be7aSGreg Roach        $this->assertSame('Nat', $columns[17]->abbreviation());
10381d1be7aSGreg Roach        $this->assertSame('Eng', $columns[18]->abbreviation());
10481d1be7aSGreg Roach        $this->assertSame('Occupation', $columns[19]->abbreviation());
10581d1be7aSGreg Roach        $this->assertSame('Industry', $columns[20]->abbreviation());
10681d1be7aSGreg Roach        $this->assertSame('Code', $columns[21]->abbreviation());
10781d1be7aSGreg Roach        $this->assertSame('Emp', $columns[22]->abbreviation());
10881d1be7aSGreg Roach        $this->assertSame('Work', $columns[23]->abbreviation());
10981d1be7aSGreg Roach        $this->assertSame('Unemp', $columns[24]->abbreviation());
11081d1be7aSGreg Roach        $this->assertSame('Vet', $columns[25]->abbreviation());
11181d1be7aSGreg Roach        $this->assertSame('War', $columns[26]->abbreviation());
11281d1be7aSGreg Roach
11381d1be7aSGreg Roach        $this->assertSame('Name', $columns[0]->title());
11481d1be7aSGreg Roach        $this->assertSame('Relationship of each person to the head of the family', $columns[1]->title());
11581d1be7aSGreg Roach        $this->assertSame('Home owned or rented', $columns[2]->title());
11681d1be7aSGreg Roach        $this->assertSame('Value of house, if owned, or monthly rental if rented', $columns[3]->title());
11781d1be7aSGreg Roach        $this->assertSame('Does this family live on a farm', $columns[4]->title());
11881d1be7aSGreg Roach        $this->assertSame('Sex', $columns[5]->title());
11981d1be7aSGreg Roach        $this->assertSame('Color or race', $columns[6]->title());
12081d1be7aSGreg Roach        $this->assertSame('Age at last birthday', $columns[7]->title());
12181d1be7aSGreg Roach        $this->assertSame('Whether single, married, widowed, or divorced', $columns[8]->title());
12281d1be7aSGreg Roach        $this->assertSame('Age at first marriage', $columns[9]->title());
12381d1be7aSGreg Roach        $this->assertSame('Attended school since Sept. 1, 1929', $columns[10]->title());
12481d1be7aSGreg Roach        $this->assertSame('Whether able to read and write', $columns[11]->title());
12581d1be7aSGreg Roach        $this->assertSame('Place of birth', $columns[12]->title());
12681d1be7aSGreg Roach        $this->assertSame('Place of birth of father', $columns[13]->title());
12781d1be7aSGreg Roach        $this->assertSame('Place of birth of mother', $columns[14]->title());
12881d1be7aSGreg Roach        $this->assertSame('Language spoken in home before coming to the United States', $columns[15]->title());
12981d1be7aSGreg Roach        $this->assertSame('Year of immigration to the United States', $columns[16]->title());
13081d1be7aSGreg Roach        $this->assertSame('Naturalization', $columns[17]->title());
13181d1be7aSGreg Roach        $this->assertSame('Whether able to speak English', $columns[18]->title());
13281d1be7aSGreg Roach        $this->assertSame('Trade, profession, or particular kind of work done', $columns[19]->title());
13381d1be7aSGreg Roach        $this->assertSame('Industry, business of establishment in which at work', $columns[20]->title());
13481d1be7aSGreg Roach        $this->assertSame('Industry code', $columns[21]->title());
13581d1be7aSGreg Roach        $this->assertSame('Class of worker', $columns[22]->title());
13681d1be7aSGreg Roach        $this->assertSame('Whether normally at work yesterday or the last regular working day', $columns[23]->title());
13781d1be7aSGreg Roach        $this->assertSame('If not, …', $columns[24]->title());
13881d1be7aSGreg Roach        $this->assertSame('Whether a veteran of U.S. military or …', $columns[25]->title());
13981d1be7aSGreg Roach        $this->assertSame('What war or …', $columns[26]->title());
14081d1be7aSGreg Roach    }
14181d1be7aSGreg Roach}
142