diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-09-25 18:39:16 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-09-26 16:20:37 +0100 |
| commit | ef21b467575956631eb5374fe4f2bfb94e69aaa9 (patch) | |
| tree | d6d535cdc6ea24cc091300612aa50c8a62d32c9d /tests/app/Census/CensusColumnBirthPlaceTest.php | |
| parent | db7d25eeb5ba43cdc3662cbee9ceabb8d61c7ab5 (diff) | |
| download | webtrees-ef21b467575956631eb5374fe4f2bfb94e69aaa9.tar.gz webtrees-ef21b467575956631eb5374fe4f2bfb94e69aaa9.tar.bz2 webtrees-ef21b467575956631eb5374fe4f2bfb94e69aaa9.zip | |
Census definitions
Diffstat (limited to 'tests/app/Census/CensusColumnBirthPlaceTest.php')
| -rw-r--r-- | tests/app/Census/CensusColumnBirthPlaceTest.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/app/Census/CensusColumnBirthPlaceTest.php b/tests/app/Census/CensusColumnBirthPlaceTest.php new file mode 100644 index 0000000000..d3c8c1861b --- /dev/null +++ b/tests/app/Census/CensusColumnBirthPlaceTest.php @@ -0,0 +1,82 @@ +<?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\Date; +use Fisharebest\Webtrees\Individual; +use Mockery; + +/** + * Test harness for the class CensusColumnBirthPlace + */ +class CensusColumnBirthPlaceTest extends \PHPUnit_Framework_TestCase { + /** + * Delete mock objects + */ + public function tearDown() { + Mockery::close(); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnBirthPlace + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testPlaceCountry() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getBirthPlace')->andReturn('Westminster, London, England'); + + $census = Mockery::mock(CensusInterface::class); + $census->shouldReceive('censusPlace')->andReturn('England'); + + $column = new CensusColumnBirthPlace($census, '', ''); + + $this->assertSame('Westminster, London', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnBirthPlace + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testPlaceAndCountry() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getBirthPlace')->andReturn('England'); + + $census = Mockery::mock(CensusInterface::class); + $census->shouldReceive('censusPlace')->andReturn('England'); + + $column = new CensusColumnBirthPlace($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } + + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnBirthPlace + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testDifferentCountry() { + $individual = Mockery::mock(Individual::class); + $individual->shouldReceive('getBirthPlace')->andReturn('Paris, France'); + + $census = Mockery::mock(CensusInterface::class); + $census->shouldReceive('censusPlace')->andReturn('England'); + + $column = new CensusColumnBirthPlace($census, '', ''); + + $this->assertSame('Paris, France', $column->generate($individual)); + } +} |
