summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Census/Census.php21
-rw-r--r--app/Census/CensusColumnBirthMonthDay.php41
-rw-r--r--app/Census/CensusOfCanada.php60
-rw-r--r--app/Census/CensusOfCanada1881.php61
-rw-r--r--app/Census/CensusOfCanada1891.php67
-rw-r--r--app/Census/CensusOfCanada1901.php77
-rw-r--r--tests/app/Census/CensusOfCanada1881Test.php103
-rw-r--r--tests/app/Census/CensusOfCanada1891Test.php121
-rw-r--r--tests/app/Census/CensusOfCanada1901Test.php151
-rw-r--r--tests/app/Census/CensusTest.php102
10 files changed, 758 insertions, 46 deletions
diff --git a/app/Census/Census.php b/app/Census/Census.php
index 30f489a84e..e8e5a7ce4d 100644
--- a/app/Census/Census.php
+++ b/app/Census/Census.php
@@ -43,6 +43,7 @@ class Census
new CensusOfScotland(),
new CensusOfUnitedStates(),
new CensusOfWales(),
+ new CensusOfCanada(),
];
case 'da':
@@ -56,6 +57,7 @@ class Census
new CensusOfSlovakia(),
new CensusOfUnitedStates(),
new CensusOfWales(),
+ new CensusOfCanada(),
];
case 'de':
@@ -69,6 +71,7 @@ class Census
new CensusOfSlovakia(),
new CensusOfUnitedStates(),
new CensusOfWales(),
+ new CensusOfCanada(),
];
case 'en-AU':
@@ -77,6 +80,7 @@ class Census
new CensusOfEngland(),
new CensusOfScotland(),
new CensusOfWales(),
+ new CensusOfCanada(),
new CensusOfUnitedStates(),
new CensusOfCzechRepublic(),
new CensusOfDenmark(),
@@ -88,6 +92,7 @@ class Census
case 'en-US':
return [
new CensusOfUnitedStates(),
+ new CensusOfCanada(),
new CensusOfCzechRepublic(),
new CensusOfDenmark(),
new CensusOfDeutschland(),
@@ -99,8 +104,22 @@ class Census
];
case 'fr':
+ return [
+ new CensusOfFrance(),
+ new CensusOfCanada(),
+ new CensusOfCzechRepublic(),
+ new CensusOfDenmark(),
+ new CensusOfDeutschland(),
+ new CensusOfEngland(),
+ new CensusOfScotland(),
+ new CensusOfSlovakia(),
+ new CensusOfUnitedStates(),
+ new CensusOfWales(),
+ ];
+
case 'fr-CA':
return [
+ new CensusOfCanada(),
new CensusOfFrance(),
new CensusOfCzechRepublic(),
new CensusOfDenmark(),
@@ -123,6 +142,7 @@ class Census
new CensusOfScotland(),
new CensusOfUnitedStates(),
new CensusOfWales(),
+ new CensusOfCanada(),
];
default:
@@ -136,6 +156,7 @@ class Census
new CensusOfCzechRepublic(),
new CensusOfSlovakia(),
new CensusOfDenmark(),
+ new CensusOfCanada(),
];
}
}
diff --git a/app/Census/CensusColumnBirthMonthDay.php b/app/Census/CensusColumnBirthMonthDay.php
new file mode 100644
index 0000000000..ea5de5cbab
--- /dev/null
+++ b/app/Census/CensusColumnBirthMonthDay.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
+ */
+
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Census;
+
+use Fisharebest\Webtrees\Individual;
+
+/**
+ * The individual's month and date of birth.
+ */
+class CensusColumnBirthMonthDay extends AbstractCensusColumn implements CensusColumnInterface
+{
+ /**
+ * Generate the likely value of this census column, based on available information.
+ *
+ * @param Individual $individual
+ * @param Individual $head
+ *
+ * @return string
+ */
+ public function generate(Individual $individual, Individual $head): string
+ {
+ return $individual->getEstimatedBirthDate()->minimumDate()->format('%M %j');
+ }
+}
diff --git a/app/Census/CensusOfCanada.php b/app/Census/CensusOfCanada.php
new file mode 100644
index 0000000000..9a37a0403c
--- /dev/null
+++ b/app/Census/CensusOfCanada.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
+ */
+
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Census;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfCanada extends Census implements CensusPlaceInterface
+{
+ /**
+ * All available censuses for this census place.
+ *
+ * @return CensusInterface[]
+ */
+ public function allCensusDates(): array
+ {
+ return [
+ new CensusOfCanada1881(),
+ new CensusOfCanada1891(),
+ new CensusOfCanada1901(),
+ ];
+ }
+
+ /**
+ * Where did this census occur, in GEDCOM format.
+ *
+ * @return string
+ */
+ public function censusPlace(): string
+ {
+ return 'Canada';
+ }
+
+ /**
+ * In which language was this census written.
+ *
+ * @return string
+ */
+ public function censusLanguage(): string
+ {
+ return 'en-US';
+ }
+}
diff --git a/app/Census/CensusOfCanada1881.php b/app/Census/CensusOfCanada1881.php
new file mode 100644
index 0000000000..caf6731972
--- /dev/null
+++ b/app/Census/CensusOfCanada1881.php
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
+ */
+
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Census;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfCanada1881 extends CensusOfCanada implements CensusInterface
+{
+ /**
+ * When did this census occur.
+ *
+ * @return string
+ */
+ public function censusDate(): string
+ {
+ return '04 APR 1881';
+ }
+
+ /**
+ * The columns of the census.
+ *
+ * @return CensusColumnInterface[]
+ */
+ public function columns(): array
+ {
+ return [
+ new CensusColumnFullName($this, 'Name', 'Name'),
+ new CensusColumnSexMF($this, 'Sex', 'Sex'),
+ new CensusColumnAge($this, 'Age', 'Age at last birthday'),
+ new CensusColumnNull($this, 'Born', 'Born within last twelve months'),
+ new CensusColumnBirthPlaceSimple($this, 'Birth Loc', 'Country or Province of Birth'),
+ new CensusColumnNull($this, 'Religion', 'Religion'),
+ new CensusColumnNationality($this, 'Origin', 'Origin'),
+ new CensusColumnOccupation($this, 'Occupation', 'Profession, Occupation, or Trade'),
+ new CensusColumnConditionUs($this, 'M/W', 'Married or Widowed'),
+ new CensusColumnNull($this, 'School', 'Instruction - Going to School'),
+ new CensusColumnNull($this, 'Deaf', 'Infirmities - Deaf and Dumb'),
+ new CensusColumnNull($this, 'Blind', 'Infirmities - Blind'),
+ new CensusColumnNull($this, 'Unsound', 'Infirmities - Unsound Mind'),
+ new CensusColumnNull($this, 'Date', 'Dates of Operations and Remarks'),
+ ];
+ }
+}
diff --git a/app/Census/CensusOfCanada1891.php b/app/Census/CensusOfCanada1891.php
new file mode 100644
index 0000000000..cfe7821c8f
--- /dev/null
+++ b/app/Census/CensusOfCanada1891.php
@@ -0,0 +1,67 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
+ */
+
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Census;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfCanada1891 extends CensusOfCanada implements CensusInterface
+{
+ /**
+ * When did this census occur.
+ *
+ * @return string
+ */
+ public function censusDate(): string
+ {
+ return '06 APR 1891';
+ }
+
+ /**
+ * The columns of the census.
+ *
+ * @return CensusColumnInterface[]
+ */
+ public function columns(): array
+ {
+ return [
+ new CensusColumnFullName($this, 'Name', 'Name'),
+ new CensusColumnSexMF($this, 'Sex', 'Sex'),
+ new CensusColumnAge($this, 'Age', 'Age at last birthday'),
+ new CensusColumnConditionUs($this, 'M/W', 'Married or Widowed'),
+ new CensusColumnRelationToHeadEnglish($this, 'Relation', 'Relationship to Head of Family'),
+ new CensusColumnBirthPlaceSimple($this, 'Birth Loc', 'Country or Province of Birth'),
+ new CensusColumnNull($this, 'French', 'French Canadians'),
+ new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father'),
+ new CensusColumnMotherBirthPlaceSimple($this, 'MBP', 'Place of birth of mother'),
+ new CensusColumnNull($this, 'Religion', 'Religion'),
+ new CensusColumnOccupation($this, 'Occupation', 'Profession, Occupation, or Trade'),
+ new CensusColumnNull($this, 'Employers', 'Employers'),
+ new CensusColumnNull($this, 'Earner', 'Wage Earner'),
+ new CensusColumnNull($this, 'UnEmp', 'Unemployed during week preceeding Census'),
+ new CensusColumnNull($this, 'AvgEmp', 'Employer to state average number of hands employed during year'),
+ new CensusColumnNull($this, 'Read', 'Instruction - Read'),
+ new CensusColumnNull($this, 'Write', 'Instruction - Write'),
+ new CensusColumnNull($this, 'Deaf', 'Infirmities - Deaf and Dumb'),
+ new CensusColumnNull($this, 'Blind', 'Infirmities - Blind'),
+ new CensusColumnNull($this, 'Unsound', 'Infirmities - Unsound Mind'),
+ ];
+ }
+}
diff --git a/app/Census/CensusOfCanada1901.php b/app/Census/CensusOfCanada1901.php
new file mode 100644
index 0000000000..01d7d8712c
--- /dev/null
+++ b/app/Census/CensusOfCanada1901.php
@@ -0,0 +1,77 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
+ */
+
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Census;
+
+/**
+ * Definitions for a census
+ */
+class CensusOfCanada1901 extends CensusOfCanada implements CensusInterface
+{
+ /**
+ * When did this census occur.
+ *
+ * @return string
+ */
+ public function censusDate(): string
+ {
+ return '31 MAR 1901';
+ }
+
+ /**
+ * The columns of the census.
+ *
+ * @return CensusColumnInterface[]
+ */
+ public function columns(): array
+ {
+ return [
+ new CensusColumnFullName($this, 'Name', 'Name'),
+ new CensusColumnSexMF($this, 'Sex', 'Sex'),
+ new CensusColumnNull($this, 'Color', 'Colour'),
+ new CensusColumnRelationToHeadEnglish($this, 'Relation', 'Relationship to Head of Family'),
+ new CensusColumnConditionUs($this, 'S/M/W/D', 'Single, married, widowed or divorced'),
+ new CensusColumnBirthMonthDay($this, 'M/D', 'Month and date of birth'),
+ new CensusColumnBirthYear($this, 'Year', 'Year of birth'),
+ new CensusColumnAge($this, 'Age', 'Age at last birthday'),
+ new CensusColumnBirthPlaceSimple($this, 'Birth Loc', 'Country or Place of Birth, plus Rural or Urban'),
+ new CensusColumnNull($this, 'Origin', 'Racial or Tribal origin'),
+ new CensusColumnNationality($this, 'Nationality', 'Nationality'),
+ new CensusColumnNull($this, 'Religion', 'Religion'),
+ new CensusColumnOccupation($this, 'Occupation', 'Profession, Occupation or Trade'),
+ new CensusColumnNull($this, 'Retired', 'Living on own means'),
+ new CensusColumnNull($this, 'Employer', 'Employer'),
+ new CensusColumnNull($this, 'Employee', 'Employee'),
+ new CensusColumnNull($this, 'Work on own', 'Working on own account'),
+ new CensusColumnNull($this, 'Trade', 'Working at trade in factory or home'),
+ new CensusColumnNull($this, 'Ms Fac', 'Months employed at trade in factory'),
+ new CensusColumnNull($this, 'Ms Home', 'Months employed at trade in home'),
+ new CensusColumnNull($this, 'Ms Other', 'Months employed in other than trade in factory or home'),
+ new CensusColumnNull($this, 'Earnings', 'Earnings from occupation or trade $'),
+ new CensusColumnNull($this, 'Extra Earn', 'Extra earnings (from other than occupation or trade) $'),
+ new CensusColumnNull($this, 'Edu Month', 'Months at school in year'),
+ new CensusColumnNull($this, 'Read', 'Can Read'),
+ new CensusColumnNull($this, 'Write', 'Can Write'),
+ new CensusColumnNull($this, 'English', 'Speaks English'),
+ new CensusColumnNull($this, 'French', 'Speaks French'),
+ new CensusColumnNull($this, 'Mother toungue', 'Mother toungue'),
+ new CensusColumnNull($this, 'Infirmities', 'Infirmities - a. Deaf and dumb, b. Blind, c. Unsound mind'),
+ ];
+ }
+}
diff --git a/tests/app/Census/CensusOfCanada1881Test.php b/tests/app/Census/CensusOfCanada1881Test.php
new file mode 100644
index 0000000000..ddadfaa7be
--- /dev/null
+++ b/tests/app/Census/CensusOfCanada1881Test.php
@@ -0,0 +1,103 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
+ */
+
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Census;
+
+use Fisharebest\Webtrees\TestCase;
+
+/**
+ * Test harness for the class CensusOfCanada1881
+ */
+class CensusOfCanada1881Test extends TestCase
+{
+ /**
+ * Test the census place and date
+ *
+ * @covers \Fisharebest\Webtrees\Census\CensusOfCanada1881
+ *
+ * @return void
+ */
+ public function testPlaceAndDate(): void
+ {
+ $census = new CensusOfCanada1881();
+
+ self::assertSame('Canada', $census->censusPlace());
+ self::assertSame('04 APR 1881', $census->censusDate());
+ }
+
+ /**
+ * Test the census columns
+ *
+ * @covers \Fisharebest\Webtrees\Census\CensusOfCanada1881
+ * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
+ *
+ * @return void
+ */
+ public function testColumns(): void
+ {
+ $census = new CensusOfCanada1881();
+ $columns = $census->columns();
+
+ self::assertCount(14, $columns);
+ self::assertInstanceOf(CensusColumnFullName::class, $columns[0]);
+ self::assertInstanceOf(CensusColumnSexMF::class, $columns[1]);
+ self::assertInstanceOf(CensusColumnAge::class, $columns[2]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[3]);
+ self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[4]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[5]);
+ self::assertInstanceOf(CensusColumnNationality::class, $columns[6]);
+ self::assertInstanceOf(CensusColumnOccupation::class, $columns[7]);
+ self::assertInstanceOf(CensusColumnConditionUs::class, $columns[8]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[9]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[10]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[11]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[12]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[13]);
+
+ self::assertSame('Name', $columns[0]->abbreviation());
+ self::assertSame('Sex', $columns[1]->abbreviation());
+ self::assertSame('Age', $columns[2]->abbreviation());
+ self::assertSame('Born', $columns[3]->abbreviation());
+ self::assertSame('Birth Loc', $columns[4]->abbreviation());
+ self::assertSame('Religion', $columns[5]->abbreviation());
+ self::assertSame('Origin', $columns[6]->abbreviation());
+ self::assertSame('Occupation', $columns[7]->abbreviation());
+ self::assertSame('M/W', $columns[8]->abbreviation());
+ self::assertSame('School', $columns[9]->abbreviation());
+ self::assertSame('Deaf', $columns[10]->abbreviation());
+ self::assertSame('Blind', $columns[11]->abbreviation());
+ self::assertSame('Unsound', $columns[12]->abbreviation());
+ self::assertSame('Date', $columns[13]->abbreviation());
+
+ self::assertSame('Name', $columns[0]->title());
+ self::assertSame('Sex', $columns[1]->title());
+ self::assertSame('Age at last birthday', $columns[2]->title());
+ self::assertSame('Born within last twelve months', $columns[3]->title());
+ self::assertSame('Country or Province of Birth', $columns[4]->title());
+ self::assertSame('Religion', $columns[5]->title());
+ self::assertSame('Origin', $columns[6]->title());
+ self::assertSame('Profession, Occupation, or Trade', $columns[7]->title());
+ self::assertSame('Married or Widowed', $columns[8]->title());
+ self::assertSame('Instruction - Going to School', $columns[9]->title());
+ self::assertSame('Infirmities - Deaf and Dumb', $columns[10]->title());
+ self::assertSame('Infirmities - Blind', $columns[11]->title());
+ self::assertSame('Infirmities - Unsound Mind', $columns[12]->title());
+ self::assertSame('Dates of Operations and Remarks', $columns[13]->title());
+ }
+}
diff --git a/tests/app/Census/CensusOfCanada1891Test.php b/tests/app/Census/CensusOfCanada1891Test.php
new file mode 100644
index 0000000000..2a87a68fe2
--- /dev/null
+++ b/tests/app/Census/CensusOfCanada1891Test.php
@@ -0,0 +1,121 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
+ */
+
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Census;
+
+use Fisharebest\Webtrees\TestCase;
+
+/**
+ * Test harness for the class CensusOfCanada1891
+ */
+class CensusOfCanada1891Test extends TestCase
+{
+ /**
+ * Test the census place and date
+ *
+ * @covers \Fisharebest\Webtrees\Census\CensusOfCanada1891
+ *
+ * @return void
+ */
+ public function testPlaceAndDate(): void
+ {
+ $census = new CensusOfCanada1891();
+
+ self::assertSame('Canada', $census->censusPlace());
+ self::assertSame('06 APR 1891', $census->censusDate());
+ }
+
+ /**
+ * Test the census columns
+ *
+ * @covers \Fisharebest\Webtrees\Census\CensusOfCanada1891
+ * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
+ *
+ * @return void
+ */
+ public function testColumns(): void
+ {
+ $census = new CensusOfCanada1891();
+ $columns = $census->columns();
+
+ self::assertCount(20, $columns);
+ self::assertInstanceOf(CensusColumnFullName::class, $columns[0]);
+ self::assertInstanceOf(CensusColumnSexMF::class, $columns[1]);
+ self::assertInstanceOf(CensusColumnAge::class, $columns[2]);
+ self::assertInstanceOf(CensusColumnConditionUs::class, $columns[3]);
+ self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[4]);
+ self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[5]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[6]);
+ self::assertInstanceOf(CensusColumnFatherBirthPlaceSimple::class, $columns[7]);
+ self::assertInstanceOf(CensusColumnMotherBirthPlaceSimple::class, $columns[8]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[9]);
+ self::assertInstanceOf(CensusColumnOccupation::class, $columns[10]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[11]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[12]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[13]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[14]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[15]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[16]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[17]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[18]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[19]);
+
+ self::assertSame('Name', $columns[0]->abbreviation());
+ self::assertSame('Sex', $columns[1]->abbreviation());
+ self::assertSame('Age', $columns[2]->abbreviation());
+ self::assertSame('M/W', $columns[3]->abbreviation());
+ self::assertSame('Relation', $columns[4]->abbreviation());
+ self::assertSame('Birth Loc', $columns[5]->abbreviation());
+ self::assertSame('French', $columns[6]->abbreviation());
+ self::assertSame('FBP', $columns[7]->abbreviation());
+ self::assertSame('MBP', $columns[8]->abbreviation());
+ self::assertSame('Religion', $columns[9]->abbreviation());
+ self::assertSame('Occupation', $columns[10]->abbreviation());
+ self::assertSame('Employers', $columns[11]->abbreviation());
+ self::assertSame('Earner', $columns[12]->abbreviation());
+ self::assertSame('UnEmp', $columns[13]->abbreviation());
+ self::assertSame('AvgEmp', $columns[14]->abbreviation());
+ self::assertSame('Read', $columns[15]->abbreviation());
+ self::assertSame('Write', $columns[16]->abbreviation());
+ self::assertSame('Deaf', $columns[17]->abbreviation());
+ self::assertSame('Blind', $columns[18]->abbreviation());
+ self::assertSame('Unsound', $columns[19]->abbreviation());
+
+ self::assertSame('Name', $columns[0]->title());
+ self::assertSame('Sex', $columns[1]->title());
+ self::assertSame('Age at last birthday', $columns[2]->title());
+ self::assertSame('Married or Widowed', $columns[3]->title());
+ self::assertSame('Relationship to Head of Family', $columns[4]->title());
+ self::assertSame('Country or Province of Birth', $columns[5]->title());
+ self::assertSame('French Canadians', $columns[6]->title());
+ self::assertSame('Place of birth of father', $columns[7]->title());
+ self::assertSame('Place of birth of mother', $columns[8]->title());
+ self::assertSame('Religion', $columns[9]->title());
+ self::assertSame('Profession, Occupation, or Trade', $columns[10]->title());
+ self::assertSame('Employers', $columns[11]->title());
+ self::assertSame('Wage Earner', $columns[12]->title());
+ self::assertSame('Unemployed during week preceeding Census', $columns[13]->title());
+ self::assertSame('Employer to state average number of hands employed during year', $columns[14]->title());
+ self::assertSame('Instruction - Read', $columns[15]->title());
+ self::assertSame('Instruction - Write', $columns[16]->title());
+ self::assertSame('Infirmities - Deaf and Dumb', $columns[17]->title());
+ self::assertSame('Infirmities - Blind', $columns[18]->title());
+ self::assertSame('Infirmities - Unsound Mind', $columns[19]->title());
+ }
+}
diff --git a/tests/app/Census/CensusOfCanada1901Test.php b/tests/app/Census/CensusOfCanada1901Test.php
new file mode 100644
index 0000000000..32e968d6d1
--- /dev/null
+++ b/tests/app/Census/CensusOfCanada1901Test.php
@@ -0,0 +1,151 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
+ */
+
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Census;
+
+use Fisharebest\Webtrees\TestCase;
+
+/**
+ * Test harness for the class CensusOfCanada1901
+ */
+class CensusOfCanada1901Test extends TestCase
+{
+ /**
+ * Test the census place and date
+ *
+ * @covers \Fisharebest\Webtrees\Census\CensusOfCanada1901
+ *
+ * @return void
+ */
+ public function testPlaceAndDate(): void
+ {
+ $census = new CensusOfCanada1901();
+
+ self::assertSame('Canada', $census->censusPlace());
+ self::assertSame('31 MAR 1901', $census->censusDate());
+ }
+
+ /**
+ * Test the census columns
+ *
+ * @covers \Fisharebest\Webtrees\Census\CensusOfCanada1901
+ * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
+ *
+ * @return void
+ */
+ public function testColumns(): void
+ {
+ $census = new CensusOfCanada1901();
+ $columns = $census->columns();
+
+ self::assertCount(30, $columns);
+ self::assertInstanceOf(CensusColumnFullName::class, $columns[0]);
+ self::assertInstanceOf(CensusColumnSexMF::class, $columns[1]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[2]);
+ self::assertInstanceOf(CensusColumnRelationToHeadEnglish::class, $columns[3]);
+ self::assertInstanceOf(CensusColumnConditionUs::class, $columns[4]);
+ self::assertInstanceOf(CensusColumnBirthMonthDay::class, $columns[5]);
+ self::assertInstanceOf(CensusColumnBirthYear::class, $columns[6]);
+ self::assertInstanceOf(CensusColumnAge::class, $columns[7]);
+ self::assertInstanceOf(CensusColumnBirthPlaceSimple::class, $columns[8]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[9]);
+ self::assertInstanceOf(CensusColumnNationality::class, $columns[10]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[11]);
+ self::assertInstanceOf(CensusColumnOccupation::class, $columns[12]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[13]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[14]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[15]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[16]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[17]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[18]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[19]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[20]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[21]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[22]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[23]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[24]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[25]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[26]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[27]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[28]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[29]);
+
+ self::assertSame('Name', $columns[0]->abbreviation());
+ self::assertSame('Sex', $columns[1]->abbreviation());
+ self::assertSame('Color', $columns[2]->abbreviation());
+ self::assertSame('Relation', $columns[3]->abbreviation());
+ self::assertSame('S/M/W/D', $columns[4]->abbreviation());
+ self::assertSame('M/D', $columns[5]->abbreviation());
+ self::assertSame('Year', $columns[6]->abbreviation());
+ self::assertSame('Age', $columns[7]->abbreviation());
+ self::assertSame('Birth Loc', $columns[8]->abbreviation());
+ self::assertSame('Origin', $columns[9]->abbreviation());
+ self::assertSame('Nationality', $columns[10]->abbreviation());
+ self::assertSame('Religion', $columns[11]->abbreviation());
+ self::assertSame('Occupation', $columns[12]->abbreviation());
+ self::assertSame('Retired', $columns[13]->abbreviation());
+ self::assertSame('Employer', $columns[14]->abbreviation());
+ self::assertSame('Employee', $columns[15]->abbreviation());
+ self::assertSame('Work on own', $columns[16]->abbreviation());
+ self::assertSame('Trade', $columns[17]->abbreviation());
+ self::assertSame('Ms Fac', $columns[18]->abbreviation());
+ self::assertSame('Ms Home', $columns[19]->abbreviation());
+ self::assertSame('Ms Other', $columns[20]->abbreviation());
+ self::assertSame('Earnings', $columns[21]->abbreviation());
+ self::assertSame('Extra Earn', $columns[22]->abbreviation());
+ self::assertSame('Edu Month', $columns[23]->abbreviation());
+ self::assertSame('Read', $columns[24]->abbreviation());
+ self::assertSame('Write', $columns[25]->abbreviation());
+ self::assertSame('English', $columns[26]->abbreviation());
+ self::assertSame('French', $columns[27]->abbreviation());
+ self::assertSame('Mother toungue', $columns[28]->abbreviation());
+ self::assertSame('Infirmities', $columns[29]->abbreviation());
+
+ self::assertSame('Name', $columns[0]->title());
+ self::assertSame('Sex', $columns[1]->title());
+ self::assertSame('Colour', $columns[2]->title());
+ self::assertSame('Relationship to Head of Family', $columns[3]->title());
+ self::assertSame('Single, married, widowed or divorced', $columns[4]->title());
+ self::assertSame('Month and date of birth', $columns[5]->title());
+ self::assertSame('Year of birth', $columns[6]->title());
+ self::assertSame('Age at last birthday', $columns[7]->title());
+ self::assertSame('Country or Place of Birth, plus Rural or Urban', $columns[8]->title());
+ self::assertSame('Racial or Tribal origin', $columns[9]->title());
+ self::assertSame('Nationality', $columns[10]->title());
+ self::assertSame('Religion', $columns[11]->title());
+ self::assertSame('Profession, Occupation or Trade', $columns[12]->title());
+ self::assertSame('Living on own means', $columns[13]->title());
+ self::assertSame('Employer', $columns[14]->title());
+ self::assertSame('Employee', $columns[15]->title());
+ self::assertSame('Working on own account', $columns[16]->title());
+ self::assertSame('Working at trade in factory or home', $columns[17]->title());
+ self::assertSame('Months employed at trade in factory', $columns[18]->title());
+ self::assertSame('Months employed at trade in home', $columns[19]->title());
+ self::assertSame('Months employed in other than trade in factory or home', $columns[20]->title());
+ self::assertSame('Earnings from occupation or trade $', $columns[21]->title());
+ self::assertSame('Extra earnings (from other than occupation or trade) $', $columns[22]->title());
+ self::assertSame('Months at school in year', $columns[23]->title());
+ self::assertSame('Can Read', $columns[24]->title());
+ self::assertSame('Can Write', $columns[25]->title());
+ self::assertSame('Speaks English', $columns[26]->title());
+ self::assertSame('Speaks French', $columns[27]->title());
+ self::assertSame('Mother toungue', $columns[28]->title());
+ self::assertSame('Infirmities - a. Deaf and dumb, b. Blind, c. Unsound mind', $columns[29]->title());
+ }
+}
diff --git a/tests/app/Census/CensusTest.php b/tests/app/Census/CensusTest.php
index 010e2ba182..8c2eb08661 100644
--- a/tests/app/Census/CensusTest.php
+++ b/tests/app/Census/CensusTest.php
@@ -35,7 +35,7 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('cs');
- self::assertCount(9, $censuses);
+ self::assertCount(10, $censuses);
self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[0]);
self::assertInstanceOf(CensusOfSlovakia::class, $censuses[1]);
self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
@@ -45,6 +45,7 @@ class CensusTest extends TestCase
self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
}
/**
@@ -56,7 +57,7 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('da');
- self::assertCount(9, $censuses);
+ self::assertCount(10, $censuses);
self::assertInstanceOf(CensusOfDenmark::class, $censuses[0]);
self::assertInstanceOf(CensusOfDeutschland::class, $censuses[1]);
self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
@@ -66,6 +67,7 @@ class CensusTest extends TestCase
self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
}
/**
@@ -86,6 +88,7 @@ class CensusTest extends TestCase
self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
}
/**
@@ -97,16 +100,17 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('en-AU');
- self::assertCount(9, $censuses);
+ self::assertCount(10, $censuses);
self::assertInstanceOf(CensusOfEngland::class, $censuses[0]);
self::assertInstanceOf(CensusOfScotland::class, $censuses[1]);
self::assertInstanceOf(CensusOfWales::class, $censuses[2]);
- self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[3]);
- self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[4]);
- self::assertInstanceOf(CensusOfDenmark::class, $censuses[5]);
- self::assertInstanceOf(CensusOfDeutschland::class, $censuses[6]);
- self::assertInstanceOf(CensusOfFrance::class, $censuses[7]);
- self::assertInstanceOf(CensusOfSlovakia::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[3]);
+ self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]);
+ self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[5]);
+ self::assertInstanceOf(CensusOfDenmark::class, $censuses[6]);
+ self::assertInstanceOf(CensusOfDeutschland::class, $censuses[7]);
+ self::assertInstanceOf(CensusOfFrance::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfSlovakia::class, $censuses[9]);
}
/**
@@ -118,16 +122,17 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('en-GB');
- self::assertCount(9, $censuses);
+ self::assertCount(10, $censuses);
self::assertInstanceOf(CensusOfEngland::class, $censuses[0]);
self::assertInstanceOf(CensusOfScotland::class, $censuses[1]);
self::assertInstanceOf(CensusOfWales::class, $censuses[2]);
- self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[3]);
- self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[4]);
- self::assertInstanceOf(CensusOfDenmark::class, $censuses[5]);
- self::assertInstanceOf(CensusOfDeutschland::class, $censuses[6]);
- self::assertInstanceOf(CensusOfFrance::class, $censuses[7]);
- self::assertInstanceOf(CensusOfSlovakia::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[3]);
+ self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[4]);
+ self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[5]);
+ self::assertInstanceOf(CensusOfDenmark::class, $censuses[6]);
+ self::assertInstanceOf(CensusOfDeutschland::class, $censuses[7]);
+ self::assertInstanceOf(CensusOfFrance::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfSlovakia::class, $censuses[9]);
}
/**
@@ -139,16 +144,17 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('en-US');
- self::assertCount(9, $censuses);
+ self::assertCount(10, $censuses);
self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]);
- self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
- self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
- self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]);
- self::assertInstanceOf(CensusOfEngland::class, $censuses[4]);
- self::assertInstanceOf(CensusOfFrance::class, $censuses[5]);
- self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
- self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
- self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[1]);
+ self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
+ self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
+ self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
+ self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
+ self::assertInstanceOf(CensusOfFrance::class, $censuses[6]);
+ self::assertInstanceOf(CensusOfScotland::class, $censuses[7]);
+ self::assertInstanceOf(CensusOfSlovakia::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
}
/**
@@ -160,16 +166,17 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('fr');
- self::assertCount(9, $censuses);
+ self::assertCount(10, $censuses);
self::assertInstanceOf(CensusOfFrance::class, $censuses[0]);
- self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
- self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
- self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]);
- self::assertInstanceOf(CensusOfEngland::class, $censuses[4]);
- self::assertInstanceOf(CensusOfScotland::class, $censuses[5]);
- self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
- self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
- self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[1]);
+ self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
+ self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
+ self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
+ self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
+ self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
+ self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
+ self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
}
/**
@@ -181,16 +188,17 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('fr-CA');
- self::assertCount(9, $censuses);
- self::assertInstanceOf(CensusOfFrance::class, $censuses[0]);
- self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
- self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
- self::assertInstanceOf(CensusOfDeutschland::class, $censuses[3]);
- self::assertInstanceOf(CensusOfEngland::class, $censuses[4]);
- self::assertInstanceOf(CensusOfScotland::class, $censuses[5]);
- self::assertInstanceOf(CensusOfSlovakia::class, $censuses[6]);
- self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
- self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
+ self::assertCount(10, $censuses);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[0]);
+ self::assertInstanceOf(CensusOfFrance::class, $censuses[1]);
+ self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[2]);
+ self::assertInstanceOf(CensusOfDenmark::class, $censuses[3]);
+ self::assertInstanceOf(CensusOfDeutschland::class, $censuses[4]);
+ self::assertInstanceOf(CensusOfEngland::class, $censuses[5]);
+ self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
+ self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
+ self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfWales::class, $censuses[9]);
}
/**
@@ -202,7 +210,7 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('sk');
- self::assertCount(9, $censuses);
+ self::assertCount(10, $censuses);
self::assertInstanceOf(CensusOfSlovakia::class, $censuses[0]);
self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[1]);
self::assertInstanceOf(CensusOfDenmark::class, $censuses[2]);
@@ -212,6 +220,7 @@ class CensusTest extends TestCase
self::assertInstanceOf(CensusOfScotland::class, $censuses[6]);
self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[7]);
self::assertInstanceOf(CensusOfWales::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
}
/**
@@ -223,7 +232,7 @@ class CensusTest extends TestCase
{
$censuses = Census::censusPlaces('XX');
- self::assertCount(9, $censuses);
+ self::assertCount(10, $censuses);
self::assertInstanceOf(CensusOfUnitedStates::class, $censuses[0]);
self::assertInstanceOf(CensusOfEngland::class, $censuses[1]);
self::assertInstanceOf(CensusOfScotland::class, $censuses[2]);
@@ -233,5 +242,6 @@ class CensusTest extends TestCase
self::assertInstanceOf(CensusOfCzechRepublic::class, $censuses[6]);
self::assertInstanceOf(CensusOfSlovakia::class, $censuses[7]);
self::assertInstanceOf(CensusOfDenmark::class, $censuses[8]);
+ self::assertInstanceOf(CensusOfCanada::class, $censuses[9]);
}
}