summaryrefslogtreecommitdiff
path: root/tests/app/Census
diff options
context:
space:
mode:
authorDavid Drury <ddrury@users.noreply.github.com>2021-04-05 13:28:20 +0100
committerGitHub <noreply@github.com>2021-04-05 13:28:20 +0100
commitd3fc2f7aa310e5c9d8a3462e97e2f165cc9ec2f9 (patch)
treeee637427d31b4e3c9fe9349030099b18f3fb1be3 /tests/app/Census
parent0c91cc18dcd43e42056534d5b32518c0f7783347 (diff)
downloadwebtrees-d3fc2f7aa310e5c9d8a3462e97e2f165cc9ec2f9.tar.gz
webtrees-d3fc2f7aa310e5c9d8a3462e97e2f165cc9ec2f9.tar.bz2
webtrees-d3fc2f7aa310e5c9d8a3462e97e2f165cc9ec2f9.zip
Add missing 1939 register for Scotland (#3744)
* Add missing 1939 register * Update RegisterOfScotland1939Test.php
Diffstat (limited to 'tests/app/Census')
-rw-r--r--tests/app/Census/CensusOfScotlandTest.php3
-rw-r--r--tests/app/Census/RegisterOfScotland1939Test.php85
2 files changed, 87 insertions, 1 deletions
diff --git a/tests/app/Census/CensusOfScotlandTest.php b/tests/app/Census/CensusOfScotlandTest.php
index 2e2a19bc51..e420ec85e6 100644
--- a/tests/app/Census/CensusOfScotlandTest.php
+++ b/tests/app/Census/CensusOfScotlandTest.php
@@ -67,7 +67,7 @@ class CensusOfScotlandTest extends TestCase
$census_dates = $census->allCensusDates();
- self::assertCount(8, $census_dates);
+ self::assertCount(9, $census_dates);
self::assertInstanceOf(CensusOfScotland1841::class, $census_dates[0]);
self::assertInstanceOf(CensusOfScotland1851::class, $census_dates[1]);
self::assertInstanceOf(CensusOfScotland1861::class, $census_dates[2]);
@@ -76,5 +76,6 @@ class CensusOfScotlandTest extends TestCase
self::assertInstanceOf(CensusOfScotland1891::class, $census_dates[5]);
self::assertInstanceOf(CensusOfScotland1901::class, $census_dates[6]);
self::assertInstanceOf(CensusOfScotland1911::class, $census_dates[7]);
+ self::assertInstanceOf(RegisterOfScotland1939::class, $census_dates[8]);
}
}
diff --git a/tests/app/Census/RegisterOfScotland1939Test.php b/tests/app/Census/RegisterOfScotland1939Test.php
new file mode 100644
index 0000000000..bcbc52fc17
--- /dev/null
+++ b/tests/app/Census/RegisterOfScotland1939Test.php
@@ -0,0 +1,85 @@
+<?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 RegisterOfScotland1939
+ */
+class RegisterOfScotland1939Test extends TestCase
+{
+ /**
+ * Test the census place and date
+ *
+ * @covers \Fisharebest\Webtrees\Census\RegisterOfScotland1939
+ *
+ * @return void
+ */
+ public function testPlaceAndDate(): void
+ {
+ $census = new RegisterOfScotland1939();
+
+ self::assertSame('Scotland', $census->censusPlace());
+ self::assertSame('29 SEP 1939', $census->censusDate());
+ }
+
+ /**
+ * Test the census columns
+ *
+ * @covers \Fisharebest\Webtrees\Census\RegisterOfScotland1939
+ * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
+ *
+ * @return void
+ */
+ public function testColumns(): void
+ {
+ $census = new RegisterOfScotland1939();
+ $columns = $census->columns();
+
+ self::assertCount(8, $columns);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[0]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[1]);
+ self::assertInstanceOf(CensusColumnSurnameGivenNames::class, $columns[2]);
+ self::assertInstanceOf(CensusColumnNull::class, $columns[3]);
+ self::assertInstanceOf(CensusColumnSexMF::class, $columns[4]);
+ self::assertInstanceOf(CensusColumnBirthDayMonthYear::class, $columns[5]);
+ self::assertInstanceOf(CensusColumnConditionEnglish::class, $columns[6]);
+ self::assertInstanceOf(CensusColumnOccupation::class, $columns[7]);
+
+ self::assertSame('Schedule', $columns[0]->abbreviation());
+ self::assertSame('SubNum', $columns[1]->abbreviation());
+ self::assertSame('Name', $columns[2]->abbreviation());
+ self::assertSame('Role', $columns[3]->abbreviation());
+ self::assertSame('Sex', $columns[4]->abbreviation());
+ self::assertSame('DOB', $columns[5]->abbreviation());
+ self::assertSame('MC', $columns[6]->abbreviation());
+ self::assertSame('Occupation', $columns[7]->abbreviation());
+
+ self::assertSame('Schedule Number', $columns[0]->title());
+ self::assertSame('Schedule Sub Number', $columns[1]->title());
+ self::assertSame('Surname & other names', $columns[2]->title());
+ self::assertSame('For institutions only – for example, Officer, Visitor, Servant, Patient, Inmate', $columns[3]->title());
+ self::assertSame('Male or Female', $columns[4]->title());
+ self::assertSame('Date of birth', $columns[5]->title());
+ self::assertSame('Marital Condition - Married, Single, Unmarried, Widowed or Divorced', $columns[6]->title());
+ self::assertSame('Occupation', $columns[7]->title());
+ }
+}