diff options
| author | Greg Roach <fisharebest@gmail.com> | 2016-01-13 11:19:15 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2016-01-13 11:19:15 +0000 |
| commit | c2a8c8bf7de8a39f75d5bc4f1074a75217deff5f (patch) | |
| tree | d780800ada29bde52f35bc95609b0e7410fd2e29 | |
| parent | e00de0345de6d2aa88617d8a1ec63a06afbf9a02 (diff) | |
| download | webtrees-c2a8c8bf7de8a39f75d5bc4f1074a75217deff5f.tar.gz webtrees-c2a8c8bf7de8a39f75d5bc4f1074a75217deff5f.tar.bz2 webtrees-c2a8c8bf7de8a39f75d5bc4f1074a75217deff5f.zip | |
Czech census definitions
| -rw-r--r-- | app/Census/Census.php | 1 | ||||
| -rw-r--r-- | app/Census/CensusColumnSexMZ.php | 42 | ||||
| -rw-r--r-- | app/Census/CensusOfCzechRepublic.php | 42 | ||||
| -rw-r--r-- | app/Census/CensusOfCzechRepublic1880.php | 54 | ||||
| -rw-r--r-- | app/Census/CensusOfCzechRepublic1921.php | 54 | ||||
| -rw-r--r-- | app/Functions/FunctionsEdit.php | 4 | ||||
| -rw-r--r-- | tests/app/Census/CensusColumnSexMZTest.php | 77 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfCzechRepublic1880Test.php | 91 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfCzechRepublic1921Test.php | 91 | ||||
| -rw-r--r-- | tests/app/Census/CensusOfCzechRepublicTest.php | 48 | ||||
| -rw-r--r-- | tests/app/Census/CensusTest.php | 15 |
11 files changed, 512 insertions, 7 deletions
diff --git a/app/Census/Census.php b/app/Census/Census.php index d06928e709..c1addff078 100644 --- a/app/Census/Census.php +++ b/app/Census/Census.php @@ -24,6 +24,7 @@ class Census { */ public static function allCensusPlaces() { return array( + new CensusOfCzechRepublic, new CensusOfDenmark, new CensusOfEngland, new CensusOfFrance, diff --git a/app/Census/CensusColumnSexMZ.php b/app/Census/CensusColumnSexMZ.php new file mode 100644 index 0000000000..57a68efea0 --- /dev/null +++ b/app/Census/CensusColumnSexMZ.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\Individual; + +/** + * The individual's sex. + */ +class CensusColumnSexMZ 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) { + switch ($individual->getSex()) { + case 'M': + return 'M'; + case 'F': + return 'Ž'; + default: + return ''; + } + } +} diff --git a/app/Census/CensusOfCzechRepublic.php b/app/Census/CensusOfCzechRepublic.php new file mode 100644 index 0000000000..7f46593799 --- /dev/null +++ b/app/Census/CensusOfCzechRepublic.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; + +/** + * Definitions for a census + */ +class CensusOfCzechRepublic extends Census implements CensusPlaceInterface { + /** + * All available censuses for this census place. + * + * @return CensusInterface[] + */ + public function allCensusDates() { + return array( + new CensusOfCzechRepublic1880(), + new CensusOfCzechRepublic1921(), + ); + } + + /** + * Where did this census occur, in GEDCOM format. + * + * @return string + */ + public function censusPlace() { + return 'Česko'; + } +} diff --git a/app/Census/CensusOfCzechRepublic1880.php b/app/Census/CensusOfCzechRepublic1880.php new file mode 100644 index 0000000000..f70ad17580 --- /dev/null +++ b/app/Census/CensusOfCzechRepublic1880.php @@ -0,0 +1,54 @@ +<?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 CensusOfCzechRepublic1880 extends CensusOfCzechRepublic implements CensusInterface { + /** + * When did this census occur. + * + * @return string + */ + public function censusDate() { + return '31 DEC 1880'; + } + + /** + * The columns of the census. + * + * @return CensusColumnInterface[] + */ + public function columns() { + return array( + new CensusColumnFullName($this, 'Jméno', ''), + new CensusColumnSexMZ($this, 'Pohlaví', ''), + new CensusColumnRelationToHead($this, 'Vztah', ''), + new CensusColumnBirthDaySlashMonthYear($this, 'Narození', 'Datum narození'), + new CensusColumnBirthPlace($this, 'Místo', 'Místo narození'), + new CensusColumnNull($this, 'Přísluší', 'Domovské právo'), + new CensusColumnReligion($this, 'Vyznání', ''), + new CensusColumnNull($this, 'Stav', 'Rodinný stav'), + new CensusColumnNull($this, 'Jazyk', 'Jazyk v obcování'), + new CensusColumnOccupation($this, 'Povolání', ''), + new CensusColumnNull($this, 'Postavení', 'Postavení v zaměstnání'), + new CensusColumnNull($this, '', ''), + new CensusColumnNull($this, '', ''), + new CensusColumnNull($this, '', ''), + ); + } +} diff --git a/app/Census/CensusOfCzechRepublic1921.php b/app/Census/CensusOfCzechRepublic1921.php new file mode 100644 index 0000000000..073d851d42 --- /dev/null +++ b/app/Census/CensusOfCzechRepublic1921.php @@ -0,0 +1,54 @@ +<?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 CensusOfCzechRepublic1921 extends CensusOfCzechRepublic implements CensusInterface { + /** + * When did this census occur. + * + * @return string + */ + public function censusDate() { + return '15 FEB 1921'; + } + + /** + * The columns of the census. + * + * @return CensusColumnInterface[] + */ + public function columns() { + return array( + new CensusColumnFullName($this, 'Jméno', ''), + new CensusColumnRelationToHead($this, 'Vztah', ''), + new CensusColumnSexMZ($this, 'Pohlaví', ''), + new CensusColumnNull($this, 'Stav', 'Rodinný stav'), + new CensusColumnBirthDaySlashMonthYear($this, 'Narození', 'Datum narození'), + new CensusColumnBirthPlace($this, 'Místo', 'Místo narození'), + new CensusColumnNull($this, 'Přísluší', 'Domovské právo'), + new CensusColumnNull($this, 'Jazyk', 'Jazyk v obcování'), + new CensusColumnReligion($this, 'Vyznání', ''), + new CensusColumnOccupation($this, 'Povolání', ''), + new CensusColumnNull($this, 'Postavení', 'Postavení v zaměstnání'), + new CensusColumnNull($this, '', ''), + new CensusColumnNull($this, '', ''), + new CensusColumnNull($this, '', ''), + ); + } +} diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php index 0f8b2915af..fed89783d8 100644 --- a/app/Functions/FunctionsEdit.php +++ b/app/Functions/FunctionsEdit.php @@ -17,6 +17,7 @@ namespace Fisharebest\Webtrees\Functions; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Census\Census; +use Fisharebest\Webtrees\Census\CensusOfCzechRepublic; use Fisharebest\Webtrees\Census\CensusOfDenmark; use Fisharebest\Webtrees\Census\CensusOfEngland; use Fisharebest\Webtrees\Census\CensusOfFrance; @@ -973,6 +974,9 @@ class FunctionsEdit { // Show more likely census details at the top of the list. switch (WT_LOCALE) { + case 'cs': + $census_places = array(new CensusOfCzechRepublic); + break; case 'en-AU': case 'en-GB': $census_places = array(new CensusOfEngland, new CensusOfWales, new CensusOfScotland); diff --git a/tests/app/Census/CensusColumnSexMZTest.php b/tests/app/Census/CensusColumnSexMZTest.php new file mode 100644 index 0000000000..2bb9f2ce08 --- /dev/null +++ b/tests/app/Census/CensusColumnSexMZTest.php @@ -0,0 +1,77 @@ +<?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\Individual; +use Mockery; + +/** + * Test harness for the class CensusColumnSexMZ + */ +class CensusColumnSexMZTest extends \PHPUnit_Framework_TestCase { + /** + * Delete mock objects + */ + public function tearDown() { + Mockery::close(); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnSexMZ + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testMale() { + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getSex')->andReturn('M'); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + + $column = new CensusColumnSexMZ($census, '', ''); + + $this->assertSame('M', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnSexMZ + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testFeale() { + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getSex')->andReturn('F'); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + + $column = new CensusColumnSexMZ($census, '', ''); + + $this->assertSame('Ž', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnSexMZ + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testUnknownSex() { + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getSex')->andReturn('U'); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + + $column = new CensusColumnSexMZ($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } +} diff --git a/tests/app/Census/CensusOfCzechRepublic1880Test.php b/tests/app/Census/CensusOfCzechRepublic1880Test.php new file mode 100644 index 0000000000..7b8895d374 --- /dev/null +++ b/tests/app/Census/CensusOfCzechRepublic1880Test.php @@ -0,0 +1,91 @@ +<?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; + +/** + * Test harness for the class CensusOfCzechRepublic1880 + */ +class CensusOfCzechRepublic1880Test extends \PHPUnit_Framework_TestCase { + /** + * Test the census place and date + * + * @covers Fisharebest\Webtrees\Census\CensusOfCzechRepublic1880 + */ + public function testPlaceAndDate() { + $census = new CensusOfCzechRepublic1880; + + $this->assertSame('Česko', $census->censusPlace()); + $this->assertSame('31 DEC 1880', $census->censusDate()); + } + + /** + * Test the census columns + * + * @covers Fisharebest\Webtrees\Census\CensusOfCzechRepublic1880 + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testColumns() { + $census = new CensusOfCzechRepublic1880; + $columns = $census->columns(); + + $this->assertCount(14, $columns); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFullName', $columns[0]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMZ', $columns[1]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnRelationToHead', $columns[2]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthDaySlashMonthYear', $columns[3]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthPlace', $columns[4]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[5]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnReligion', $columns[6]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[7]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $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]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[12]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[13]); + + $this->assertSame('Jméno', $columns[0]->abbreviation()); + $this->assertSame('Pohlaví', $columns[1]->abbreviation()); + $this->assertSame('Vztah', $columns[2]->abbreviation()); + $this->assertSame('Narození', $columns[3]->abbreviation()); + $this->assertSame('Místo', $columns[4]->abbreviation()); + $this->assertSame('Přísluší', $columns[5]->abbreviation()); + $this->assertSame('Vyznání', $columns[6]->abbreviation()); + $this->assertSame('Stav', $columns[7]->abbreviation()); + $this->assertSame('Jazyk', $columns[8]->abbreviation()); + $this->assertSame('Povolání', $columns[9]->abbreviation()); + $this->assertSame('Postavení', $columns[10]->abbreviation()); + $this->assertSame('', $columns[11]->abbreviation()); + $this->assertSame('', $columns[12]->abbreviation()); + $this->assertSame('', $columns[13]->abbreviation()); + + $this->assertSame('', $columns[0]->title()); + $this->assertSame('', $columns[1]->title()); + $this->assertSame('', $columns[2]->title()); + $this->assertSame('Datum narození', $columns[3]->title()); + $this->assertSame('Místo narození', $columns[4]->title()); + $this->assertSame('Domovské právo', $columns[5]->title()); + $this->assertSame('', $columns[6]->title()); + $this->assertSame('Rodinný stav', $columns[7]->title()); + $this->assertSame('Jazyk v obcování', $columns[8]->title()); + $this->assertSame('', $columns[9]->title()); + $this->assertSame('Postavení v zaměstnání', $columns[10]->title()); + $this->assertSame('', $columns[11]->title()); + $this->assertSame('', $columns[12]->title()); + $this->assertSame('', $columns[13]->title()); + } +} diff --git a/tests/app/Census/CensusOfCzechRepublic1921Test.php b/tests/app/Census/CensusOfCzechRepublic1921Test.php new file mode 100644 index 0000000000..7962fbd4a2 --- /dev/null +++ b/tests/app/Census/CensusOfCzechRepublic1921Test.php @@ -0,0 +1,91 @@ +<?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; + +/** + * Test harness for the class CensusOfCzechRepublic1921 + */ +class CensusOfCzechRepublic1921Test extends \PHPUnit_Framework_TestCase { + /** + * Test the census place and date + * + * @covers Fisharebest\Webtrees\Census\CensusOfCzechRepublic1921 + */ + public function testPlaceAndDate() { + $census = new CensusOfCzechRepublic1921; + + $this->assertSame('Česko', $census->censusPlace()); + $this->assertSame('15 FEB 1921', $census->censusDate()); + } + + /** + * Test the census columns + * + * @covers Fisharebest\Webtrees\Census\CensusOfCzechRepublic1921 + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testColumns() { + $census = new CensusOfCzechRepublic1921; + $columns = $census->columns(); + + $this->assertCount(14, $columns); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnFullName', $columns[0]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnRelationToHead', $columns[1]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnSexMZ', $columns[2]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[3]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthDaySlashMonthYear', $columns[4]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnBirthPlace', $columns[5]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[6]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[7]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnReligion', $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]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[12]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusColumnNull', $columns[13]); + + $this->assertSame('Jméno', $columns[0]->abbreviation()); + $this->assertSame('Vztah', $columns[1]->abbreviation()); + $this->assertSame('Pohlaví', $columns[2]->abbreviation()); + $this->assertSame('Stav', $columns[3]->abbreviation()); + $this->assertSame('Narození', $columns[4]->abbreviation()); + $this->assertSame('Místo', $columns[5]->abbreviation()); + $this->assertSame('Přísluší', $columns[6]->abbreviation()); + $this->assertSame('Jazyk', $columns[7]->abbreviation()); + $this->assertSame('Vyznání', $columns[8]->abbreviation()); + $this->assertSame('Povolání', $columns[9]->abbreviation()); + $this->assertSame('Postavení', $columns[10]->abbreviation()); + $this->assertSame('', $columns[11]->abbreviation()); + $this->assertSame('', $columns[12]->abbreviation()); + $this->assertSame('', $columns[13]->abbreviation()); + + $this->assertSame('', $columns[0]->title()); + $this->assertSame('', $columns[1]->title()); + $this->assertSame('', $columns[2]->title()); + $this->assertSame('Rodinný stav', $columns[3]->title()); + $this->assertSame('Datum narození', $columns[4]->title()); + $this->assertSame('Místo narození', $columns[5]->title()); + $this->assertSame('Domovské právo', $columns[6]->title()); + $this->assertSame('Jazyk v obcování', $columns[7]->title()); + $this->assertSame('', $columns[8]->title()); + $this->assertSame('', $columns[9]->title()); + $this->assertSame('Postavení v zaměstnání', $columns[10]->title()); + $this->assertSame('', $columns[11]->title()); + $this->assertSame('', $columns[12]->title()); + $this->assertSame('', $columns[13]->title()); + } +} diff --git a/tests/app/Census/CensusOfCzechRepublicTest.php b/tests/app/Census/CensusOfCzechRepublicTest.php new file mode 100644 index 0000000000..e4038e85d3 --- /dev/null +++ b/tests/app/Census/CensusOfCzechRepublicTest.php @@ -0,0 +1,48 @@ +<?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; + +/** + * Test harness for the class CensusOfCzechRepublic + */ +class CensusOfCzechRepublicTest extends \PHPUnit_Framework_TestCase { + /** + * Test the census place + * + * @covers Fisharebest\Webtrees\Census\CensusOfCzechRepublic + */ + public function testPlace() { + $census = new CensusOfCzechRepublic; + + $this->assertSame('Česko', $census->censusPlace()); + } + + /** + * Test the census dates + * + * @covers Fisharebest\Webtrees\Census\CensusOfCzechRepublic + */ + public function testAllDates() { + $census = new CensusOfCzechRepublic; + + $census_dates = $census->allCensusDates(); + + $this->assertCount(2, $census_dates); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfCzechRepublic1880', $census_dates[0]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfCzechRepublic1921', $census_dates[1]); + } +} diff --git a/tests/app/Census/CensusTest.php b/tests/app/Census/CensusTest.php index 92a2bf1f04..43831b40f4 100644 --- a/tests/app/Census/CensusTest.php +++ b/tests/app/Census/CensusTest.php @@ -26,12 +26,13 @@ class CensusTest extends \PHPUnit_Framework_TestCase { public function testAllCensus() { $censuses = Census::allCensusPlaces(); - $this->assertCount(6, $censuses); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfDenmark', $censuses[0]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfEngland', $censuses[1]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfFrance', $censuses[2]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfScotland', $censuses[3]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates', $censuses[4]); - $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfWales', $censuses[5]); + $this->assertCount(7, $censuses); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfCzechRepublic', $censuses[0]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfDenmark', $censuses[1]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfEngland', $censuses[2]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfFrance', $censuses[3]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfScotland', $censuses[4]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfUnitedStates', $censuses[5]); + $this->assertInstanceOf('Fisharebest\Webtrees\Census\CensusOfWales', $censuses[6]); } } |
