From d3fc2f7aa310e5c9d8a3462e97e2f165cc9ec2f9 Mon Sep 17 00:00:00 2001 From: David Drury Date: Mon, 5 Apr 2021 13:28:20 +0100 Subject: Add missing 1939 register for Scotland (#3744) * Add missing 1939 register * Update RegisterOfScotland1939Test.php --- tests/app/Census/CensusOfScotlandTest.php | 3 +- tests/app/Census/RegisterOfScotland1939Test.php | 85 +++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 tests/app/Census/RegisterOfScotland1939Test.php (limited to 'tests/app/Census') 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 @@ +. + */ + +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()); + } +} -- cgit v1.3