summaryrefslogtreecommitdiff
path: root/tests/app/Census
diff options
context:
space:
mode:
authorDavid Drury <david@drury.me.uk>2016-02-16 20:56:15 +0000
committerDavid Drury <david@drury.me.uk>2016-02-19 11:35:36 +0000
commit5df8e840e0784ad1e5ac0c4b53c57a60d5ab5b6d (patch)
treeaf57f185114f521f77857c32c43acac51648f87d /tests/app/Census
parent0091ab5334846323eda386ac4e2d3ba3f3f87681 (diff)
downloadwebtrees-5df8e840e0784ad1e5ac0c4b53c57a60d5ab5b6d.tar.gz
webtrees-5df8e840e0784ad1e5ac0c4b53c57a60d5ab5b6d.tar.bz2
webtrees-5df8e840e0784ad1e5ac0c4b53c57a60d5ab5b6d.zip
Added UK 1939 Register as Census
Removed Address from column list - not necessary per person as it can be added in the header place field Added Test Cases Remove duplicated class & test case Fixed case problems and added two more test cases Renamed class for consistency Comment refers to wrong class
Diffstat (limited to 'tests/app/Census')
-rw-r--r--tests/app/Census/CensusColumnBirthDayMonthSlashYearTest.php57
-rw-r--r--tests/app/Census/CensusOfEnglandTest.php3
-rw-r--r--tests/app/Census/CensusOfWalesTest.php3
-rw-r--r--tests/app/Census/RegisterOfEngland1939Test.php73
-rw-r--r--tests/app/Census/RegisterOfWales1939Test.php73
5 files changed, 207 insertions, 2 deletions
diff --git a/tests/app/Census/CensusColumnBirthDayMonthSlashYearTest.php b/tests/app/Census/CensusColumnBirthDayMonthSlashYearTest.php
new file mode 100644
index 0000000000..5bb2012303
--- /dev/null
+++ b/tests/app/Census/CensusColumnBirthDayMonthSlashYearTest.php
@@ -0,0 +1,57 @@
+<?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;
+use Mockery;
+
+/**
+ * Test harness for the class CensusColumnBirthDayMonthSlashYearTest
+ */
+class CensusColumnBirthDayMonthSlashYearTest extends \PHPUnit_Framework_TestCase {
+ /**
+ * Delete mock objects
+ */
+ public function tearDown() {
+ Mockery::close();
+ }
+
+ /**
+ * @covers Fisharebest\Webtrees\Census\CensusColumnBirthDayMonthSlashYearTest
+ * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
+ */
+ public function testGenerateColumn() {
+ $cal_date = Mockery::mock('Fisharebest\Webtrees\Date\CalendarDate');
+ $cal_date->shouldReceive('format')->andReturn('30 Jun/1832');
+
+ $date = Mockery::mock('Fisharebest\Webtrees\Date');
+ $date->shouldReceive('minimumJulianDay')->andReturn($cal_date);
+ $date->shouldReceive('maximumJulianDay')->andReturn($cal_date);
+ $date->shouldReceive('minimumDate')->andReturn($cal_date);
+
+ $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
+ $individual->shouldReceive('getBirthDate')->andReturn($date);
+
+ $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
+ $census->shouldReceive('censusDate')->andReturn('30 JUN 1832');
+
+ $column = new CensusColumnBirthDayMonthSlashYear($census, '', '');
+
+ $this->assertSame('30 Jun/1832', $column->generate($individual));
+ }
+}
diff --git a/tests/app/Census/CensusOfEnglandTest.php b/tests/app/Census/CensusOfEnglandTest.php
index 5205bce062..e9744df275 100644
--- a/tests/app/Census/CensusOfEnglandTest.php
+++ b/tests/app/Census/CensusOfEnglandTest.php
@@ -41,7 +41,7 @@ class CensusOfEnglandTest extends \PHPUnit_Framework_TestCase {
$census_dates = $census->allCensusDates();
- $this->assertCount(8, $census_dates);
+ $this->assertCount(9, $census_dates);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfEngland1841', $census_dates[0]);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfEngland1851', $census_dates[1]);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfEngland1861', $census_dates[2]);
@@ -50,5 +50,6 @@ class CensusOfEnglandTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfEngland1891', $census_dates[5]);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfEngland1901', $census_dates[6]);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfEngland1911', $census_dates[7]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\RegisterOfEngland1939', $census_dates[8]);
}
}
diff --git a/tests/app/Census/CensusOfWalesTest.php b/tests/app/Census/CensusOfWalesTest.php
index d4b11ce15c..04fbc27840 100644
--- a/tests/app/Census/CensusOfWalesTest.php
+++ b/tests/app/Census/CensusOfWalesTest.php
@@ -41,7 +41,7 @@ class CensusOfWalesTest extends \PHPUnit_Framework_TestCase {
$census_dates = $census->allCensusDates();
- $this->assertCount(8, $census_dates);
+ $this->assertCount(9, $census_dates);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfWales1841', $census_dates[0]);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfWales1851', $census_dates[1]);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfWales1861', $census_dates[2]);
@@ -50,5 +50,6 @@ class CensusOfWalesTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfWales1891', $census_dates[5]);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfWales1901', $census_dates[6]);
$this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfWales1911', $census_dates[7]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\RegisterOfWales1939', $census_dates[8]);
}
}
diff --git a/tests/app/Census/RegisterOfEngland1939Test.php b/tests/app/Census/RegisterOfEngland1939Test.php
new file mode 100644
index 0000000000..7c92e0a341
--- /dev/null
+++ b/tests/app/Census/RegisterOfEngland1939Test.php
@@ -0,0 +1,73 @@
+<?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 RegisterOfEngland1939
+ */
+class RegisterOfEngland1939Test extends \PHPUnit_Framework_TestCase {
+ /**
+ * Test the census place and date
+ *
+ * @covers Fisharebest\Webtrees\Census\RegisterOfEngland1939
+ */
+ public function testPlaceAndDate() {
+ $census = new RegisterOfEngland1939;
+
+ $this->assertSame('England', $census->censusPlace());
+ $this->assertSame('29 SEP 1939', $census->censusDate());
+ }
+
+ /**
+ * Test the census columns
+ *
+ * @covers Fisharebest\Webtrees\Census\RegisterOfEngland1939
+ * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
+ */
+ public function testColumns() {
+ $census = new RegisterOfEngland1939;
+ $columns = $census->columns();
+
+ $this->assertCount(8, $columns);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[0]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[1]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNames', $columns[2]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[4]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthDayMonthSlashYear', $columns[5]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionEnglish', $columns[6]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[7]);
+
+ $this->assertSame('Schedule', $columns[0]->abbreviation());
+ $this->assertSame('SubNum', $columns[1]->abbreviation());
+ $this->assertSame('Name', $columns[2]->abbreviation());
+ $this->assertSame('Role', $columns[3]->abbreviation());
+ $this->assertSame('Gender', $columns[4]->abbreviation());
+ $this->assertSame('DoB', $columns[5]->abbreviation());
+ $this->assertSame('Marr Status', $columns[6]->abbreviation());
+ $this->assertSame('Occupation', $columns[7]->abbreviation());
+
+ $this->assertSame('Schedule Number', $columns[0]->title());
+ $this->assertSame('Schedule Sub Number', $columns[1]->title());
+ $this->assertSame('Surname & other names', $columns[2]->title());
+ $this->assertSame('Officer, Visitor, Servant, Patient, Inmate', $columns[3]->title());
+ $this->assertSame('Male or Female', $columns[4]->title());
+ $this->assertSame('Date of birth', $columns[5]->title());
+ $this->assertSame('Single, Married, Widowed or Divorced', $columns[6]->title());
+ $this->assertSame('Occupation', $columns[7]->title());
+ }
+}
diff --git a/tests/app/Census/RegisterOfWales1939Test.php b/tests/app/Census/RegisterOfWales1939Test.php
new file mode 100644
index 0000000000..6a64911bc6
--- /dev/null
+++ b/tests/app/Census/RegisterOfWales1939Test.php
@@ -0,0 +1,73 @@
+<?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 RegisterOfWales1939
+ */
+class RegisterOfWales1939Test extends \PHPUnit_Framework_TestCase {
+ /**
+ * Test the census place and date
+ *
+ * @covers Fisharebest\Webtrees\Census\RegisterOfWales1939
+ */
+ public function testPlaceAndDate() {
+ $census = new RegisterOfWales1939;
+
+ $this->assertSame('Wales', $census->censusPlace());
+ $this->assertSame('29 SEP 1939', $census->censusDate());
+ }
+
+ /**
+ * Test the census columns
+ *
+ * @covers Fisharebest\Webtrees\Census\RegisterOfWales1939
+ * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
+ */
+ public function testColumns() {
+ $census = new RegisterOfWales1939;
+ $columns = $census->columns();
+
+ $this->assertCount(8, $columns);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[0]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[1]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNames', $columns[2]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMF', $columns[4]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthDayMonthSlashYear', $columns[5]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnConditionEnglish', $columns[6]);
+ $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnOccupation', $columns[7]);
+
+ $this->assertSame('Schedule', $columns[0]->abbreviation());
+ $this->assertSame('SubNum', $columns[1]->abbreviation());
+ $this->assertSame('Name', $columns[2]->abbreviation());
+ $this->assertSame('Role', $columns[3]->abbreviation());
+ $this->assertSame('Gender', $columns[4]->abbreviation());
+ $this->assertSame('DoB', $columns[5]->abbreviation());
+ $this->assertSame('Marr Status', $columns[6]->abbreviation());
+ $this->assertSame('Occupation', $columns[7]->abbreviation());
+
+ $this->assertSame('Schedule Number', $columns[0]->title());
+ $this->assertSame('Schedule Sub Number', $columns[1]->title());
+ $this->assertSame('Surname & other names', $columns[2]->title());
+ $this->assertSame('Officer, Visitor, Servant, Patient, Inmate', $columns[3]->title());
+ $this->assertSame('Male or Female', $columns[4]->title());
+ $this->assertSame('Date of birth', $columns[5]->title());
+ $this->assertSame('Single, Married, Widowed or Divorced', $columns[6]->title());
+ $this->assertSame('Occupation', $columns[7]->title());
+ }
+} \ No newline at end of file