diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-10-29 13:27:40 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-10-29 17:34:39 +0000 |
| commit | f3fa6d90bdc7225bdbe6300f0588c5935d1cc217 (patch) | |
| tree | 7f2428fee6b7c0d0e765d3f0815ac04d0881ddf7 | |
| parent | 0b18a98d2ceaeebc288d72a27a147055f7d6115d (diff) | |
| download | webtrees-f3fa6d90bdc7225bdbe6300f0588c5935d1cc217.tar.gz webtrees-f3fa6d90bdc7225bdbe6300f0588c5935d1cc217.tar.bz2 webtrees-f3fa6d90bdc7225bdbe6300f0588c5935d1cc217.zip | |
US Census
35 files changed, 997 insertions, 140 deletions
diff --git a/app/Census/CensusColumnBirthDate.php b/app/Census/CensusColumnBirthDate.php index ba5f07665f..6a773717fb 100644 --- a/app/Census/CensusColumnBirthDate.php +++ b/app/Census/CensusColumnBirthDate.php @@ -31,6 +31,6 @@ class CensusColumnBirthDate extends AbstractCensusColumn implements CensusColumn * @return string */ public function generate(Individual $individual, Individual $head = null) { - return $individual->getEstimatedBirthDate()->display(false, null, false); + return $individual->getEstimatedBirthDate()->minimumDate()->format('%j %n %Y'); } } diff --git a/app/Census/CensusColumnBirthMonth.php b/app/Census/CensusColumnBirthMonth.php new file mode 100644 index 0000000000..333dac29fa --- /dev/null +++ b/app/Census/CensusColumnBirthMonth.php @@ -0,0 +1,36 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2015 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\Individual; + +/** + * The individual's date of birth. + */ +class CensusColumnBirthMonth extends AbstractCensusColumn implements CensusColumnInterface { + /** + * Generate the likely value of this census column, based on available information. + * + * @param Individual $individual + * @param Individual|null $head + * + * @return string + */ + public function generate(Individual $individual, Individual $head = null) { + return $individual->getEstimatedBirthDate()->minimumDate()->format('%M'); + } +} diff --git a/app/Census/CensusOfUnitedStates1940.php b/app/Census/CensusColumnBirthYear.php index a6a259590b..dbee84762a 100644 --- a/app/Census/CensusOfUnitedStates1940.php +++ b/app/Census/CensusColumnBirthYear.php @@ -15,27 +15,22 @@ */ namespace Fisharebest\Webtrees\Census; +use Fisharebest\Webtrees\Date; +use Fisharebest\Webtrees\Individual; + /** - * Definitions for a census + * The individual's date of birth. */ -class CensusOfUnitedStates1940 extends CensusOfUnitedStates implements CensusInterface { +class CensusColumnBirthYear extends AbstractCensusColumn implements CensusColumnInterface { /** - * When did this census occur. + * Generate the likely value of this census column, based on available information. * - * @return string - */ - public function censusDate() { - return '01 APR 1940'; - } - - /** - * The columns of the census. + * @param Individual $individual + * @param Individual|null $head * - * @return CensusColumnInterface[] + * @return string */ - public function columns() { - return array( - new CensusColumnNull($this, 'XXXX', 'XXXX'), - ); + public function generate(Individual $individual, Individual $head = null) { + return $individual->getEstimatedBirthDate()->minimumDate()->format('%M'); } } diff --git a/app/Census/CensusColumnGivenNameInitial.php b/app/Census/CensusColumnGivenNameInitial.php new file mode 100644 index 0000000000..d2ede8bd2a --- /dev/null +++ b/app/Census/CensusColumnGivenNameInitial.php @@ -0,0 +1,44 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2015 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\Individual; + +/** + * The individual's full name. + */ +class CensusColumnGivenNameInitial extends AbstractCensusColumn implements CensusColumnInterface { + /** + * Generate the likely value of this census column, based on available information. + * + * @param Individual $individual + * @param Individual|null $head + * + * @return string + */ + public function generate(Individual $individual, Individual $head = null) { + foreach ($individual->getAllNames() as $name) { + $given = $name['givn']; + if (strpos($given, ' ') === false) { + return $given; + } else { + return substr($given, 0, strpos($given, ' ') + 2); + } + } + + return ''; + } +} diff --git a/app/Census/CensusColumnSurnameGivenNameInitial.php b/app/Census/CensusColumnSurnameGivenNameInitial.php new file mode 100644 index 0000000000..942be6893a --- /dev/null +++ b/app/Census/CensusColumnSurnameGivenNameInitial.php @@ -0,0 +1,44 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2015 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\Individual; + +/** + * The individual's full name. + */ +class CensusColumnSurnameGivenNameInitial extends AbstractCensusColumn implements CensusColumnInterface { + /** + * Generate the likely value of this census column, based on available information. + * + * @param Individual $individual + * @param Individual|null $head + * + * @return string + */ + public function generate(Individual $individual, Individual $head = null) { + foreach ($individual->getAllNames() as $name) { + $given = $name['givn']; + if (strpos($given, ' ') === false) { + return $name['surn'] . ', ' . $given; + } else { + return $name['surn'] . ', ' . substr($given, 0, strpos($given, ' ') + 2); + } + } + + return ''; + } +} diff --git a/app/Census/CensusOfScotland1861.php b/app/Census/CensusOfScotland1861.php index 8af866a3be..03dde33e0e 100644 --- a/app/Census/CensusOfScotland1861.php +++ b/app/Census/CensusOfScotland1861.php @@ -43,7 +43,7 @@ class CensusOfScotland1861 extends CensusOfScotland implements CensusInterface { new CensusColumnOccupation($this, 'Occupation', 'Rank, profession or occupation'), new CensusColumnBirthPlace($this, 'Birthplace', 'Where born'), new CensusColumnNull($this, 'Infirm', 'Whether blind or deaf-and-dumb'), - new CensusColumnNull($this, 'Sch', 'Number of children between 5 and 13 attending school'), + new CensusColumnNull($this, 'School', 'Number of children between 5 and 13 attending school'), ); } } diff --git a/app/Census/CensusOfScotland1871.php b/app/Census/CensusOfScotland1871.php index 542207ec55..1ced48c593 100644 --- a/app/Census/CensusOfScotland1871.php +++ b/app/Census/CensusOfScotland1871.php @@ -43,7 +43,7 @@ class CensusOfScotland1871 extends CensusOfScotland implements CensusInterface { new CensusColumnOccupation($this, 'Occupation', 'Rank, profession or occupation'), new CensusColumnBirthPlace($this, 'Birthplace', 'Where born'), new CensusColumnNull($this, 'Infirm', 'Whether deaf-and-dumb, blind, imbecile, idiot or lunatic'), - new CensusColumnNull($this, 'Sch', 'Number of children between 5 and 13 attending school or educated at home'), + new CensusColumnNull($this, 'School', 'Number of children between 5 and 13 attending school or educated at home'), ); } } diff --git a/app/Census/CensusOfUnitedStates.php b/app/Census/CensusOfUnitedStates.php index dddc2edd42..8508161f48 100644 --- a/app/Census/CensusOfUnitedStates.php +++ b/app/Census/CensusOfUnitedStates.php @@ -35,7 +35,6 @@ class CensusOfUnitedStates extends Census implements CensusPlaceInterface { new CensusOfUnitedStates1910(), new CensusOfUnitedStates1920(), new CensusOfUnitedStates1930(), - new CensusOfUnitedStates1940(), ); } diff --git a/app/Census/CensusOfUnitedStates1850.php b/app/Census/CensusOfUnitedStates1850.php index 0e860e6d57..a51ee5ecec 100644 --- a/app/Census/CensusOfUnitedStates1850.php +++ b/app/Census/CensusOfUnitedStates1850.php @@ -43,7 +43,7 @@ class CensusOfUnitedStates1850 extends CensusOfUnitedStates implements CensusInt new CensusColumnNull($this, 'RE', 'Value of real estate owned'), new CensusColumnBirthPlaceSimple($this, 'Birthplace', 'Place of birth, naming the state, territory, or country'), new CensusColumnMarriedWithinYear($this, 'Mar', 'Married within the year'), - new CensusColumnNull($this, 'Sch', 'Attended school within the year'), + new CensusColumnNull($this, 'School', 'Attended school within the year'), new CensusColumnNull($this, 'R+W', 'Persons over 20 years of age who cannot read and write'), new CensusColumnNull($this, 'Infirm', 'Whether deaf and dumb, blind, insane, idiotic, pauper or convict'), ); diff --git a/app/Census/CensusOfUnitedStates1860.php b/app/Census/CensusOfUnitedStates1860.php index 403495bbd9..8457c16d78 100644 --- a/app/Census/CensusOfUnitedStates1860.php +++ b/app/Census/CensusOfUnitedStates1860.php @@ -44,7 +44,7 @@ class CensusOfUnitedStates1860 extends CensusOfUnitedStates implements CensusInt new CensusColumnNull($this, 'PE', 'Value of personal estate owned'), new CensusColumnBirthPlaceSimple($this, 'Birthplace', 'Place of birth, naming the state, territory, or country'), new CensusColumnMarriedWithinYear($this, 'Mar', 'Married within the year'), - new CensusColumnNull($this, 'Sch', 'Attended school within the year'), + new CensusColumnNull($this, 'School', 'Attended school within the year'), new CensusColumnNull($this, 'R+W', 'Persons over 20 years of age who cannot read and write'), new CensusColumnNull($this, 'Infirm', 'Whether deaf and dumb, blind, insane, idiotic, pauper or convict'), ); diff --git a/app/Census/CensusOfUnitedStates1870.php b/app/Census/CensusOfUnitedStates1870.php index dfe1df29fe..366e1f9b9c 100644 --- a/app/Census/CensusOfUnitedStates1870.php +++ b/app/Census/CensusOfUnitedStates1870.php @@ -47,9 +47,9 @@ class CensusOfUnitedStates1870 extends CensusOfUnitedStates implements CensusInt new CensusColumnMotherForeign($this, 'MFB', 'Mother of foreign birth'), new CensusColumnMonthIfBornWithinYear($this, 'Born', 'If born within the year, state month'), new CensusColumnMonthIfMarriedWithinYear($this, 'Mar', 'If married within the year, state month'), - new CensusColumnNull($this, 'Sch', 'Attended school within the year'), - new CensusColumnNull($this, 'R', 'Cannot read'), - new CensusColumnNull($this, 'W', 'Cannot write'), + new CensusColumnNull($this, 'School', 'Attended school within the year'), + new CensusColumnNull($this, 'Read', 'Cannot read'), + new CensusColumnNull($this, 'Write', 'Cannot write'), new CensusColumnNull($this, 'Infirm', 'Whether deaf and dumb, blind, insane, or idiotic'), new CensusColumnNull($this, 'Cit', 'Male citizen of US'), new CensusColumnNull($this, 'Dis', 'Male citizen of US, where right to vote is denied or abridged'), diff --git a/app/Census/CensusOfUnitedStates1880.php b/app/Census/CensusOfUnitedStates1880.php index acdb055399..059e55acd4 100644 --- a/app/Census/CensusOfUnitedStates1880.php +++ b/app/Census/CensusOfUnitedStates1880.php @@ -40,24 +40,24 @@ class CensusOfUnitedStates1880 extends CensusOfUnitedStates implements CensusInt new CensusColumnSexMF($this, 'Sex', 'Sex'), new CensusColumnMonthIfBornWithinYear($this, 'Mon', 'If born within the year, state month'), new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of household'), - new CensusColumnNull($this, 'S', 'Single'), - new CensusColumnNull($this, 'M', 'Married'), - new CensusColumnNull($this, 'W', 'Widowed, Divorced'), + new CensusColumnNull($this, 'Single', 'Single'), + new CensusColumnNull($this, 'Married', 'Married'), + new CensusColumnNull($this, 'Write', 'Widowed, Divorced'), new CensusColumnNull($this, 'MY', 'Married during census year'), new CensusColumnOccupation($this, 'Occupation', 'Profession, occupation, or trade'), new CensusColumnNull($this, 'Un', 'Number of months the person has been unemployed during the census year'), new CensusColumnNull($this, 'Sick', 'Sickness or disability'), - new CensusColumnNull($this, 'Bl', 'Blind'), + new CensusColumnNull($this, 'Blind', 'Blind'), new CensusColumnNull($this, 'DD', 'Deaf and dumb'), - new CensusColumnNull($this, 'Id', 'Idiotic'), - new CensusColumnNull($this, 'In', 'Insane'), - new CensusColumnNull($this, 'Dis', 'Maimed, crippled, bedridden or otherwise disabled'), - new CensusColumnNull($this, 'Sch', 'Attended school within the census year'), - new CensusColumnNull($this, 'R', 'Cannot read'), - new CensusColumnNull($this, 'W', 'Cannot write'), - new CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth, naming the state, territory, or country'), - new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father, naming the state, territory, or country'), - new CensusColumnMotherBirthPlaceSimple($this, 'MBP', 'Place of birth of mother, naming the state, territory, or country'), + new CensusColumnNull($this, 'Idiotic', 'Idiotic'), + new CensusColumnNull($this, 'Insane', 'Insane'), + new CensusColumnNull($this, 'Disabled', 'Maimed, crippled, bedridden or otherwise disabled'), + new CensusColumnNull($this, 'School', 'Attended school within the census year'), + new CensusColumnNull($this, 'Read', 'Cannot read'), + new CensusColumnNull($this, 'Write', 'Cannot write'), + new CensusColumnBirthPlaceSimple($this, 'Birthplace', 'Place of birth, naming the state, territory, or country'), + new CensusColumnFatherBirthPlaceSimple($this, 'Father’s birthplace', 'Place of birth of father, naming the state, territory, or country'), + new CensusColumnMotherBirthPlaceSimple($this, 'Mother’s birthplace', 'Place of birth of mother, naming the state, territory, or country'), ); } } diff --git a/app/Census/CensusOfUnitedStates1890.php b/app/Census/CensusOfUnitedStates1890.php index 532d1f1fee..27eca4dcb7 100644 --- a/app/Census/CensusOfUnitedStates1890.php +++ b/app/Census/CensusOfUnitedStates1890.php @@ -35,7 +35,30 @@ class CensusOfUnitedStates1890 extends CensusOfUnitedStates implements CensusInt */ public function columns() { return array( - new CensusColumnNull($this, 'XXXX', 'XXXX'), + new CensusColumnGivenNameInitial($this, 'Name', 'Christian name in full, and initial of middle name'), + new CensusColumnSurname($this, 'Surname', 'Surname'), + new CensusColumnNull($this, 'CW', 'Whether a soldier, sailor or marine during the civil war (U.S. or Conf.), or widow of such person'), + new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of family'), + new CensusColumnNull($this, 'Race', 'Whether white, black, mulatto, quadroon, octoroon, Chinese, Japanese, or Indian'), + new CensusColumnSexMF($this, 'Sex', 'Sex'), + new CensusColumnAge($this, 'Age', 'Age at nearest birthday. If under one year, give age in months'), + new CensusColumnNull($this, 'Condition', 'Whether single, married, widowed, or divorced'), + new CensusColumnMonthIfMarriedWithinYear($this, 'Mar', 'Whether married duirng the census year (June 1, 1889, to May 31, 1890)'), + new CensusColumnNull($this, 'Children', 'Mother of how many children, and number of these children living'), + new CensusColumnBirthPlaceSimple($this, 'Birthplace', 'Place of birth'), + new CensusColumnFatherBirthPlaceSimple($this, 'Father’s birthplace', 'Place of birth of father'), + new CensusColumnFatherBirthPlaceSimple($this, 'Mother’s birthplace', 'Place of birth of mother'), + new CensusColumnNull($this, 'US', 'Number of years in the United States'), + new CensusColumnNull($this, 'Nat', 'Whether naturalized'), + new CensusColumnNull($this, 'Papers', 'Whether naturalization papers have been taken out'), + new CensusColumnOccupation($this, 'Occupation', 'Profession, trade, occupation'), + new CensusColumnNull($this, 'Unemployed', 'Months unemployed during the census year (June 1, 1889, to May 31, 1890)'), + new CensusColumnNull($this, 'Read', 'Able to read'), + new CensusColumnNull($this, 'Write', 'Able to write'), + new CensusColumnNull($this, 'English', 'Able to speak English. If not the language or dialect spoken'), + new CensusColumnNull($this, 'Disease', 'Whether suffering from acute or chronic disease, with name of disease and length of time afflicted'), + new CensusColumnNull($this, 'Infirm', 'Whether defective in mind, sight, hearing, or speech, or whether crippled, maimed, or deformed, with name of defect'), + new CensusColumnNull($this, 'Prisoner', 'Whether a prisoner, convict, homeless child, or pauper'), ); } } diff --git a/app/Census/CensusOfUnitedStates1900.php b/app/Census/CensusOfUnitedStates1900.php index beef1e841e..ee8a43ca9d 100644 --- a/app/Census/CensusOfUnitedStates1900.php +++ b/app/Census/CensusOfUnitedStates1900.php @@ -35,7 +35,32 @@ class CensusOfUnitedStates1900 extends CensusOfUnitedStates implements CensusInt */ public function columns() { return array( - new CensusColumnNull($this, 'XXXX', 'XXXX'), + new CensusColumnFullName($this, 'Name', 'Name'), + new CensusColumnRelationToHead($this, 'Relation', 'Relationship of each person to the head of the family'), + new CensusColumnNull($this, 'Race', 'Color or race'), + new CensusColumnSexMF($this, 'Sex', 'Sex'), + new CensusColumnBirthMonth($this, 'Month', 'Month of birth'), + new CensusColumnBirthYear($this, 'Year', 'Year of birth'), + new CensusColumnAge($this, 'Age', 'Age at last birthday'), + new CensusColumnNull($this, 'Condition', 'Whether single, married, widowed, or divorced'), + new CensusColumnYearsMarried($this, 'Marr', 'Number of years married'), + new CensusColumnChildrenBornAlive($this, 'Chil', 'Mother of how many children'), + new CensusColumnChildrenLiving($this, 'Chil', 'Number of these children living'), + new CensusColumnBirthPlaceSimple($this, 'Birthplace', 'Place of birth of this person'), + new CensusColumnFatherBirthPlaceSimple($this, 'Father’s birthplace', 'Place of birth of father of this person'), + new CensusColumnFatherBirthPlaceSimple($this, 'Mother’s birthplace', 'Place of birth of mother of this person'), + new CensusColumnNull($this, 'Imm', 'Year of immigration to the United States'), + new CensusColumnNull($this, 'US', 'Number of years in the United States'), + new CensusColumnNull($this, 'Nat', 'Naturalization'), + new CensusColumnOccupation($this, 'Occupation', 'Occupation, trade of profession'), + new CensusColumnNull($this, 'Unemployed', 'Months not unemployed'), + new CensusColumnNull($this, 'School', 'Attended school (in months)'), + new CensusColumnNull($this, 'Read', 'Can read'), + new CensusColumnNull($this, 'Write', 'Can write'), + new CensusColumnNull($this, 'English', 'Can speak English'), + new CensusColumnNull($this, 'Home', 'Owned or rented'), + new CensusColumnNull($this, 'Mort', 'Owned free or mortgaged'), + new CensusColumnNull($this, 'Farm', 'Farm or house'), ); } } diff --git a/app/Census/CensusOfUnitedStates1910.php b/app/Census/CensusOfUnitedStates1910.php index 4a1d100f31..beffa944a9 100644 --- a/app/Census/CensusOfUnitedStates1910.php +++ b/app/Census/CensusOfUnitedStates1910.php @@ -35,7 +35,35 @@ class CensusOfUnitedStates1910 extends CensusOfUnitedStates implements CensusInt */ public function columns() { return array( - new CensusColumnNull($this, 'XXXX', 'XXXX'), + new CensusColumnSurnameGivenNameInitial($this, 'Name', 'Name'), + new CensusColumnRelationToHead($this, 'Relation', 'Relationship of each person to the head of the family'), + new CensusColumnSexMF($this, 'Sex', 'Sex'), + new CensusColumnNull($this, 'Race', 'Color or race'), + new CensusColumnAge($this, 'Age', 'Age at last birthday'), + new CensusColumnNull($this, 'Condition', 'Whether single, married, widowed, or divorced'), + new CensusColumnYearsMarried($this, 'Marr', 'Number of years of present marriage'), + new CensusColumnChildrenBornAlive($this, 'Chil', 'Mother of how many children'), + new CensusColumnChildrenLiving($this, 'Chil', 'Number of these children living'), + new CensusColumnBirthPlaceSimple($this, 'Birthplace', 'Place of birth of this person'), + new CensusColumnFatherBirthPlaceSimple($this, 'Father’s birthplace', 'Place of birth of father of this person'), + new CensusColumnFatherBirthPlaceSimple($this, 'Mother’s birthplace', 'Place of birth of mother of this person'), + new CensusColumnNull($this, 'Imm', 'Year of immigration to the United States'), + new CensusColumnNull($this, 'Nat', 'Whether naturalized or alien'), + new CensusColumnNull($this, 'Language', 'Whether able to speak English, of if not, give language spoken'), + new CensusColumnOccupation($this, 'Occupation', 'Trade or profession of, or particular kind of work done by this person'), + new CensusColumnNull($this, 'Ind', 'General nature of industry'), + new CensusColumnNull($this, 'Emp', 'Whether an employer, employee, or work on own account'), + new CensusColumnNull($this, 'Unemployed', 'Whether out of work on April 15, 1910'), + new CensusColumnNull($this, 'Unemployed', 'Number of weeks out of work in 1909'), + new CensusColumnNull($this, 'Read', 'Whether able to read'), + new CensusColumnNull($this, 'Write', 'Whether able to write'), + new CensusColumnNull($this, 'School', 'Attended school since September 1, 1909'), + new CensusColumnNull($this, 'Home', 'Owned or rented'), + new CensusColumnNull($this, 'Mort', 'Owned free or mortgaged'), + new CensusColumnNull($this, 'Farm', 'Farm or house'), + new CensusColumnNull($this, 'CW', 'Whether a survivor of the Union or Confederate Army or Navy'), + new CensusColumnNull($this, 'Blind', 'Whether blind (both eyes)'), + new CensusColumnNull($this, 'Deaf', 'Whether deaf and dumb'), ); } } diff --git a/app/Census/CensusOfUnitedStates1920.php b/app/Census/CensusOfUnitedStates1920.php index 45e3750743..de3fd47df7 100644 --- a/app/Census/CensusOfUnitedStates1920.php +++ b/app/Census/CensusOfUnitedStates1920.php @@ -35,7 +35,30 @@ class CensusOfUnitedStates1920 extends CensusOfUnitedStates implements CensusInt */ public function columns() { return array( - new CensusColumnNull($this, 'XXXX', 'XXXX'), + new CensusColumnSurnameGivenNameInitial($this, 'Name', 'Name'), + new CensusColumnRelationToHead($this, 'Relation', 'Relationship of each person to the head of the family'), + new CensusColumnNull($this, 'Home', 'Owned or rented'), + new CensusColumnNull($this, 'Mort', 'If owned, free or mortgaged'), + new CensusColumnSexMF($this, 'Sex', 'Sex'), + new CensusColumnNull($this, 'Race', 'Color or race'), + new CensusColumnAge($this, 'Age', 'Age at last birthday'), + new CensusColumnNull($this, 'Condition', 'Whether single, married, widowed, or divorced'), + new CensusColumnNull($this, 'Imm', 'Year of immigration to the United States'), + new CensusColumnNull($this, 'Nat', 'Naturalized or alien'), + new CensusColumnNull($this, 'NatY', 'If naturalized, year of naturalization'), + new CensusColumnNull($this, 'School', 'Attended school since Sept. 1, 1919'), + new CensusColumnNull($this, 'Read', 'Whether able to read'), + new CensusColumnNull($this, 'Write', 'Whether able to write'), + new CensusColumnBirthPlaceSimple($this, 'Birthplace', 'Place of birth'), + new CensusColumnNull($this, 'Language', 'Mother tongue'), + new CensusColumnFatherBirthPlaceSimple($this, 'Father’s birthplace', 'Place of birth of father'), + new CensusColumnNull($this, 'Father language', 'Mother tongue of father'), + new CensusColumnFatherBirthPlaceSimple($this, 'Mother’s birthplace', 'Place of birth of mother'), + new CensusColumnNull($this, 'Mother language', 'Mother tongue of mother'), + new CensusColumnNull($this, 'English', 'Whether able to speak English'), + new CensusColumnOccupation($this, 'Occupation', 'Trade, profession, or particular kind of work done'), + new CensusColumnNull($this, 'Ind', 'Industry, business of establishment in which at work'), + new CensusColumnNull($this, 'Emp', 'Employer, salary or wage worker, or work on own account'), ); } } diff --git a/app/Census/CensusOfUnitedStates1930.php b/app/Census/CensusOfUnitedStates1930.php index b1467e2938..09bc4f61e1 100644 --- a/app/Census/CensusOfUnitedStates1930.php +++ b/app/Census/CensusOfUnitedStates1930.php @@ -35,7 +35,38 @@ class CensusOfUnitedStates1930 extends CensusOfUnitedStates implements CensusInt */ public function columns() { return array( - new CensusColumnNull($this, 'XXXX', 'XXXX'), + new CensusColumnSurnameGivenNameInitial($this, 'Name', 'Name'), + new CensusColumnRelationToHead($this, 'Relation', 'Relationship of each person to the head of the family'), + new CensusColumnNull($this, 'Home', 'Home owned or rented'), + new CensusColumnNull($this, 'Value/rent', 'Value of house, if owned, or monthly rental if rented'), + new CensusColumnNull($this, 'Radio', 'Radio set'), + new CensusColumnNull($this, 'Farm', 'Does this family live on a farm'), + new CensusColumnSexMF($this, 'Sex', 'Sex'), + new CensusColumnNull($this, 'Race', 'Color or race'), + new CensusColumnAge($this, 'Age', 'Age at last birthday'), + new CensusColumnNull($this, 'Condition', 'Whether single, married, widowed, or divorced'), + new CensusColumnNull($this, 'Age married', 'Age at first marriage'), + new CensusColumnNull($this, 'School', 'Attended school since Sept. 1, 1929'), + new CensusColumnNull($this, 'Read/write', 'Whether able to read and write'), + new CensusColumnBirthPlaceSimple($this, 'Birthplace', 'Place of birth'), + new CensusColumnFatherBirthPlaceSimple($this, 'Father’s birthplace', 'Place of birth of father'), + new CensusColumnMotherBirthPlaceSimple($this, 'Mother’s birthplace', 'Place of birth of mother'), + new CensusColumnNull($this, 'Language', 'Language spoken in home before coming to the United States'), + new CensusColumnNull($this, '?', 'Code'), + new CensusColumnNull($this, '?', 'Code'), + new CensusColumnNull($this, '?', 'Code'), + new CensusColumnNull($this, 'Imm', 'Year of immigration to the United States'), + new CensusColumnNull($this, 'Nat', 'Naturalization'), + new CensusColumnNull($this, 'English', 'Whether able to speak English'), + new CensusColumnOccupation($this, 'Occupation', 'Trade, profession, or particular kind of work done'), + new CensusColumnNull($this, 'Industry', 'Industry, business of establishment in which at work'), + new CensusColumnNull($this, 'Code', 'Industry code'), + new CensusColumnNull($this, 'Emp', 'Class of worker'), + new CensusColumnNull($this, 'Work', 'Whether normally at work yesterday or the last regular working day'), + new CensusColumnNull($this, 'Unemp', 'If not, …'), + new CensusColumnNull($this, 'Veteran', 'Whether a veteran of U.S. military or …'), + new CensusColumnNull($this, 'War', 'What war or …'), + new CensusColumnNull($this, '?', '…'), ); } } diff --git a/tests/app/Census/CensusColumnBirthDateTest.php b/tests/app/Census/CensusColumnBirthDateTest.php index 7b58581241..15392ee914 100644 --- a/tests/app/Census/CensusColumnBirthDateTest.php +++ b/tests/app/Census/CensusColumnBirthDateTest.php @@ -37,8 +37,11 @@ class CensusColumnBirthDateTest extends \PHPUnit_Framework_TestCase { * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testGenerateColumn() { + $cal_date = Mockery::mock(Date\CalendarDate::class); + $cal_date->shouldReceive('format')->andReturn('1 1 1800'); + $date = Mockery::mock(Date::class); - $date->shouldReceive('display')->andReturn('1 January 1800'); + $date->shouldReceive('minimumDate')->andReturn($cal_date); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getEstimatedBirthDate')->andReturn($date); @@ -48,6 +51,6 @@ class CensusColumnBirthDateTest extends \PHPUnit_Framework_TestCase { $column = new CensusColumnBirthDate($census, '', ''); - $this->assertSame('1 January 1800', $column->generate($individual)); + $this->assertSame('1 1 1800', $column->generate($individual)); } } diff --git a/tests/app/Census/CensusColumnBirthMonthTest.php b/tests/app/Census/CensusColumnBirthMonthTest.php new file mode 100644 index 0000000000..75aed25829 --- /dev/null +++ b/tests/app/Census/CensusColumnBirthMonthTest.php @@ -0,0 +1,56 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2015 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\Individual; +use Mockery; + +/** + * Test harness for the class CensusColumnAge + */ +class CensusColumnBirthMonthTest extends \PHPUnit_Framework_TestCase { + /** + * Delete mock objects + */ + public function tearDown() { + Mockery::close(); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnBirthMonth + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testGenerateColumn() { + $cal_date = Mockery::mock(Date\CalendarDate::class); + $cal_date->shouldReceive('format')->andReturn('Jan'); + + $date = Mockery::mock(Date::class); + $date->shouldReceive('minimumDate')->andReturn($cal_date); + + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getEstimatedBirthDate')->andReturn($date); + + $census = Mockery::mock(CensusInterface::class); + $census->shouldReceive('censusDate')->andReturn('30 JUN 1832'); + + $column = new CensusColumnBirthMonth($census, '', ''); + + $this->assertSame('Jan', $column->generate($individual)); + } +} diff --git a/tests/app/Census/CensusColumnBirthYearTest.php b/tests/app/Census/CensusColumnBirthYearTest.php new file mode 100644 index 0000000000..0847f764c4 --- /dev/null +++ b/tests/app/Census/CensusColumnBirthYearTest.php @@ -0,0 +1,56 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2015 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\Individual; +use Mockery; + +/** + * Test harness for the class CensusColumnAge + */ +class CensusColumnBirthYearTest extends \PHPUnit_Framework_TestCase { + /** + * Delete mock objects + */ + public function tearDown() { + Mockery::close(); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnBirthYear + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testGenerateColumn() { + $cal_date = Mockery::mock(Date\CalendarDate::class); + $cal_date->shouldReceive('format')->andReturn('1800'); + + $date = Mockery::mock(Date::class); + $date->shouldReceive('minimumDate')->andReturn($cal_date); + + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getEstimatedBirthDate')->andReturn($date); + + $census = Mockery::mock(CensusInterface::class); + $census->shouldReceive('censusDate')->andReturn('30 JUN 1832'); + + $column = new CensusColumnBirthYear($census, '', ''); + + $this->assertSame('1800', $column->generate($individual)); + } +} diff --git a/tests/app/Census/CensusColumnGivenNameInitialTest.php b/tests/app/Census/CensusColumnGivenNameInitialTest.php new file mode 100644 index 0000000000..5bc14de2dc --- /dev/null +++ b/tests/app/Census/CensusColumnGivenNameInitialTest.php @@ -0,0 +1,79 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2015 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\Individual; +use Mockery; + +/** + * Test harness for the class CensusColumnGivenNameInitial + */ +class CensusColumnGivenNameInitialTest extends \PHPUnit_Framework_TestCase { + /** + * Delete mock objects + */ + public function tearDown() { + Mockery::close(); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnGivenNameInitial + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testOneGivenName() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getAllNames')->andReturn([['givn' => 'Joe']]); + + $census = Mockery::mock(CensusInterface::class); + + $column = new CensusColumnGivenNameInitial($census, '', ''); + + $this->assertSame('Joe', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnGivenNameInitial + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testMultipleGivenNames() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getAllNames')->andReturn([['givn' => 'Joe Fred']]); + + $census = Mockery::mock(CensusInterface::class); + + $column = new CensusColumnGivenNameInitial($census, '', ''); + + $this->assertSame('Joe F', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnGivenNameInitial + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoName() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getAllNames')->andReturn([]); + + $census = Mockery::mock(CensusInterface::class); + + $column = new CensusColumnGivenNameInitial($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } +} diff --git a/tests/app/Census/CensusColumnSurnameGivenNameInitialTest.php b/tests/app/Census/CensusColumnSurnameGivenNameInitialTest.php new file mode 100644 index 0000000000..ea6c86bc60 --- /dev/null +++ b/tests/app/Census/CensusColumnSurnameGivenNameInitialTest.php @@ -0,0 +1,79 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2015 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\Individual; +use Mockery; + +/** + * Test harness for the class CensusColumnSurnameGivenNameInitial + */ +class CensusColumnSurnameGivenNameInitialTest extends \PHPUnit_Framework_TestCase { + /** + * Delete mock objects + */ + public function tearDown() { + Mockery::close(); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNameInitial + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testOneGivenName() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getAllNames')->andReturn([['givn' => 'Joe', 'surn' => 'Sixpack']]); + + $census = Mockery::mock(CensusInterface::class); + + $column = new CensusColumnSurnameGivenNameInitial($census, '', ''); + + $this->assertSame('Sixpack, Joe', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNameInitial + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testMultipleGivenNames() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getAllNames')->andReturn([['givn' => 'Joe Fred', 'surn' => 'Sixpack']]); + + $census = Mockery::mock(CensusInterface::class); + + $column = new CensusColumnSurnameGivenNameInitial($census, '', ''); + + $this->assertSame('Sixpack, Joe F', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNameInitial + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testNoName() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getAllNames')->andReturn([]); + + $census = Mockery::mock(CensusInterface::class); + + $column = new CensusColumnSurnameGivenNameInitial($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } +} diff --git a/tests/app/Census/CensusOfScotland1861Test.php b/tests/app/Census/CensusOfScotland1861Test.php index 6e72a4f4b4..bf20c6bcbd 100644 --- a/tests/app/Census/CensusOfScotland1861Test.php +++ b/tests/app/Census/CensusOfScotland1861Test.php @@ -62,7 +62,7 @@ class CensusOfScotland1861Test extends \PHPUnit_Framework_TestCase { $this->assertSame('Occupation', $columns[5]->abbreviation()); $this->assertSame('Birthplace', $columns[6]->abbreviation()); $this->assertSame('Infirm', $columns[7]->abbreviation()); - $this->assertSame('Sch', $columns[8]->abbreviation()); + $this->assertSame('School', $columns[8]->abbreviation()); $this->assertSame('Name and surname', $columns[0]->title()); $this->assertSame('Relation to head of household', $columns[1]->title()); diff --git a/tests/app/Census/CensusOfScotland1871Test.php b/tests/app/Census/CensusOfScotland1871Test.php index bd6a551707..f46e67dd75 100644 --- a/tests/app/Census/CensusOfScotland1871Test.php +++ b/tests/app/Census/CensusOfScotland1871Test.php @@ -62,7 +62,7 @@ class CensusOfScotland1871Test extends \PHPUnit_Framework_TestCase { $this->assertSame('Occupation', $columns[5]->abbreviation()); $this->assertSame('Birthplace', $columns[6]->abbreviation()); $this->assertSame('Infirm', $columns[7]->abbreviation()); - $this->assertSame('Sch', $columns[8]->abbreviation()); + $this->assertSame('School', $columns[8]->abbreviation()); $this->assertSame('Name and surname', $columns[0]->title()); $this->assertSame('Relation to head of household', $columns[1]->title()); diff --git a/tests/app/Census/CensusOfUnitedStates1850Test.php b/tests/app/Census/CensusOfUnitedStates1850Test.php index 364f13dba6..10e1a8b1f3 100644 --- a/tests/app/Census/CensusOfUnitedStates1850Test.php +++ b/tests/app/Census/CensusOfUnitedStates1850Test.php @@ -64,7 +64,7 @@ class CensusOfUnitedStates1850Test extends \PHPUnit_Framework_TestCase { $this->assertSame('RE', $columns[5]->abbreviation()); $this->assertSame('Birthplace', $columns[6]->abbreviation()); $this->assertSame('Mar', $columns[7]->abbreviation()); - $this->assertSame('Sch', $columns[8]->abbreviation()); + $this->assertSame('School', $columns[8]->abbreviation()); $this->assertSame('R+W', $columns[9]->abbreviation()); $this->assertSame('Infirm', $columns[10]->abbreviation()); diff --git a/tests/app/Census/CensusOfUnitedStates1860Test.php b/tests/app/Census/CensusOfUnitedStates1860Test.php index b8a0108042..0782ce3799 100644 --- a/tests/app/Census/CensusOfUnitedStates1860Test.php +++ b/tests/app/Census/CensusOfUnitedStates1860Test.php @@ -66,7 +66,7 @@ class CensusOfUnitedStates1860Test extends \PHPUnit_Framework_TestCase { $this->assertSame('PE', $columns[6]->abbreviation()); $this->assertSame('Birthplace', $columns[7]->abbreviation()); $this->assertSame('Mar', $columns[8]->abbreviation()); - $this->assertSame('Sch', $columns[9]->abbreviation()); + $this->assertSame('School', $columns[9]->abbreviation()); $this->assertSame('R+W', $columns[10]->abbreviation()); $this->assertSame('Infirm', $columns[11]->abbreviation()); diff --git a/tests/app/Census/CensusOfUnitedStates1870Test.php b/tests/app/Census/CensusOfUnitedStates1870Test.php index e6e64f7aba..6d5ff2c556 100644 --- a/tests/app/Census/CensusOfUnitedStates1870Test.php +++ b/tests/app/Census/CensusOfUnitedStates1870Test.php @@ -75,9 +75,9 @@ class CensusOfUnitedStates1870Test extends \PHPUnit_Framework_TestCase { $this->assertSame('MFB', $columns[9]->abbreviation()); $this->assertSame('Born', $columns[10]->abbreviation()); $this->assertSame('Mar', $columns[11]->abbreviation()); - $this->assertSame('Sch', $columns[12]->abbreviation()); - $this->assertSame('R', $columns[13]->abbreviation()); - $this->assertSame('W', $columns[14]->abbreviation()); + $this->assertSame('School', $columns[12]->abbreviation()); + $this->assertSame('Read', $columns[13]->abbreviation()); + $this->assertSame('Write', $columns[14]->abbreviation()); $this->assertSame('Infirm', $columns[15]->abbreviation()); $this->assertSame('Cit', $columns[16]->abbreviation()); $this->assertSame('Dis', $columns[17]->abbreviation()); diff --git a/tests/app/Census/CensusOfUnitedStates1880Test.php b/tests/app/Census/CensusOfUnitedStates1880Test.php index aa8dd0294a..bcec0de33c 100644 --- a/tests/app/Census/CensusOfUnitedStates1880Test.php +++ b/tests/app/Census/CensusOfUnitedStates1880Test.php @@ -73,24 +73,24 @@ 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('S', $columns[5]->abbreviation()); - $this->assertSame('M', $columns[6]->abbreviation()); - $this->assertSame('W', $columns[7]->abbreviation()); + $this->assertSame('Single', $columns[5]->abbreviation()); + $this->assertSame('Married', $columns[6]->abbreviation()); + $this->assertSame('Write', $columns[7]->abbreviation()); $this->assertSame('MY', $columns[8]->abbreviation()); $this->assertSame('Occupation', $columns[9]->abbreviation()); $this->assertSame('Un', $columns[10]->abbreviation()); $this->assertSame('Sick', $columns[11]->abbreviation()); - $this->assertSame('Bl', $columns[12]->abbreviation()); + $this->assertSame('Blind', $columns[12]->abbreviation()); $this->assertSame('DD', $columns[13]->abbreviation()); - $this->assertSame('Id', $columns[14]->abbreviation()); - $this->assertSame('In', $columns[15]->abbreviation()); - $this->assertSame('Dis', $columns[16]->abbreviation()); - $this->assertSame('Sch', $columns[17]->abbreviation()); - $this->assertSame('R', $columns[18]->abbreviation()); - $this->assertSame('W', $columns[19]->abbreviation()); - $this->assertSame('BP', $columns[20]->abbreviation()); - $this->assertSame('FBP', $columns[21]->abbreviation()); - $this->assertSame('MBP', $columns[22]->abbreviation()); + $this->assertSame('Idiotic', $columns[14]->abbreviation()); + $this->assertSame('Insane', $columns[15]->abbreviation()); + $this->assertSame('Disabled', $columns[16]->abbreviation()); + $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('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 03c72a05f4..dd0a3d859c 100644 --- a/tests/app/Census/CensusOfUnitedStates1890Test.php +++ b/tests/app/Census/CensusOfUnitedStates1890Test.php @@ -43,11 +43,80 @@ class CensusOfUnitedStates1890Test extends \PHPUnit_Framework_TestCase { $census = new CensusOfUnitedStates1890; $columns = $census->columns(); - $this->assertCount(1, $columns); - $this->assertInstanceOf(CensusColumnNull::class, $columns[0]); + $this->assertCount(24, $columns); + $this->assertInstanceOf(CensusColumnGivenNameInitial::class, $columns[0]); + $this->assertInstanceOf(CensusColumnSurname::class, $columns[1]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[2]); + $this->assertInstanceOf(CensusColumnRelationToHead::class, $columns[3]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[4]); + $this->assertInstanceOf(CensusColumnSexMF::class, $columns[5]); + $this->assertInstanceOf(CensusColumnAge::class, $columns[6]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[7]); + $this->assertInstanceOf(CensusColumnMonthIfMarriedWithinYear::class, $columns[8]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[9]); + $this->assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[10]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[11]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[12]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[13]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[14]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[15]); + $this->assertInstanceOf(CensusColumnOccupation::class, $columns[16]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[17]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[18]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[19]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[20]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[21]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[22]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[23]); - $this->assertSame('XXXX', $columns[0]->abbreviation()); + $this->assertSame('Name', $columns[0]->abbreviation()); + $this->assertSame('Surname', $columns[1]->abbreviation()); + $this->assertSame('CW', $columns[2]->abbreviation()); + $this->assertSame('Relation', $columns[3]->abbreviation()); + $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('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('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('Read', $columns[18]->abbreviation()); + $this->assertSame('Write', $columns[19]->abbreviation()); + $this->assertSame('English', $columns[20]->abbreviation()); + $this->assertSame('Disease', $columns[21]->abbreviation()); + $this->assertSame('Infirm', $columns[22]->abbreviation()); + $this->assertSame('Prisoner', $columns[23]->abbreviation()); - $this->assertSame('XXXX', $columns[0]->title()); + $this->assertSame('Christian name in full, and initial of middle name', $columns[0]->title()); + $this->assertSame('Surname', $columns[1]->title()); + $this->assertSame('Whether a soldier, sailor or marine during the civil war (U.S. or Conf.), or widow of such person', $columns[2]->title()); + $this->assertSame('Relation to head of family', $columns[3]->title()); + $this->assertSame('Whether white, black, mulatto, quadroon, octoroon, Chinese, Japanese, or Indian', $columns[4]->title()); + $this->assertSame('Sex', $columns[5]->title()); + $this->assertSame('Age at nearest birthday. If under one year, give age in months', $columns[6]->title()); + $this->assertSame('Whether single, married, widowed, or divorced', $columns[7]->title()); + $this->assertSame('Whether married duirng the census year (June 1, 1889, to May 31, 1890)', $columns[8]->title()); + $this->assertSame('Mother of how many children, and number of these children living', $columns[9]->title()); + $this->assertSame('Place of birth', $columns[10]->title()); + $this->assertSame('Place of birth of father', $columns[11]->title()); + $this->assertSame('Place of birth of mother', $columns[12]->title()); + $this->assertSame('Number of years in the United States', $columns[13]->title()); + $this->assertSame('Whether naturalized', $columns[14]->title()); + $this->assertSame('Whether naturalization papers have been taken out', $columns[15]->title()); + $this->assertSame('Profession, trade, occupation', $columns[16]->title()); + $this->assertSame('Months unemployed during the census year (June 1, 1889, to May 31, 1890)', $columns[17]->title()); + $this->assertSame('Able to read', $columns[18]->title()); + $this->assertSame('Able to write', $columns[19]->title()); + $this->assertSame('Able to speak English. If not the language or dialect spoken', $columns[20]->title()); + $this->assertSame('Whether suffering from acute or chronic disease, with name of disease and length of time afflicted', $columns[21]->title()); + $this->assertSame('Whether defective in mind, sight, hearing, or speech, or whether crippled, maimed, or deformed, with name of defect', $columns[22]->title()); + $this->assertSame('Whether a prisoner, convict, homeless child, or pauper', $columns[23]->title()); } } diff --git a/tests/app/Census/CensusOfUnitedStates1900Test.php b/tests/app/Census/CensusOfUnitedStates1900Test.php index 209b276ceb..f76b127c98 100644 --- a/tests/app/Census/CensusOfUnitedStates1900Test.php +++ b/tests/app/Census/CensusOfUnitedStates1900Test.php @@ -43,11 +43,86 @@ class CensusOfUnitedStates1900Test extends \PHPUnit_Framework_TestCase { $census = new CensusOfUnitedStates1900; $columns = $census->columns(); - $this->assertCount(1, $columns); - $this->assertInstanceOf(CensusColumnNull::class, $columns[0]); + $this->assertCount(26, $columns); + $this->assertInstanceOf(CensusColumnFullName::class, $columns[0]); + $this->assertInstanceOf(CensusColumnRelationToHead::class, $columns[1]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[2]); + $this->assertInstanceOf(CensusColumnSexMF::class, $columns[3]); + $this->assertInstanceOf(CensusColumnBirthMonth::class, $columns[4]); + $this->assertInstanceOf(CensusColumnBirthYear::class, $columns[5]); + $this->assertInstanceOf(CensusColumnAge::class, $columns[6]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[7]); + $this->assertInstanceOf(CensusColumnYearsMarried::class, $columns[8]); + $this->assertInstanceOf(CensusColumnChildrenBornAlive::class, $columns[9]); + $this->assertInstanceOf(CensusColumnChildrenLiving::class, $columns[10]); + $this->assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[11]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[12]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[13]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[14]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[15]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[16]); + $this->assertInstanceOf(CensusColumnOccupation::class, $columns[17]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[18]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[19]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[20]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[21]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[22]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[23]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[24]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[25]); - $this->assertSame('XXXX', $columns[0]->abbreviation()); + $this->assertSame('Name', $columns[0]->abbreviation()); + $this->assertSame('Relation', $columns[1]->abbreviation()); + $this->assertSame('Race', $columns[2]->abbreviation()); + $this->assertSame('Sex', $columns[3]->abbreviation()); + $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('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('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('School', $columns[19]->abbreviation()); + $this->assertSame('Read', $columns[20]->abbreviation()); + $this->assertSame('Write', $columns[21]->abbreviation()); + $this->assertSame('English', $columns[22]->abbreviation()); + $this->assertSame('Home', $columns[23]->abbreviation()); + $this->assertSame('Mort', $columns[24]->abbreviation()); + $this->assertSame('Farm', $columns[25]->abbreviation()); - $this->assertSame('XXXX', $columns[0]->title()); + $this->assertSame('Name', $columns[0]->title()); + $this->assertSame('Relationship of each person to the head of the family', $columns[1]->title()); + $this->assertSame('Color or race', $columns[2]->title()); + $this->assertSame('Sex', $columns[3]->title()); + $this->assertSame('Month of birth', $columns[4]->title()); + $this->assertSame('Year of birth', $columns[5]->title()); + $this->assertSame('Age at last birthday', $columns[6]->title()); + $this->assertSame('Whether single, married, widowed, or divorced', $columns[7]->title()); + $this->assertSame('Number of years married', $columns[8]->title()); + $this->assertSame('Mother of how many children', $columns[9]->title()); + $this->assertSame('Number of these children living', $columns[10]->title()); + $this->assertSame('Place of birth of this person', $columns[11]->title()); + $this->assertSame('Place of birth of father of this person', $columns[12]->title()); + $this->assertSame('Place of birth of mother of this person', $columns[13]->title()); + $this->assertSame('Year of immigration to the United States', $columns[14]->title()); + $this->assertSame('Number of years in the United States', $columns[15]->title()); + $this->assertSame('Naturalization', $columns[16]->title()); + $this->assertSame('Occupation, trade of profession', $columns[17]->title()); + $this->assertSame('Months not unemployed', $columns[18]->title()); + $this->assertSame('Attended school (in months)', $columns[19]->title()); + $this->assertSame('Can read', $columns[20]->title()); + $this->assertSame('Can write', $columns[21]->title()); + $this->assertSame('Can speak English', $columns[22]->title()); + $this->assertSame('Owned or rented', $columns[23]->title()); + $this->assertSame('Owned free or mortgaged', $columns[24]->title()); + $this->assertSame('Farm or house', $columns[25]->title()); } } diff --git a/tests/app/Census/CensusOfUnitedStates1910Test.php b/tests/app/Census/CensusOfUnitedStates1910Test.php index 1b2cfeb04c..fca208c56f 100644 --- a/tests/app/Census/CensusOfUnitedStates1910Test.php +++ b/tests/app/Census/CensusOfUnitedStates1910Test.php @@ -43,11 +43,95 @@ class CensusOfUnitedStates1910Test extends \PHPUnit_Framework_TestCase { $census = new CensusOfUnitedStates1910; $columns = $census->columns(); - $this->assertCount(1, $columns); - $this->assertInstanceOf(CensusColumnNull::class, $columns[0]); + $this->assertCount(29, $columns); + $this->assertInstanceOf(CensusColumnSurnameGivenNameInitial::class, $columns[0]); + $this->assertInstanceOf(CensusColumnRelationToHead::class, $columns[1]); + $this->assertInstanceOf(CensusColumnSexMF::class, $columns[2]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[3]); + $this->assertInstanceOf(CensusColumnAge::class, $columns[4]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[5]); + $this->assertInstanceOf(CensusColumnYearsMarried::class, $columns[6]); + $this->assertInstanceOf(CensusColumnChildrenBornAlive::class, $columns[7]); + $this->assertInstanceOf(CensusColumnChildrenLiving::class, $columns[8]); + $this->assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[9]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[10]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[11]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[12]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[13]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[14]); + $this->assertInstanceOf(CensusColumnOccupation::class, $columns[15]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[16]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[17]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[18]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[19]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[20]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[21]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[22]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[23]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[24]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[25]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[26]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[27]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[28]); - $this->assertSame('XXXX', $columns[0]->abbreviation()); + $this->assertSame('Name', $columns[0]->abbreviation()); + $this->assertSame('Relation', $columns[1]->abbreviation()); + $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('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('Imm', $columns[12]->abbreviation()); + $this->assertSame('Nat', $columns[13]->abbreviation()); + $this->assertSame('Language', $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('Home', $columns[23]->abbreviation()); + $this->assertSame('Mort', $columns[24]->abbreviation()); + $this->assertSame('Farm', $columns[25]->abbreviation()); + $this->assertSame('CW', $columns[26]->abbreviation()); + $this->assertSame('Blind', $columns[27]->abbreviation()); + $this->assertSame('Deaf', $columns[28]->abbreviation()); - $this->assertSame('XXXX', $columns[0]->title()); + $this->assertSame('Name', $columns[0]->title()); + $this->assertSame('Relationship of each person to the head of the family', $columns[1]->title()); + $this->assertSame('Sex', $columns[2]->title()); + $this->assertSame('Color or race', $columns[3]->title()); + $this->assertSame('Age at last birthday', $columns[4]->title()); + $this->assertSame('Whether single, married, widowed, or divorced', $columns[5]->title()); + $this->assertSame('Number of years of present marriage', $columns[6]->title()); + $this->assertSame('Mother of how many children', $columns[7]->title()); + $this->assertSame('Number of these children living', $columns[8]->title()); + $this->assertSame('Place of birth of this person', $columns[9]->title()); + $this->assertSame('Place of birth of father of this person', $columns[10]->title()); + $this->assertSame('Place of birth of mother of this person', $columns[11]->title()); + $this->assertSame('Year of immigration to the United States', $columns[12]->title()); + $this->assertSame('Whether naturalized or alien', $columns[13]->title()); + $this->assertSame('Whether able to speak English, of if not, give language spoken', $columns[14]->title()); + $this->assertSame('Trade or profession of, or particular kind of work done by this person', $columns[15]->title()); + $this->assertSame('General nature of industry', $columns[16]->title()); + $this->assertSame('Whether an employer, employee, or work on own account', $columns[17]->title()); + $this->assertSame('Whether out of work on April 15, 1910', $columns[18]->title()); + $this->assertSame('Number of weeks out of work in 1909', $columns[19]->title()); + $this->assertSame('Whether able to read', $columns[20]->title()); + $this->assertSame('Whether able to write', $columns[21]->title()); + $this->assertSame('Attended school since September 1, 1909', $columns[22]->title()); + $this->assertSame('Owned or rented', $columns[23]->title()); + $this->assertSame('Owned free or mortgaged', $columns[24]->title()); + $this->assertSame('Farm or house', $columns[25]->title()); + $this->assertSame('Whether a survivor of the Union or Confederate Army or Navy', $columns[26]->title()); + $this->assertSame('Whether blind (both eyes)', $columns[27]->title()); + $this->assertSame('Whether deaf and dumb', $columns[28]->title()); } } diff --git a/tests/app/Census/CensusOfUnitedStates1920Test.php b/tests/app/Census/CensusOfUnitedStates1920Test.php index c7aceba830..669dc586b0 100644 --- a/tests/app/Census/CensusOfUnitedStates1920Test.php +++ b/tests/app/Census/CensusOfUnitedStates1920Test.php @@ -43,11 +43,80 @@ class CensusOfUnitedStates1920Test extends \PHPUnit_Framework_TestCase { $census = new CensusOfUnitedStates1920; $columns = $census->columns(); - $this->assertCount(1, $columns); - $this->assertInstanceOf(CensusColumnNull::class, $columns[0]); + $this->assertCount(24, $columns); + $this->assertInstanceOf(CensusColumnSurnameGivenNameInitial::class, $columns[0]); + $this->assertInstanceOf(CensusColumnRelationToHead::class, $columns[1]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[2]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[3]); + $this->assertInstanceOf(CensusColumnSexMF::class, $columns[4]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[5]); + $this->assertInstanceOf(CensusColumnAge::class, $columns[6]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[7]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[8]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[9]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[10]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[11]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[12]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[13]); + $this->assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[14]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[15]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[16]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[17]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[18]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[19]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[20]); + $this->assertInstanceOf(CensusColumnOccupation::class, $columns[21]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[22]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[23]); - $this->assertSame('XXXX', $columns[0]->abbreviation()); + $this->assertSame('Name', $columns[0]->abbreviation()); + $this->assertSame('Relation', $columns[1]->abbreviation()); + $this->assertSame('Home', $columns[2]->abbreviation()); + $this->assertSame('Mort', $columns[3]->abbreviation()); + $this->assertSame('Sex', $columns[4]->abbreviation()); + $this->assertSame('Race', $columns[5]->abbreviation()); + $this->assertSame('Age', $columns[6]->abbreviation()); + $this->assertSame('Condition', $columns[7]->abbreviation()); + $this->assertSame('Imm', $columns[8]->abbreviation()); + $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('Occupation', $columns[21]->abbreviation()); + $this->assertSame('Ind', $columns[22]->abbreviation()); + $this->assertSame('Emp', $columns[23]->abbreviation()); - $this->assertSame('XXXX', $columns[0]->title()); + $this->assertSame('Name', $columns[0]->title()); + $this->assertSame('Relationship of each person to the head of the family', $columns[1]->title()); + $this->assertSame('Owned or rented', $columns[2]->title()); + $this->assertSame('If owned, free or mortgaged', $columns[3]->title()); + $this->assertSame('Sex', $columns[4]->title()); + $this->assertSame('Color or race', $columns[5]->title()); + $this->assertSame('Age at last birthday', $columns[6]->title()); + $this->assertSame('Whether single, married, widowed, or divorced', $columns[7]->title()); + $this->assertSame('Year of immigration to the United States', $columns[8]->title()); + $this->assertSame('Naturalized or alien', $columns[9]->title()); + $this->assertSame('If naturalized, year of naturalization', $columns[10]->title()); + $this->assertSame('Attended school since Sept. 1, 1919', $columns[11]->title()); + $this->assertSame('Whether able to read', $columns[12]->title()); + $this->assertSame('Whether able to write', $columns[13]->title()); + $this->assertSame('Place of birth', $columns[14]->title()); + $this->assertSame('Mother tongue', $columns[15]->title()); + $this->assertSame('Place of birth of father', $columns[16]->title()); + $this->assertSame('Mother tongue of father', $columns[17]->title()); + $this->assertSame('Place of birth of mother', $columns[18]->title()); + $this->assertSame('Mother tongue of mother', $columns[19]->title()); + $this->assertSame('Whether able to speak English', $columns[20]->title()); + $this->assertSame('Trade, profession, or particular kind of work done', $columns[21]->title()); + $this->assertSame('Industry, business of establishment in which at work', $columns[22]->title()); + $this->assertSame('Employer, salary or wage worker, or work on own account', $columns[23]->title()); } } diff --git a/tests/app/Census/CensusOfUnitedStates1930Test.php b/tests/app/Census/CensusOfUnitedStates1930Test.php index c302fe9d3a..f2511cf2f3 100644 --- a/tests/app/Census/CensusOfUnitedStates1930Test.php +++ b/tests/app/Census/CensusOfUnitedStates1930Test.php @@ -43,11 +43,104 @@ class CensusOfUnitedStates1930Test extends \PHPUnit_Framework_TestCase { $census = new CensusOfUnitedStates1930; $columns = $census->columns(); - $this->assertCount(1, $columns); - $this->assertInstanceOf(CensusColumnNull::class, $columns[0]); + $this->assertCount(32, $columns); + $this->assertInstanceOf(CensusColumnSurnameGivenNameInitial::class, $columns[0]); + $this->assertInstanceOf(CensusColumnRelationToHead::class, $columns[1]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[2]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[3]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[4]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[5]); + $this->assertInstanceOf(CensusColumnSexMF::class, $columns[6]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[7]); + $this->assertInstanceOf(CensusColumnAge::class, $columns[8]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[9]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[10]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[11]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[12]); + $this->assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[13]); + $this->assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[14]); + $this->assertInstanceOf(CensusColumnMotherBirthPlaceSimple::class, $columns[15]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[16]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[17]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[18]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[19]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[20]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[21]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[22]); + $this->assertInstanceOf(CensusColumnOccupation::class, $columns[23]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[24]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[25]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[26]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[27]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[28]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[29]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[30]); + $this->assertInstanceOf(CensusColumnNull::class, $columns[31]); - $this->assertSame('XXXX', $columns[0]->abbreviation()); + $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('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('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('XXXX', $columns[0]->title()); + $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('Radio set', $columns[4]->title()); + $this->assertSame('Does this family live on a farm', $columns[5]->title()); + $this->assertSame('Sex', $columns[6]->title()); + $this->assertSame('Color or race', $columns[7]->title()); + $this->assertSame('Age at last birthday', $columns[8]->title()); + $this->assertSame('Whether single, married, widowed, or divorced', $columns[9]->title()); + $this->assertSame('Age at first marriage', $columns[10]->title()); + $this->assertSame('Attended school since Sept. 1, 1929', $columns[11]->title()); + $this->assertSame('Whether able to read and write', $columns[12]->title()); + $this->assertSame('Place of birth', $columns[13]->title()); + $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()); } } diff --git a/tests/app/Census/CensusOfUnitedStates1940Test.php b/tests/app/Census/CensusOfUnitedStates1940Test.php deleted file mode 100644 index 4be92d6563..0000000000 --- a/tests/app/Census/CensusOfUnitedStates1940Test.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/** - * webtrees: online genealogy - * Copyright (C) 2015 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('01 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(1, $columns); - $this->assertInstanceOf(CensusColumnNull::class, $columns[0]); - - $this->assertSame('XXXX', $columns[0]->abbreviation()); - - $this->assertSame('XXXX', $columns[0]->title()); - } -} diff --git a/tests/app/Census/CensusOfUnitedStatesTest.php b/tests/app/Census/CensusOfUnitedStatesTest.php index 91e2d9a94f..5bd14ef636 100644 --- a/tests/app/Census/CensusOfUnitedStatesTest.php +++ b/tests/app/Census/CensusOfUnitedStatesTest.php @@ -42,7 +42,7 @@ class CensusOfUnitedStatesTest extends \PHPUnit_Framework_TestCase { $census_dates = $census->allCensusDates(); - $this->assertCount(10, $census_dates); + $this->assertCount(9, $census_dates); $this->assertInstanceOf(CensusOfUnitedStates1850::class, $census_dates[0]); $this->assertInstanceOf(CensusOfUnitedStates1860::class, $census_dates[1]); $this->assertInstanceOf(CensusOfUnitedStates1870::class, $census_dates[2]); @@ -52,6 +52,5 @@ class CensusOfUnitedStatesTest extends \PHPUnit_Framework_TestCase { $this->assertInstanceOf(CensusOfUnitedStates1910::class, $census_dates[6]); $this->assertInstanceOf(CensusOfUnitedStates1920::class, $census_dates[7]); $this->assertInstanceOf(CensusOfUnitedStates1930::class, $census_dates[8]); - $this->assertInstanceOf(CensusOfUnitedStates1940::class, $census_dates[9]); } } |
