xref: /webtrees/tests/app/Census/CensusOfUnitedStates1940Test.php (revision 52348eb8c11b06a8488e13475e6561273832716a)
181d1be7aSGreg Roach<?php
281d1be7aSGreg Roach/**
381d1be7aSGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
581d1be7aSGreg Roach * This program is free software: you can redistribute it and/or modify
681d1be7aSGreg Roach * it under the terms of the GNU General Public License as published by
781d1be7aSGreg Roach * the Free Software Foundation, either version 3 of the License, or
881d1be7aSGreg Roach * (at your option) any later version.
981d1be7aSGreg Roach * This program is distributed in the hope that it will be useful,
1081d1be7aSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1181d1be7aSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1281d1be7aSGreg Roach * GNU General Public License for more details.
1381d1be7aSGreg Roach * You should have received a copy of the GNU General Public License
1481d1be7aSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1581d1be7aSGreg Roach */
1681d1be7aSGreg Roachnamespace Fisharebest\Webtrees\Census;
1781d1be7aSGreg Roach
1881d1be7aSGreg Roach/**
1981d1be7aSGreg Roach * Test harness for the class CensusOfUnitedStates1940
2081d1be7aSGreg Roach */
2184e2cf4eSGreg Roachclass CensusOfUnitedStates1940Test extends \Fisharebest\Webtrees\TestCase
22c1010edaSGreg Roach{
2381d1be7aSGreg Roach    /**
2481d1be7aSGreg Roach     * Test the census place and date
2581d1be7aSGreg Roach     *
2615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusOfUnitedStates1940
27*52348eb8SGreg Roach     *
28*52348eb8SGreg Roach     * @return void
2981d1be7aSGreg Roach     */
30c1010edaSGreg Roach    public function testPlaceAndDate()
31c1010edaSGreg Roach    {
3281d1be7aSGreg Roach        $census = new CensusOfUnitedStates1940;
3381d1be7aSGreg Roach
3481d1be7aSGreg Roach        $this->assertSame('United States', $census->censusPlace());
3581d1be7aSGreg Roach        $this->assertSame('APR 1940', $census->censusDate());
3681d1be7aSGreg Roach    }
3781d1be7aSGreg Roach
3881d1be7aSGreg Roach    /**
3981d1be7aSGreg Roach     * Test the census columns
4081d1be7aSGreg Roach     *
4115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusOfUnitedStates1940
4215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
43*52348eb8SGreg Roach     *
44*52348eb8SGreg Roach     * @return void
4581d1be7aSGreg Roach     */
46c1010edaSGreg Roach    public function testColumns()
47c1010edaSGreg Roach    {
4881d1be7aSGreg Roach        $census  = new CensusOfUnitedStates1940;
4981d1be7aSGreg Roach        $columns = $census->columns();
5081d1be7aSGreg Roach
5181d1be7aSGreg Roach        $this->assertCount(27, $columns);
5281d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFullName', $columns[0]);
5381d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnRelationToHead', $columns[1]);
5481d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[2]);
5581d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]);
5681d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[4]);
5781d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[5]);
5881d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[6]);
5981d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAge', $columns[7]);
6081d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionUs', $columns[8]);
6181d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAgeMarried', $columns[9]);
6281d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[10]);
6381d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[11]);
6481d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthPlaceSimple', $columns[12]);
6581d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFatherBirthPlaceSimple', $columns[13]);
6681d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnMotherBirthPlaceSimple', $columns[14]);
6781d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[15]);
6881d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[16]);
6981d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[17]);
7081d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[18]);
7181d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[19]);
7281d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[20]);
7381d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[21]);
7481d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[22]);
7581d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[23]);
7681d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[24]);
7781d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[25]);
7881d1be7aSGreg Roach        $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[26]);
7981d1be7aSGreg Roach
8081d1be7aSGreg Roach        $this->assertSame('Name', $columns[0]->abbreviation());
8181d1be7aSGreg Roach        $this->assertSame('Relation', $columns[1]->abbreviation());
8281d1be7aSGreg Roach        $this->assertSame('Home', $columns[2]->abbreviation());
8381d1be7aSGreg Roach        $this->assertSame('V/R', $columns[3]->abbreviation());
8481d1be7aSGreg Roach        $this->assertSame('Farm', $columns[4]->abbreviation());
8581d1be7aSGreg Roach        $this->assertSame('Sex', $columns[5]->abbreviation());
8681d1be7aSGreg Roach        $this->assertSame('Race', $columns[6]->abbreviation());
8781d1be7aSGreg Roach        $this->assertSame('Age', $columns[7]->abbreviation());
8881d1be7aSGreg Roach        $this->assertSame('Cond', $columns[8]->abbreviation());
8981d1be7aSGreg Roach        $this->assertSame('AM', $columns[9]->abbreviation());
9081d1be7aSGreg Roach        $this->assertSame('School', $columns[10]->abbreviation());
9181d1be7aSGreg Roach        $this->assertSame('R/W', $columns[11]->abbreviation());
9281d1be7aSGreg Roach        $this->assertSame('BP', $columns[12]->abbreviation());
9381d1be7aSGreg Roach        $this->assertSame('FBP', $columns[13]->abbreviation());
9481d1be7aSGreg Roach        $this->assertSame('MBP', $columns[14]->abbreviation());
9581d1be7aSGreg Roach        $this->assertSame('Lang', $columns[15]->abbreviation());
9681d1be7aSGreg Roach        $this->assertSame('Imm', $columns[16]->abbreviation());
9781d1be7aSGreg Roach        $this->assertSame('Nat', $columns[17]->abbreviation());
9881d1be7aSGreg Roach        $this->assertSame('Eng', $columns[18]->abbreviation());
9981d1be7aSGreg Roach        $this->assertSame('Occupation', $columns[19]->abbreviation());
10081d1be7aSGreg Roach        $this->assertSame('Industry', $columns[20]->abbreviation());
10181d1be7aSGreg Roach        $this->assertSame('Code', $columns[21]->abbreviation());
10281d1be7aSGreg Roach        $this->assertSame('Emp', $columns[22]->abbreviation());
10381d1be7aSGreg Roach        $this->assertSame('Work', $columns[23]->abbreviation());
10481d1be7aSGreg Roach        $this->assertSame('Unemp', $columns[24]->abbreviation());
10581d1be7aSGreg Roach        $this->assertSame('Vet', $columns[25]->abbreviation());
10681d1be7aSGreg Roach        $this->assertSame('War', $columns[26]->abbreviation());
10781d1be7aSGreg Roach
10881d1be7aSGreg Roach        $this->assertSame('Name', $columns[0]->title());
10981d1be7aSGreg Roach        $this->assertSame('Relationship of each person to the head of the family', $columns[1]->title());
11081d1be7aSGreg Roach        $this->assertSame('Home owned or rented', $columns[2]->title());
11181d1be7aSGreg Roach        $this->assertSame('Value of house, if owned, or monthly rental if rented', $columns[3]->title());
11281d1be7aSGreg Roach        $this->assertSame('Does this family live on a farm', $columns[4]->title());
11381d1be7aSGreg Roach        $this->assertSame('Sex', $columns[5]->title());
11481d1be7aSGreg Roach        $this->assertSame('Color or race', $columns[6]->title());
11581d1be7aSGreg Roach        $this->assertSame('Age at last birthday', $columns[7]->title());
11681d1be7aSGreg Roach        $this->assertSame('Whether single, married, widowed, or divorced', $columns[8]->title());
11781d1be7aSGreg Roach        $this->assertSame('Age at first marriage', $columns[9]->title());
11881d1be7aSGreg Roach        $this->assertSame('Attended school since Sept. 1, 1929', $columns[10]->title());
11981d1be7aSGreg Roach        $this->assertSame('Whether able to read and write', $columns[11]->title());
12081d1be7aSGreg Roach        $this->assertSame('Place of birth', $columns[12]->title());
12181d1be7aSGreg Roach        $this->assertSame('Place of birth of father', $columns[13]->title());
12281d1be7aSGreg Roach        $this->assertSame('Place of birth of mother', $columns[14]->title());
12381d1be7aSGreg Roach        $this->assertSame('Language spoken in home before coming to the United States', $columns[15]->title());
12481d1be7aSGreg Roach        $this->assertSame('Year of immigration to the United States', $columns[16]->title());
12581d1be7aSGreg Roach        $this->assertSame('Naturalization', $columns[17]->title());
12681d1be7aSGreg Roach        $this->assertSame('Whether able to speak English', $columns[18]->title());
12781d1be7aSGreg Roach        $this->assertSame('Trade, profession, or particular kind of work done', $columns[19]->title());
12881d1be7aSGreg Roach        $this->assertSame('Industry, business of establishment in which at work', $columns[20]->title());
12981d1be7aSGreg Roach        $this->assertSame('Industry code', $columns[21]->title());
13081d1be7aSGreg Roach        $this->assertSame('Class of worker', $columns[22]->title());
13181d1be7aSGreg Roach        $this->assertSame('Whether normally at work yesterday or the last regular working day', $columns[23]->title());
13281d1be7aSGreg Roach        $this->assertSame('If not, …', $columns[24]->title());
13381d1be7aSGreg Roach        $this->assertSame('Whether a veteran of U.S. military or …', $columns[25]->title());
13481d1be7aSGreg Roach        $this->assertSame('What war or …', $columns[26]->title());
13581d1be7aSGreg Roach    }
13681d1be7aSGreg Roach}
137