diff options
| author | Greg Roach <fisharebest@gmail.com> | 2016-02-05 00:03:08 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2016-02-05 00:03:08 +0000 |
| commit | 81d1be7af7bb2cdc6e1880877120cf2517064809 (patch) | |
| tree | 0f410e03dded8099de4deb49c69f253765d76f23 /tests/app/Census | |
| parent | f1c2ee3d46aeac047a9b9f0b4c7d7c154d1a01ec (diff) | |
| download | webtrees-81d1be7af7bb2cdc6e1880877120cf2517064809.tar.gz webtrees-81d1be7af7bb2cdc6e1880877120cf2517064809.tar.bz2 webtrees-81d1be7af7bb2cdc6e1880877120cf2517064809.zip | |
#810 US census
Diffstat (limited to 'tests/app/Census')
| -rw-r--r-- | tests/app/Census/CensusColumnAgeMarriedTest.php | 102 | ||||
| -rw-r--r-- | tests/app/Census/CensusColumnConditionUsTest.php | 115 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfUnitedStates1880Test.php | 16 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfUnitedStates1890Test.php | 16 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfUnitedStates1900Test.php | 14 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfUnitedStates1910Test.php | 22 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfUnitedStates1920Test.php | 20 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfUnitedStates1930Test.php | 84 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfUnitedStates1940Test.php | 130 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfUnitedStatesTest.php | 3 |
10 files changed, 429 insertions, 93 deletions
diff --git a/tests/app/Census/CensusColumnAgeMarriedTest.php b/tests/app/Census/CensusColumnAgeMarriedTest.php new file mode 100644 index 0000000000..fa659ffe36 --- /dev/null +++ b/tests/app/Census/CensusColumnAgeMarriedTest.php @@ -0,0 +1,102 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Census; + +use Fisharebest\Webtrees\Date; +use Fisharebest\Webtrees\Fact; +use Fisharebest\Webtrees\Family; +use Fisharebest\Webtrees\Individual; +use Mockery; + +/** + * Test harness for the class CensusColumnAgeMarried + */ +class CensusColumnAgeMarriedTest extends \PHPUnit_Framework_TestCase { + /** + * Delete mock objects + */ + public function tearDown() { + Mockery::close(); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnAgeMarried + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testAgeMarried() { + $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); + $fact->shouldReceive('getDate')->andReturn(new Date('01 DEC 1859')); + + $family = Mockery::mock('Fisharebest\Webtrees\Family'); + $family->shouldReceive('getFacts')->with('MARR', true)->andReturn(array($fact)); + + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getBirthDate')->andReturn(new Date('15 MAR 1840')); + $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); + + $column = new CensusColumnAgeMarried($census, '', ''); + + $this->assertSame(19, $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnAgeMarried + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoBirthDate() { + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnAgeMarried + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoMarriage() { + $family = Mockery::mock('Fisharebest\Webtrees\Family'); + $family->shouldReceive('getFacts')->with('MARR')->andReturn(array()); + + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getBirthDate')->andReturn(new Date('')); + $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); + + $column = new CensusColumnAgeMarried($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnAgeMarried + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoSpouseFamily() { + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getBirthDate')->andReturn(new Date('15 MAR 1840')); + $individual->shouldReceive('getSpouseFamilies')->andReturn(array()); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); + + $column = new CensusColumnAgeMarried($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } +} diff --git a/tests/app/Census/CensusColumnConditionUsTest.php b/tests/app/Census/CensusColumnConditionUsTest.php new file mode 100644 index 0000000000..4f880fa650 --- /dev/null +++ b/tests/app/Census/CensusColumnConditionUsTest.php @@ -0,0 +1,115 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Census; + +use Fisharebest\Webtrees\Date; +use Fisharebest\Webtrees\Fact; +use Fisharebest\Webtrees\Family; +use Fisharebest\Webtrees\Individual; +use Mockery; + +/** + * Test harness for the class CensusColumnConditionUs + */ +class CensusColumnConditionUsTest extends \PHPUnit_Framework_TestCase { + /** + * Delete mock objects + */ + public function tearDown() { + Mockery::close(); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnConditionUs + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoSpouseFamilies() { + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getSpouseFamilies')->andReturn(array()); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + + $column = new CensusColumnConditionUs($census, '', ''); + + $this->assertSame('S', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnConditionUs + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoFamilyNoFacts() { + $family = Mockery::mock('Fisharebest\Webtrees\Family'); + $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); + $family->shouldReceive('getFacts')->andReturn(array()); + + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + + $column = new CensusColumnConditionUs($census, '', ''); + $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); + + $this->assertSame('M', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnConditionUs + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoFamilyUnmarried() { + $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); + + $family = Mockery::mock('Fisharebest\Webtrees\Family'); + $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); + $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact)); + + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + + $column = new CensusColumnConditionUs($census, '', ''); + $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); + + $this->assertSame('S', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnConditionUs + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoFamilyDivorced() { + $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); + + $family = Mockery::mock('Fisharebest\Webtrees\Family'); + $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); + $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array()); + $family->shouldReceive('getFacts')->with('DIV')->andReturn(array($fact)); + + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + + $column = new CensusColumnConditionUs($census, '', ''); + $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); + + $this->assertSame('D', $column->generate($individual)); + } +} diff --git a/tests/app/Census/CensusOfUnitedStates1880Test.php b/tests/app/Census/CensusOfUnitedStates1880Test.php index 63b01546de..36c2c0f4cb 100644 --- a/tests/app/Census/CensusOfUnitedStates1880Test.php +++ b/tests/app/Census/CensusOfUnitedStates1880Test.php @@ -51,7 +51,7 @@ class CensusOfUnitedStates1880Test extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[5]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[6]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[7]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[8]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear', $columns[8]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[9]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[10]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[11]); @@ -72,12 +72,12 @@ class CensusOfUnitedStates1880Test extends \PHPUnit_Framework_TestCase { $this->assertSame('Sex', $columns[2]->abbreviation()); $this->assertSame('Mon', $columns[3]->abbreviation()); $this->assertSame('Relation', $columns[4]->abbreviation()); - $this->assertSame('Single', $columns[5]->abbreviation()); - $this->assertSame('Married', $columns[6]->abbreviation()); - $this->assertSame('Write', $columns[7]->abbreviation()); + $this->assertSame('S', $columns[5]->abbreviation()); + $this->assertSame('M', $columns[6]->abbreviation()); + $this->assertSame('W/D', $columns[7]->abbreviation()); $this->assertSame('MY', $columns[8]->abbreviation()); $this->assertSame('Occupation', $columns[9]->abbreviation()); - $this->assertSame('Un', $columns[10]->abbreviation()); + $this->assertSame('UnEm', $columns[10]->abbreviation()); $this->assertSame('Sick', $columns[11]->abbreviation()); $this->assertSame('Blind', $columns[12]->abbreviation()); $this->assertSame('DD', $columns[13]->abbreviation()); @@ -87,9 +87,9 @@ class CensusOfUnitedStates1880Test extends \PHPUnit_Framework_TestCase { $this->assertSame('School', $columns[17]->abbreviation()); $this->assertSame('Read', $columns[18]->abbreviation()); $this->assertSame('Write', $columns[19]->abbreviation()); - $this->assertSame('Birthplace', $columns[20]->abbreviation()); - $this->assertSame('Father’s birthplace', $columns[21]->abbreviation()); - $this->assertSame('Mother’s birthplace', $columns[22]->abbreviation()); + $this->assertSame('BP', $columns[20]->abbreviation()); + $this->assertSame('FBP', $columns[21]->abbreviation()); + $this->assertSame('MBP', $columns[22]->abbreviation()); $this->assertSame('Name', $columns[0]->title()); $this->assertSame('Age', $columns[1]->title()); diff --git a/tests/app/Census/CensusOfUnitedStates1890Test.php b/tests/app/Census/CensusOfUnitedStates1890Test.php index 38553fb3d4..ddde1b6554 100644 --- a/tests/app/Census/CensusOfUnitedStates1890Test.php +++ b/tests/app/Census/CensusOfUnitedStates1890Test.php @@ -50,7 +50,7 @@ class CensusOfUnitedStates1890Test extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[4]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[5]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAge', $columns[6]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[7]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionUs', $columns[7]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnMonthIfMarriedWithinYear', $columns[8]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[9]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthPlaceSimple', $columns[10]); @@ -75,20 +75,20 @@ class CensusOfUnitedStates1890Test extends \PHPUnit_Framework_TestCase { $this->assertSame('Race', $columns[4]->abbreviation()); $this->assertSame('Sex', $columns[5]->abbreviation()); $this->assertSame('Age', $columns[6]->abbreviation()); - $this->assertSame('Condition', $columns[7]->abbreviation()); + $this->assertSame('Cond', $columns[7]->abbreviation()); $this->assertSame('Mar', $columns[8]->abbreviation()); - $this->assertSame('Children', $columns[9]->abbreviation()); - $this->assertSame('Birthplace', $columns[10]->abbreviation()); - $this->assertSame('Father’s birthplace', $columns[11]->abbreviation()); - $this->assertSame('Mother’s birthplace', $columns[12]->abbreviation()); + $this->assertSame('Chil', $columns[9]->abbreviation()); + $this->assertSame('BP', $columns[10]->abbreviation()); + $this->assertSame('FBP', $columns[11]->abbreviation()); + $this->assertSame('MBP', $columns[12]->abbreviation()); $this->assertSame('US', $columns[13]->abbreviation()); $this->assertSame('Nat', $columns[14]->abbreviation()); $this->assertSame('Papers', $columns[15]->abbreviation()); $this->assertSame('Occupation', $columns[16]->abbreviation()); - $this->assertSame('Unemployed', $columns[17]->abbreviation()); + $this->assertSame('Unemp', $columns[17]->abbreviation()); $this->assertSame('Read', $columns[18]->abbreviation()); $this->assertSame('Write', $columns[19]->abbreviation()); - $this->assertSame('English', $columns[20]->abbreviation()); + $this->assertSame('Eng', $columns[20]->abbreviation()); $this->assertSame('Disease', $columns[21]->abbreviation()); $this->assertSame('Infirm', $columns[22]->abbreviation()); $this->assertSame('Prisoner', $columns[23]->abbreviation()); diff --git a/tests/app/Census/CensusOfUnitedStates1900Test.php b/tests/app/Census/CensusOfUnitedStates1900Test.php index deee747b45..1c3fa2561b 100644 --- a/tests/app/Census/CensusOfUnitedStates1900Test.php +++ b/tests/app/Census/CensusOfUnitedStates1900Test.php @@ -50,7 +50,7 @@ class CensusOfUnitedStates1900Test extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthMonth', $columns[4]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthYear', $columns[5]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAge', $columns[6]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[7]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionUs', $columns[7]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnYearsMarried', $columns[8]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnChildrenBornAlive', $columns[9]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnChildrenLiving', $columns[10]); @@ -77,22 +77,22 @@ class CensusOfUnitedStates1900Test extends \PHPUnit_Framework_TestCase { $this->assertSame('Month', $columns[4]->abbreviation()); $this->assertSame('Year', $columns[5]->abbreviation()); $this->assertSame('Age', $columns[6]->abbreviation()); - $this->assertSame('Condition', $columns[7]->abbreviation()); + $this->assertSame('Cond', $columns[7]->abbreviation()); $this->assertSame('Marr', $columns[8]->abbreviation()); $this->assertSame('Chil', $columns[9]->abbreviation()); $this->assertSame('Chil', $columns[10]->abbreviation()); - $this->assertSame('Birthplace', $columns[11]->abbreviation()); - $this->assertSame('Father’s birthplace', $columns[12]->abbreviation()); - $this->assertSame('Mother’s birthplace', $columns[13]->abbreviation()); + $this->assertSame('BP', $columns[11]->abbreviation()); + $this->assertSame('FBP', $columns[12]->abbreviation()); + $this->assertSame('MBP', $columns[13]->abbreviation()); $this->assertSame('Imm', $columns[14]->abbreviation()); $this->assertSame('US', $columns[15]->abbreviation()); $this->assertSame('Nat', $columns[16]->abbreviation()); $this->assertSame('Occupation', $columns[17]->abbreviation()); - $this->assertSame('Unemployed', $columns[18]->abbreviation()); + $this->assertSame('Unemp', $columns[18]->abbreviation()); $this->assertSame('School', $columns[19]->abbreviation()); $this->assertSame('Read', $columns[20]->abbreviation()); $this->assertSame('Write', $columns[21]->abbreviation()); - $this->assertSame('English', $columns[22]->abbreviation()); + $this->assertSame('Eng', $columns[22]->abbreviation()); $this->assertSame('Home', $columns[23]->abbreviation()); $this->assertSame('Mort', $columns[24]->abbreviation()); $this->assertSame('Farm', $columns[25]->abbreviation()); diff --git a/tests/app/Census/CensusOfUnitedStates1910Test.php b/tests/app/Census/CensusOfUnitedStates1910Test.php index 7c775f9bac..ebde8edfce 100644 --- a/tests/app/Census/CensusOfUnitedStates1910Test.php +++ b/tests/app/Census/CensusOfUnitedStates1910Test.php @@ -48,7 +48,7 @@ class CensusOfUnitedStates1910Test extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[2]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAge', $columns[4]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[5]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionUs', $columns[5]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnYearsMarried', $columns[6]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnChildrenBornAlive', $columns[7]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnChildrenLiving', $columns[8]); @@ -78,24 +78,24 @@ class CensusOfUnitedStates1910Test extends \PHPUnit_Framework_TestCase { $this->assertSame('Sex', $columns[2]->abbreviation()); $this->assertSame('Race', $columns[3]->abbreviation()); $this->assertSame('Age', $columns[4]->abbreviation()); - $this->assertSame('Condition', $columns[5]->abbreviation()); + $this->assertSame('Cond', $columns[5]->abbreviation()); $this->assertSame('Marr', $columns[6]->abbreviation()); $this->assertSame('Chil', $columns[7]->abbreviation()); $this->assertSame('Chil', $columns[8]->abbreviation()); - $this->assertSame('Birthplace', $columns[9]->abbreviation()); - $this->assertSame('Father’s birthplace', $columns[10]->abbreviation()); - $this->assertSame('Mother’s birthplace', $columns[11]->abbreviation()); + $this->assertSame('BP', $columns[9]->abbreviation()); + $this->assertSame('FBP', $columns[10]->abbreviation()); + $this->assertSame('MBP', $columns[11]->abbreviation()); $this->assertSame('Imm', $columns[12]->abbreviation()); $this->assertSame('Nat', $columns[13]->abbreviation()); - $this->assertSame('Language', $columns[14]->abbreviation()); + $this->assertSame('Lang', $columns[14]->abbreviation()); $this->assertSame('Occupation', $columns[15]->abbreviation()); $this->assertSame('Ind', $columns[16]->abbreviation()); $this->assertSame('Emp', $columns[17]->abbreviation()); - $this->assertSame('Unemployed', $columns[18]->abbreviation()); - $this->assertSame('Unemployed', $columns[19]->abbreviation()); - $this->assertSame('Read', $columns[20]->abbreviation()); - $this->assertSame('Write', $columns[21]->abbreviation()); - $this->assertSame('School', $columns[22]->abbreviation()); + $this->assertSame('Unemp', $columns[18]->abbreviation()); + $this->assertSame('Unemp', $columns[19]->abbreviation()); + $this->assertSame('R', $columns[20]->abbreviation()); + $this->assertSame('W', $columns[21]->abbreviation()); + $this->assertSame('Sch', $columns[22]->abbreviation()); $this->assertSame('Home', $columns[23]->abbreviation()); $this->assertSame('Mort', $columns[24]->abbreviation()); $this->assertSame('Farm', $columns[25]->abbreviation()); diff --git a/tests/app/Census/CensusOfUnitedStates1920Test.php b/tests/app/Census/CensusOfUnitedStates1920Test.php index 2814ac353b..67e9ecd196 100644 --- a/tests/app/Census/CensusOfUnitedStates1920Test.php +++ b/tests/app/Census/CensusOfUnitedStates1920Test.php @@ -50,7 +50,7 @@ class CensusOfUnitedStates1920Test extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[4]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[5]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAge', $columns[6]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[7]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionUs', $columns[7]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[8]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[9]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[10]); @@ -80,15 +80,15 @@ class CensusOfUnitedStates1920Test extends \PHPUnit_Framework_TestCase { $this->assertSame('Nat', $columns[9]->abbreviation()); $this->assertSame('NatY', $columns[10]->abbreviation()); $this->assertSame('School', $columns[11]->abbreviation()); - $this->assertSame('Read', $columns[12]->abbreviation()); - $this->assertSame('Write', $columns[13]->abbreviation()); - $this->assertSame('Birthplace', $columns[14]->abbreviation()); - $this->assertSame('Language', $columns[15]->abbreviation()); - $this->assertSame('Father’s birthplace', $columns[16]->abbreviation()); - $this->assertSame('Father language', $columns[17]->abbreviation()); - $this->assertSame('Mother’s birthplace', $columns[18]->abbreviation()); - $this->assertSame('Mother language', $columns[19]->abbreviation()); - $this->assertSame('English', $columns[20]->abbreviation()); + $this->assertSame('R', $columns[12]->abbreviation()); + $this->assertSame('W', $columns[13]->abbreviation()); + $this->assertSame('BP', $columns[14]->abbreviation()); + $this->assertSame('Lang', $columns[15]->abbreviation()); + $this->assertSame('FBP', $columns[16]->abbreviation()); + $this->assertSame('Father lang', $columns[17]->abbreviation()); + $this->assertSame('MBP', $columns[18]->abbreviation()); + $this->assertSame('Mother lang', $columns[19]->abbreviation()); + $this->assertSame('Eng', $columns[20]->abbreviation()); $this->assertSame('Occupation', $columns[21]->abbreviation()); $this->assertSame('Ind', $columns[22]->abbreviation()); $this->assertSame('Emp', $columns[23]->abbreviation()); diff --git a/tests/app/Census/CensusOfUnitedStates1930Test.php b/tests/app/Census/CensusOfUnitedStates1930Test.php index d315c12ef8..06926d1e3e 100644 --- a/tests/app/Census/CensusOfUnitedStates1930Test.php +++ b/tests/app/Census/CensusOfUnitedStates1930Test.php @@ -42,8 +42,8 @@ class CensusOfUnitedStates1930Test extends \PHPUnit_Framework_TestCase { $census = new CensusOfUnitedStates1930; $columns = $census->columns(); - $this->assertCount(32, $columns); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNameInitial', $columns[0]); + $this->assertCount(28, $columns); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFullName', $columns[0]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnRelationToHead', $columns[1]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[2]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]); @@ -52,8 +52,8 @@ class CensusOfUnitedStates1930Test extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[6]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[7]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAge', $columns[8]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[9]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[10]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionUs', $columns[9]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAgeMarried', $columns[10]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[11]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[12]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthPlaceSimple', $columns[13]); @@ -63,51 +63,43 @@ class CensusOfUnitedStates1930Test extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[17]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[18]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[19]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[20]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[20]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[21]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[22]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[23]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[23]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[24]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[25]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[26]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[27]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[28]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[29]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[30]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[31]); $this->assertSame('Name', $columns[0]->abbreviation()); $this->assertSame('Relation', $columns[1]->abbreviation()); $this->assertSame('Home', $columns[2]->abbreviation()); - $this->assertSame('Value/rent', $columns[3]->abbreviation()); + $this->assertSame('V/R', $columns[3]->abbreviation()); $this->assertSame('Radio', $columns[4]->abbreviation()); $this->assertSame('Farm', $columns[5]->abbreviation()); $this->assertSame('Sex', $columns[6]->abbreviation()); $this->assertSame('Race', $columns[7]->abbreviation()); $this->assertSame('Age', $columns[8]->abbreviation()); - $this->assertSame('Condition', $columns[9]->abbreviation()); - $this->assertSame('Age married', $columns[10]->abbreviation()); + $this->assertSame('Cond', $columns[9]->abbreviation()); + $this->assertSame('AM', $columns[10]->abbreviation()); $this->assertSame('School', $columns[11]->abbreviation()); - $this->assertSame('Read/write', $columns[12]->abbreviation()); - $this->assertSame('Birthplace', $columns[13]->abbreviation()); - $this->assertSame('Father’s birthplace', $columns[14]->abbreviation()); - $this->assertSame('Mother’s birthplace', $columns[15]->abbreviation()); - $this->assertSame('Language', $columns[16]->abbreviation()); - $this->assertSame('?', $columns[17]->abbreviation()); - $this->assertSame('?', $columns[18]->abbreviation()); - $this->assertSame('?', $columns[19]->abbreviation()); - $this->assertSame('Imm', $columns[20]->abbreviation()); - $this->assertSame('Nat', $columns[21]->abbreviation()); - $this->assertSame('English', $columns[22]->abbreviation()); - $this->assertSame('Occupation', $columns[23]->abbreviation()); - $this->assertSame('Industry', $columns[24]->abbreviation()); - $this->assertSame('Code', $columns[25]->abbreviation()); - $this->assertSame('Emp', $columns[26]->abbreviation()); - $this->assertSame('Work', $columns[27]->abbreviation()); - $this->assertSame('Unemp', $columns[28]->abbreviation()); - $this->assertSame('Veteran', $columns[29]->abbreviation()); - $this->assertSame('War', $columns[30]->abbreviation()); - $this->assertSame('?', $columns[31]->abbreviation()); + $this->assertSame('R/W', $columns[12]->abbreviation()); + $this->assertSame('BP', $columns[13]->abbreviation()); + $this->assertSame('FBP', $columns[14]->abbreviation()); + $this->assertSame('MBP', $columns[15]->abbreviation()); + $this->assertSame('Lang', $columns[16]->abbreviation()); + $this->assertSame('Imm', $columns[17]->abbreviation()); + $this->assertSame('Nat', $columns[18]->abbreviation()); + $this->assertSame('Eng', $columns[19]->abbreviation()); + $this->assertSame('Occupation', $columns[20]->abbreviation()); + $this->assertSame('Industry', $columns[21]->abbreviation()); + $this->assertSame('Code', $columns[22]->abbreviation()); + $this->assertSame('Emp', $columns[23]->abbreviation()); + $this->assertSame('Work', $columns[24]->abbreviation()); + $this->assertSame('Unemp', $columns[25]->abbreviation()); + $this->assertSame('Vet', $columns[26]->abbreviation()); + $this->assertSame('War', $columns[27]->abbreviation()); $this->assertSame('Name', $columns[0]->title()); $this->assertSame('Relationship of each person to the head of the family', $columns[1]->title()); @@ -126,20 +118,16 @@ class CensusOfUnitedStates1930Test extends \PHPUnit_Framework_TestCase { $this->assertSame('Place of birth of father', $columns[14]->title()); $this->assertSame('Place of birth of mother', $columns[15]->title()); $this->assertSame('Language spoken in home before coming to the United States', $columns[16]->title()); - $this->assertSame('Code', $columns[17]->title()); - $this->assertSame('Code', $columns[18]->title()); - $this->assertSame('Code', $columns[19]->title()); - $this->assertSame('Year of immigration to the United States', $columns[20]->title()); - $this->assertSame('Naturalization', $columns[21]->title()); - $this->assertSame('Whether able to speak English', $columns[22]->title()); - $this->assertSame('Trade, profession, or particular kind of work done', $columns[23]->title()); - $this->assertSame('Industry, business of establishment in which at work', $columns[24]->title()); - $this->assertSame('Industry code', $columns[25]->title()); - $this->assertSame('Class of worker', $columns[26]->title()); - $this->assertSame('Whether normally at work yesterday or the last regular working day', $columns[27]->title()); - $this->assertSame('If not, …', $columns[28]->title()); - $this->assertSame('Whether a veteran of U.S. military or …', $columns[29]->title()); - $this->assertSame('What war or …', $columns[30]->title()); - $this->assertSame('…', $columns[31]->title()); + $this->assertSame('Year of immigration to the United States', $columns[17]->title()); + $this->assertSame('Naturalization', $columns[18]->title()); + $this->assertSame('Whether able to speak English', $columns[19]->title()); + $this->assertSame('Trade, profession, or particular kind of work done', $columns[20]->title()); + $this->assertSame('Industry, business of establishment in which at work', $columns[21]->title()); + $this->assertSame('Industry code', $columns[22]->title()); + $this->assertSame('Class of worker', $columns[23]->title()); + $this->assertSame('Whether normally at work yesterday or the last regular working day', $columns[24]->title()); + $this->assertSame('If not, …', $columns[25]->title()); + $this->assertSame('Whether a veteran of U.S. military or …', $columns[26]->title()); + $this->assertSame('What war or …', $columns[27]->title()); } } diff --git a/tests/app/Census/CensusOfUnitedStates1940Test.php b/tests/app/Census/CensusOfUnitedStates1940Test.php new file mode 100644 index 0000000000..470430a21f --- /dev/null +++ b/tests/app/Census/CensusOfUnitedStates1940Test.php @@ -0,0 +1,130 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +namespace Fisharebest\Webtrees\Census; + +/** + * Test harness for the class CensusOfUnitedStates1940 + */ +class CensusOfUnitedStates1940Test extends \PHPUnit_Framework_TestCase { + /** + * Test the census place and date + * + * @covers Fisharebest\Webtrees\Census\CensusOfUnitedStates1940 + */ + public function testPlaceAndDate() { + $census = new CensusOfUnitedStates1940; + + $this->assertSame('United States', $census->censusPlace()); + $this->assertSame('APR 1940', $census->censusDate()); + } + + /** + * Test the census columns + * + * @covers Fisharebest\Webtrees\Census\CensusOfUnitedStates1940 + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testColumns() { + $census = new CensusOfUnitedStates1940; + $columns = $census->columns(); + + $this->assertCount(27, $columns); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFullName', $columns[0]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnRelationToHead', $columns[1]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[2]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[4]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[5]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[6]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAge', $columns[7]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionUs', $columns[8]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnAgeMarried', $columns[9]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[10]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[11]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthPlaceSimple', $columns[12]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFatherBirthPlaceSimple', $columns[13]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnMotherBirthPlaceSimple', $columns[14]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[15]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[16]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[17]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[18]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[19]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[20]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[21]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[22]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[23]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[24]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[25]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[26]); + + $this->assertSame('Name', $columns[0]->abbreviation()); + $this->assertSame('Relation', $columns[1]->abbreviation()); + $this->assertSame('Home', $columns[2]->abbreviation()); + $this->assertSame('V/R', $columns[3]->abbreviation()); + $this->assertSame('Farm', $columns[4]->abbreviation()); + $this->assertSame('Sex', $columns[5]->abbreviation()); + $this->assertSame('Race', $columns[6]->abbreviation()); + $this->assertSame('Age', $columns[7]->abbreviation()); + $this->assertSame('Cond', $columns[8]->abbreviation()); + $this->assertSame('AM', $columns[9]->abbreviation()); + $this->assertSame('School', $columns[10]->abbreviation()); + $this->assertSame('R/W', $columns[11]->abbreviation()); + $this->assertSame('BP', $columns[12]->abbreviation()); + $this->assertSame('FBP', $columns[13]->abbreviation()); + $this->assertSame('MBP', $columns[14]->abbreviation()); + $this->assertSame('Lang', $columns[15]->abbreviation()); + $this->assertSame('Imm', $columns[16]->abbreviation()); + $this->assertSame('Nat', $columns[17]->abbreviation()); + $this->assertSame('Eng', $columns[18]->abbreviation()); + $this->assertSame('Occupation', $columns[19]->abbreviation()); + $this->assertSame('Industry', $columns[20]->abbreviation()); + $this->assertSame('Code', $columns[21]->abbreviation()); + $this->assertSame('Emp', $columns[22]->abbreviation()); + $this->assertSame('Work', $columns[23]->abbreviation()); + $this->assertSame('Unemp', $columns[24]->abbreviation()); + $this->assertSame('Vet', $columns[25]->abbreviation()); + $this->assertSame('War', $columns[26]->abbreviation()); + + $this->assertSame('Name', $columns[0]->title()); + $this->assertSame('Relationship of each person to the head of the family', $columns[1]->title()); + $this->assertSame('Home owned or rented', $columns[2]->title()); + $this->assertSame('Value of house, if owned, or monthly rental if rented', $columns[3]->title()); + $this->assertSame('Does this family live on a farm', $columns[4]->title()); + $this->assertSame('Sex', $columns[5]->title()); + $this->assertSame('Color or race', $columns[6]->title()); + $this->assertSame('Age at last birthday', $columns[7]->title()); + $this->assertSame('Whether single, married, widowed, or divorced', $columns[8]->title()); + $this->assertSame('Age at first marriage', $columns[9]->title()); + $this->assertSame('Attended school since Sept. 1, 1929', $columns[10]->title()); + $this->assertSame('Whether able to read and write', $columns[11]->title()); + $this->assertSame('Place of birth', $columns[12]->title()); + $this->assertSame('Place of birth of father', $columns[13]->title()); + $this->assertSame('Place of birth of mother', $columns[14]->title()); + $this->assertSame('Language spoken in home before coming to the United States', $columns[15]->title()); + $this->assertSame('Year of immigration to the United States', $columns[16]->title()); + $this->assertSame('Naturalization', $columns[17]->title()); + $this->assertSame('Whether able to speak English', $columns[18]->title()); + $this->assertSame('Trade, profession, or particular kind of work done', $columns[19]->title()); + $this->assertSame('Industry, business of establishment in which at work', $columns[20]->title()); + $this->assertSame('Industry code', $columns[21]->title()); + $this->assertSame('Class of worker', $columns[22]->title()); + $this->assertSame('Whether normally at work yesterday or the last regular working day', $columns[23]->title()); + $this->assertSame('If not, …', $columns[24]->title()); + $this->assertSame('Whether a veteran of U.S. military or …', $columns[25]->title()); + $this->assertSame('What war or …', $columns[26]->title()); + } +} diff --git a/tests/app/Census/CensusOfUnitedStatesTest.php b/tests/app/Census/CensusOfUnitedStatesTest.php index 8dc5bb373f..9a0ac6b39d 100644 --- a/tests/app/Census/CensusOfUnitedStatesTest.php +++ b/tests/app/Census/CensusOfUnitedStatesTest.php @@ -41,7 +41,7 @@ class CensusOfUnitedStatesTest extends \PHPUnit_Framework_TestCase { $census_dates = $census->allCensusDates(); - $this->assertCount(9, $census_dates); + $this->assertCount(10, $census_dates); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates1850', $census_dates[0]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates1860', $census_dates[1]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates1870', $census_dates[2]); @@ -51,5 +51,6 @@ class CensusOfUnitedStatesTest extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates1910', $census_dates[6]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates1920', $census_dates[7]); $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates1930', $census_dates[8]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates1940', $census_dates[9]); } } |
