diff options
41 files changed, 1595 insertions, 149 deletions
diff --git a/app/Census/CensusColumnAgeFemale10To16Years.php b/app/Census/CensusColumnAgeFemale10To16Years.php new file mode 100644 index 0000000000..a7da385315 --- /dev/null +++ b/app/Census/CensusColumnAgeFemale10To16Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeFemale10To16Years 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) {
+ if ($individual->getSex() === 'M') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 9 && $years < 16)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeFemale16To26Years.php b/app/Census/CensusColumnAgeFemale16To26Years.php new file mode 100644 index 0000000000..be11e62abd --- /dev/null +++ b/app/Census/CensusColumnAgeFemale16To26Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeFemale16To26Years 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) {
+ if ($individual->getSex() === 'M') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 15 && $years < 26)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeFemale26To45Years.php b/app/Census/CensusColumnAgeFemale26To45Years.php new file mode 100644 index 0000000000..e7b4076ac3 --- /dev/null +++ b/app/Census/CensusColumnAgeFemale26To45Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeFemale26To45Years 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) {
+ if ($individual->getSex() === 'M') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 25 && $years < 45)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeFemale45UpYears.php b/app/Census/CensusColumnAgeFemale45UpYears.php new file mode 100644 index 0000000000..eeb0616e83 --- /dev/null +++ b/app/Census/CensusColumnAgeFemale45UpYears.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeFemale45UpYears 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) {
+ if ($individual->getSex() === 'M') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 44)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeFemaleUnder10Years.php b/app/Census/CensusColumnAgeFemaleUnder10Years.php new file mode 100644 index 0000000000..0b3706d25c --- /dev/null +++ b/app/Census/CensusColumnAgeFemaleUnder10Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeFemaleUnder10Years 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) {
+ if ($individual->getSex() === 'M') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 0 && $years < 10)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMale10To16Years.php b/app/Census/CensusColumnAgeMale10To16Years.php new file mode 100644 index 0000000000..8ddc73540f --- /dev/null +++ b/app/Census/CensusColumnAgeMale10To16Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeMale10To16Years 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 9 && $years < 16)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMale16To18Years.php b/app/Census/CensusColumnAgeMale16To18Years.php new file mode 100644 index 0000000000..ef4f932c19 --- /dev/null +++ b/app/Census/CensusColumnAgeMale16To18Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeMale16To18Years 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 15 && $years < 19)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMale16To26Years.php b/app/Census/CensusColumnAgeMale16To26Years.php new file mode 100644 index 0000000000..a0b38dc431 --- /dev/null +++ b/app/Census/CensusColumnAgeMale16To26Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeMale16To26Years 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 15 && $years < 27)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMale26To45Years.php b/app/Census/CensusColumnAgeMale26To45Years.php new file mode 100644 index 0000000000..36d8eaf324 --- /dev/null +++ b/app/Census/CensusColumnAgeMale26To45Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeMale26To45Years 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 25 && $years < 45)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMale45UpYears.php b/app/Census/CensusColumnAgeMale45UpYears.php new file mode 100644 index 0000000000..ddb68fe78a --- /dev/null +++ b/app/Census/CensusColumnAgeMale45UpYears.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeMale45UpYears 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 44)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMaleOvr16Years.php b/app/Census/CensusColumnAgeMaleOvr16Years.php new file mode 100644 index 0000000000..5bafe2df88 --- /dev/null +++ b/app/Census/CensusColumnAgeMaleOvr16Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeMaleOvr16Years 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 15)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMaleUnder10Years.php b/app/Census/CensusColumnAgeMaleUnder10Years.php new file mode 100644 index 0000000000..14f7fd8dbb --- /dev/null +++ b/app/Census/CensusColumnAgeMaleUnder10Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeMaleUnder10Years 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 0 && $years < 10)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMaleUnder16Years.php b/app/Census/CensusColumnAgeMaleUnder16Years.php new file mode 100644 index 0000000000..1217d6cb18 --- /dev/null +++ b/app/Census/CensusColumnAgeMaleUnder16Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAgeMaleUnder16Years 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 0 && $years < 16)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnAgeMarried.php b/app/Census/CensusColumnAgeMarried.php new file mode 100644 index 0000000000..04cba56ac1 --- /dev/null +++ b/app/Census/CensusColumnAgeMarried.php @@ -0,0 +1,46 @@ +<?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\Individual; + +/** + * At what age did the individual marry. + */ +class CensusColumnAgeMarried 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) { + if ($individual->getBirthDate()->isOK()) { + foreach ($individual->getSpouseFamilies() as $family) { + foreach ($family->getFacts('MARR', true) as $fact) { + if ($fact->getDate()->isOK()) { + return Date::getAge($individual->getBirthDate(), $fact->getDate(), 0); + } + } + } + } + + return ''; + } +} diff --git a/app/Census/CensusColumnAllFemales.php b/app/Census/CensusColumnAllFemales.php new file mode 100644 index 0000000000..4d9ae77979 --- /dev/null +++ b/app/Census/CensusColumnAllFemales.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnAllFemales 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) {
+ if ($individual->getSex() === 'M') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 0)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusColumnConditionUs.php b/app/Census/CensusColumnConditionUs.php new file mode 100644 index 0000000000..261f3473fe --- /dev/null +++ b/app/Census/CensusColumnConditionUs.php @@ -0,0 +1,43 @@ +<?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\Individual; + +/** + * Marital status. + */ +class CensusColumnConditionUs 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) { + $family = $this->spouseFamily($individual); + + if ($family === null || count($family->getFacts('_NMR')) > 0) { + return 'S'; // unmarried + } elseif (count($family->getFacts('DIV')) > 0) { + return 'D'; // divorced + } else { + return 'M'; // married + } + } +} diff --git a/app/Census/CensusColumnMaleAgeUnder10Years.php b/app/Census/CensusColumnMaleAgeUnder10Years.php new file mode 100644 index 0000000000..df29092e00 --- /dev/null +++ b/app/Census/CensusColumnMaleAgeUnder10Years.php @@ -0,0 +1,42 @@ +<?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 age of a male individual (rounded down to the nearest 5 years).
+ */
+class CensusColumnMaleAgeUnder10Years 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) {
+ if ($individual->getSex() === 'F') {
+ return '';
+ } else {
+ $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
+ if ($years > 0 && $years < 10)
+ return (string) $years;
+ }
+ }
+}
diff --git a/app/Census/CensusOfUnitedStates.php b/app/Census/CensusOfUnitedStates.php index 3158d49dc1..836faa8924 100644 --- a/app/Census/CensusOfUnitedStates.php +++ b/app/Census/CensusOfUnitedStates.php @@ -35,6 +35,7 @@ class CensusOfUnitedStates extends Census implements CensusPlaceInterface { new CensusOfUnitedStates1910(), new CensusOfUnitedStates1920(), new CensusOfUnitedStates1930(), + new CensusOfUnitedStates1940(), ); } diff --git a/app/Census/CensusOfUnitedStates1790.php b/app/Census/CensusOfUnitedStates1790.php new file mode 100644 index 0000000000..8037c36c2f --- /dev/null +++ b/app/Census/CensusOfUnitedStates1790.php @@ -0,0 +1,49 @@ +<?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;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfUnitedStates1790 extends CensusOfUnitedStates implements CensusInterface {
+ /**
+ * When did this census occur.
+ *
+ * @return string
+ */
+ public function censusDate() {
+ return '02 AUG 1790';
+ }
+
+ /**
+ * The columns of the census.
+ *
+ * @return CensusColumnInterface[]
+ */
+ public function columns() {
+ return array(
+ new CensusColumnFullName($this, 'Name', 'Name'),
+ new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of household'),
+ new CensusColumnOccupation($this, 'Occupation', 'Profession, occupation, or trade'),
+ new CensusColumnAgeMaleOvr16Years($this, 'White Male 16+', 'White male of 16 yrs upward'),
+ new CensusColumnAgeMaleUnder16Years($this, 'White Male 16-', 'White males of under 16 yrs'),
+ new CensusColumnAllFemales($this, 'White Female', 'All White Females'),
+ new CensusColumnNull($this, 'Other Free', 'All other free persons'),
+ new CensusColumnNull($this, 'Slaves', 'Number of slaves'),
+
+ );
+ }
+}
diff --git a/app/Census/CensusOfUnitedStates1800.php b/app/Census/CensusOfUnitedStates1800.php new file mode 100644 index 0000000000..84fb54f970 --- /dev/null +++ b/app/Census/CensusOfUnitedStates1800.php @@ -0,0 +1,57 @@ +<?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;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfUnitedStates1800 extends CensusOfUnitedStates implements CensusInterface {
+ /**
+ * When did this census occur.
+ *
+ * @return string
+ */
+ public function censusDate() {
+ return '04 AUG 1800';
+ }
+
+ /**
+ * The columns of the census.
+ *
+ * @return CensusColumnInterface[]
+ */
+ public function columns() {
+ return array(
+ new CensusColumnFullName($this, 'Name', 'Name'),
+ new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of household'),
+ new CensusColumnOccupation($this, 'Occupation', 'Profession, occupation, or trade'),
+ new CensusColumnAgeMaleUnder10Years($this, 'Male -10', 'Free white males under 10'),
+ new CensusColumnAgeMale10To16Years($this, 'Male 10-16', 'Free white males 10 < 16'),
+ new CensusColumnAgeMale16To26Years($this, 'Male 16-26', 'Free white males 16 < 26, inc. head of family'),
+ new CensusColumnAgeMale26To45Years($this, 'Male 26-45', 'Free white males 26 < 45, inc. head of family'),
+ new CensusColumnAgeMale45UpYears($this, 'Male 45+', 'Free white males 45 up, inc. head of family'),
+ new CensusColumnAgeFemaleUnder10Years($this, 'Female -10', 'Free white females under 10'),
+ new CensusColumnAgeFemale10To16Years($this, 'Female 10-16', 'Free white females 10 < 16'),
+ new CensusColumnAgeFemale16To26Years($this, 'Female 16-26', 'Free white females 16 < 26, inc. head of family'),
+ new CensusColumnAgeFemale26To45Years($this, 'Female 26-45', 'Free white females 26 < 45, inc. head of family'),
+ new CensusColumnAgeFemale45UpYears($this, 'Female 45+', 'Free white females 45 up'),
+ new CensusColumnNull($this, 'Other Free', 'All other free persons, except Indians not taxed'),
+ new CensusColumnNull($this, 'Slaves', 'Number of slaves'),
+ new CensusColumnNull($this, 'Total', 'Total number of individuals'),
+
+ );
+ }
+}
diff --git a/app/Census/CensusOfUnitedStates1810.php b/app/Census/CensusOfUnitedStates1810.php new file mode 100644 index 0000000000..61007457e7 --- /dev/null +++ b/app/Census/CensusOfUnitedStates1810.php @@ -0,0 +1,57 @@ +<?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; + +/** + * Definitions for a census + */ +class CensusOfUnitedStates1810 extends CensusOfUnitedStates implements CensusInterface { + /** + * When did this census occur. + * + * @return string + */ + public function censusDate() { + return '06 AUG 1810'; + } + + /** + * The columns of the census. + * + * @return CensusColumnInterface[] + */ + public function columns() { + return array( + new CensusColumnFullName($this, 'Name', 'Name'), + new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of household'), + new CensusColumnOccupation($this, 'Occupation', 'Profession, occupation, or trade'), + new CensusColumnMaleAgeUnder10Years($this, 'Male-10', 'Free white males under 10'), + new CensusColumnAgeMale10To16Years($this, 'Male 10-16', 'Free white males 10 < 16'), + new CensusColumnAgeMale16To26Years($this, 'Male 16-26', 'Free white males 16 < 26, inc. head of family'), + new CensusColumnAgeMale26To45Years($this, 'Male 26-45', 'Free white males 26 < 45, inc. head of family'), + new CensusColumnAgeMale45UpYears($this, 'Male 45+', 'Free white males 45 up, inc. head of family'), + new CensusColumnAgeFemaleUnder10Years($this, 'Female-10', 'Free white females under 10'), + new CensusColumnAgeFemale10To16Years($this, 'Female 10-16', 'Free white females 10 < 16'), + new CensusColumnAgeFemale16To26Years($this, 'Female 16-26', 'Free white females 16 < 26, inc. head of family'), + new CensusColumnAgeFemale26To45Years($this, 'Female 26-45', 'Free white females 26 < 45, inc. head of family'), + new CensusColumnAgeFemale45UpYears($this, 'Female 45+', 'Free white females 45 up'), + new CensusColumnNull($this, 'Other Free', 'All other free persons, except Indians not taxed'), + new CensusColumnNull($this, 'Slaves', 'Number of slaves'), + new CensusColumnNull($this, 'Total', 'Total number of individuals'), + + ); + } +}
\ No newline at end of file diff --git a/app/Census/CensusOfUnitedStates1820.php b/app/Census/CensusOfUnitedStates1820.php new file mode 100644 index 0000000000..89dafdf739 --- /dev/null +++ b/app/Census/CensusOfUnitedStates1820.php @@ -0,0 +1,62 @@ +<?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;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfUnitedStates1820 extends CensusOfUnitedStates implements CensusInterface {
+ /**
+ * When did this census occur.
+ *
+ * @return string
+ */
+ public function censusDate() {
+ return '07 AUG 1820';
+ }
+
+ /**
+ * The columns of the census.
+ *
+ * @return CensusColumnInterface[]
+ */
+
+ public function columns() {
+ return array(
+ new CensusColumnFullName($this, 'Name', 'Name'),
+ new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of household'),
+ new CensusColumnAgeMaleUnder10Years($this, 'FWM-10', 'Free white males under 10'),
+ new CensusColumnAgeMale10To16Years($this, 'FWM10-16', 'Free white males 10<16'),
+ new CensusColumnAgeMale16To18Years($this, 'FWM16-18', 'Free white males 10<16'),
+ new CensusColumnAgeMale16To26Years($this, 'FWM16-26', 'Free white males 16<26, inc. head of family'),
+ new CensusColumnAgeMale26To45Years($this, 'FWM26-45', 'Free white males 26<45, inc. head of family'),
+ new CensusColumnAgeMale45UpYears($this, 'FWM45+', 'Free white males 45 up, inc. head of family'),
+ new CensusColumnAgeFemaleUnder10Years($this, 'FWF-10', 'Free white females under 10'),
+ new CensusColumnAgeFemale10To16Years($this, 'FWF10-16', 'Free white females 10<16'),
+ new CensusColumnAgeFemale16To26Years($this, 'FWF16-26', 'Free white females 16<26, inc. head of family'),
+ new CensusColumnAgeFemale26To45Years($this, 'FWF26-45', 'Free white females 26<45, inc. head of family'),
+ new CensusColumnAgeFemale45UpYears($this, 'FWF45+', 'Free white females 45 up'),
+ new CensusColumnNull($this, 'FNR', 'Foreigners not naturalized'),
+ new CensusColumnNull($this, 'AG', 'No. engaged in agriculture'),
+ new CensusColumnNull($this, 'COM', 'No. engaged in commerce'),
+ new CensusColumnNull($this, 'MNF', 'No. engaged in manufactures'),
+ new CensusColumnNull($this, 'Slaves', 'Slaves'),
+ new CensusColumnNull($this, 'FC', 'Free colored persons'),
+ new CensusColumnNull($this, 'Other', 'All other persons except indians non taxed'),
+
+ );
+ }
+}
\ No newline at end of file diff --git a/app/Census/CensusOfUnitedStates1830.php b/app/Census/CensusOfUnitedStates1830.php new file mode 100644 index 0000000000..1a3e6de2b4 --- /dev/null +++ b/app/Census/CensusOfUnitedStates1830.php @@ -0,0 +1,51 @@ +<?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;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfUnitedStates1830 extends CensusOfUnitedStates implements CensusInterface {
+ /**
+ * When did this census occur.
+ *
+ * @return string
+ */
+ public function censusDate() {
+ return '01 JUN 1830';
+ }
+
+ /**
+ * The columns of the census.
+ *
+ * @return CensusColumnInterface[]
+ */
+ public function columns() {
+ return array(
+
+ new CensusColumnFullName($this, 'Name', 'Name'),
+ new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of household'),
+ new CensusColumnAge($this, 'Age', 'Age'),
+ new CensusColumnSexMF($this, 'Sex', 'Sex'),
+ new CensusColumnNull($this, 'Slaves', 'Slaves'),
+ new CensusColumnNull($this, 'Free colored', 'Free colored persons'),
+ new CensusColumnNull($this, 'Infirm', 'Whether deaf and dumb or blind'),
+ new CensusColumnNull($this, 'FNR', 'Foreigners not naturalized'),
+ new CensusColumnNull($this, 'Other Infirm', 'Slaves & colored deaf and dumb or blind'),
+
+ );
+ }
+}
diff --git a/app/Census/CensusOfUnitedStates1840.php b/app/Census/CensusOfUnitedStates1840.php new file mode 100644 index 0000000000..1af142982a --- /dev/null +++ b/app/Census/CensusOfUnitedStates1840.php @@ -0,0 +1,51 @@ +<?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;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfUnitedStates1840 extends CensusOfUnitedStates implements CensusInterface {
+ /**
+ * When did this census occur.
+ *
+ * @return string
+ */
+ public function censusDate() {
+ return '01 JUN 1840';
+ }
+
+ /**
+ * The columns of the census.
+ *
+ * @return CensusColumnInterface[]
+ */
+ public function columns() {
+ return array(
+
+ new CensusColumnFullName($this, 'Name', 'Name'),
+ new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of household'),
+ new CensusColumnAge($this, 'Age', 'Age'),
+ new CensusColumnSexMF($this, 'Sex', 'Sex'),
+ new CensusColumnNull($this, 'Slaves', 'Slaves'),
+ new CensusColumnNull($this, 'Free colored', 'Free colored persons'),
+ new CensusColumnNull($this, 'Infirm', 'Whether deaf and dumb or blind'),
+ new CensusColumnNull($this, 'FNR', 'Foreigners not naturalized'),
+ new CensusColumnNull($this, 'Other Infirm', 'Slaves & colored deaf and dumb or blind'),
+
+ );
+ }
+}
diff --git a/app/Census/CensusOfUnitedStates1880.php b/app/Census/CensusOfUnitedStates1880.php index 2723788d30..003e9ecc98 100644 --- a/app/Census/CensusOfUnitedStates1880.php +++ b/app/Census/CensusOfUnitedStates1880.php @@ -40,12 +40,12 @@ 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, 'Single', 'Single'), - new CensusColumnNull($this, 'Married', 'Married'), - new CensusColumnNull($this, 'Write', 'Widowed, Divorced'), - new CensusColumnNull($this, 'MY', 'Married during census year'), + new CensusColumnNull($this, 'S', 'Single'), + new CensusColumnNull($this, 'M', 'Married'), + new CensusColumnNull($this, 'W/D', 'Widowed, Divorced'), + new CensusColumnMarriedWithinYear($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, 'UnEm', 'Number of months the person has been unemployed during the census year'), new CensusColumnNull($this, 'Sick', 'Sickness or disability'), new CensusColumnNull($this, 'Blind', 'Blind'), new CensusColumnNull($this, 'DD', 'Deaf and dumb'), @@ -55,9 +55,9 @@ class CensusOfUnitedStates1880 extends CensusOfUnitedStates implements CensusInt 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'), + 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'), ); } } diff --git a/app/Census/CensusOfUnitedStates1890.php b/app/Census/CensusOfUnitedStates1890.php index 438b8213bc..1353add13c 100644 --- a/app/Census/CensusOfUnitedStates1890.php +++ b/app/Census/CensusOfUnitedStates1890.php @@ -42,20 +42,20 @@ class CensusOfUnitedStates1890 extends CensusOfUnitedStates implements CensusInt 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 CensusColumnConditionUs($this, 'Cond', '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, 'Chil', 'Mother of how many children, and number of these children living'), + new CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth'), + new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father'), + new CensusColumnFatherBirthPlaceSimple($this, 'MBP', '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, 'Unemp', '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, 'Eng', '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 1175a5ad5d..6e4f245f34 100644 --- a/app/Census/CensusOfUnitedStates1900.php +++ b/app/Census/CensusOfUnitedStates1900.php @@ -42,22 +42,22 @@ class CensusOfUnitedStates1900 extends CensusOfUnitedStates implements CensusInt 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 CensusColumnConditionUs($this, 'Cond', '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 CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth of this person'), + new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father of this person'), + new CensusColumnFatherBirthPlaceSimple($this, 'MBP', '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, 'Unemp', '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, 'Eng', '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 c4f22e0dd3..be4ab200a5 100644 --- a/app/Census/CensusOfUnitedStates1910.php +++ b/app/Census/CensusOfUnitedStates1910.php @@ -40,24 +40,24 @@ class CensusOfUnitedStates1910 extends CensusOfUnitedStates implements CensusInt 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 CensusColumnConditionUs($this, 'Cond', '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 CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth of this person'), + new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father of this person'), + new CensusColumnFatherBirthPlaceSimple($this, 'MBP', '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 CensusColumnNull($this, 'Lang', '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, 'Unemp', 'Whether out of work on April 15, 1910'), + new CensusColumnNull($this, 'Unemp', 'Number of weeks out of work in 1909'), + new CensusColumnNull($this, 'R', 'Whether able to read'), + new CensusColumnNull($this, 'W', 'Whether able to write'), + new CensusColumnNull($this, 'Sch', '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'), diff --git a/app/Census/CensusOfUnitedStates1920.php b/app/Census/CensusOfUnitedStates1920.php index 70b3e9aaf8..5db1f9f5a2 100644 --- a/app/Census/CensusOfUnitedStates1920.php +++ b/app/Census/CensusOfUnitedStates1920.php @@ -42,20 +42,20 @@ class CensusOfUnitedStates1920 extends CensusOfUnitedStates implements CensusInt 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 CensusColumnConditionUs($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 CensusColumnNull($this, 'R', 'Whether able to read'), + new CensusColumnNull($this, 'W', 'Whether able to write'), + new CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth'), + new CensusColumnNull($this, 'Lang', 'Mother tongue'), + new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father'), + new CensusColumnNull($this, 'Father lang', 'Mother tongue of father'), + new CensusColumnFatherBirthPlaceSimple($this, 'MBP', 'Place of birth of mother'), + new CensusColumnNull($this, 'Mother lang', 'Mother tongue of mother'), + new CensusColumnNull($this, 'Eng', '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 4be841f7e5..a836a840a5 100644 --- a/app/Census/CensusOfUnitedStates1930.php +++ b/app/Census/CensusOfUnitedStates1930.php @@ -35,38 +35,34 @@ class CensusOfUnitedStates1930 extends CensusOfUnitedStates implements CensusInt */ public function columns() { return array( - new CensusColumnSurnameGivenNameInitial($this, 'Name', 'Name'), + new CensusColumnFullName($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, 'V/R', '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 CensusColumnConditionUs($this, 'Cond', 'Whether single, married, widowed, or divorced'), + new CensusColumnAgeMarried($this, 'AM', '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, 'R/W', 'Whether able to read and write'), + new CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth'), + new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father'), + new CensusColumnMotherBirthPlaceSimple($this, 'MBP', 'Place of birth of mother'), + new CensusColumnNull($this, 'Lang', 'Language spoken in home before coming to the United States'), 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 CensusColumnNull($this, 'Eng', '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, 'Vet', 'Whether a veteran of U.S. military or …'), new CensusColumnNull($this, 'War', 'What war or …'), - new CensusColumnNull($this, '?', '…'), ); } } diff --git a/app/Census/CensusOfUnitedStates1940.php b/app/Census/CensusOfUnitedStates1940.php new file mode 100644 index 0000000000..eee6d17f9a --- /dev/null +++ b/app/Census/CensusOfUnitedStates1940.php @@ -0,0 +1,67 @@ +<?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; + +/** + * Definitions for a census + */ +class CensusOfUnitedStates1940 extends CensusOfUnitedStates implements CensusInterface { + /** + * When did this census occur. + * + * @return string + */ + public function censusDate() { + return 'APR 1940'; + } + + /** + * The columns of the census. + * + * @return CensusColumnInterface[] + */ + public function columns() { + return array( + new CensusColumnFullName($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, 'V/R', 'Value of house, if owned, or monthly rental if rented'), + 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 CensusColumnConditionUs($this, 'Cond', 'Whether single, married, widowed, or divorced'), + new CensusColumnAgeMarried($this, 'AM', 'Age at first marriage'), + new CensusColumnNull($this, 'School', 'Attended school since Sept. 1, 1929'), + new CensusColumnNull($this, 'R/W', 'Whether able to read and write'), + new CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth'), + new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father'), + new CensusColumnMotherBirthPlaceSimple($this, 'MBP', 'Place of birth of mother'), + new CensusColumnNull($this, 'Lang', 'Language spoken in home before coming to the United States'), + new CensusColumnNull($this, 'Imm', 'Year of immigration to the United States'), + new CensusColumnNull($this, 'Nat', 'Naturalization'), + new CensusColumnNull($this, 'Eng', '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, 'Vet', 'Whether a veteran of U.S. military or …'), + new CensusColumnNull($this, 'War', 'What war or …'), + ); + } +} 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]); } } |
