diff options
| author | Rico Sonntag <mail@ricosonntag.de> | 2017-11-02 18:46:11 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2017-11-03 08:50:28 +0000 |
| commit | 16d0b7f74e80c16cb445079b0322702930031dc7 (patch) | |
| tree | 6d12b4c33c815ae4aa776d696fc0fc1ab916d8be /tests/app/Census/CensusColumnBirthPlaceTest.php | |
| parent | 3b896c03575e2dd07b0991a7090c7046b2e38517 (diff) | |
| download | webtrees-16d0b7f74e80c16cb445079b0322702930031dc7.tar.gz webtrees-16d0b7f74e80c16cb445079b0322702930031dc7.tar.bz2 webtrees-16d0b7f74e80c16cb445079b0322702930031dc7.zip | |
Return Place instance instead of string, allowing use of object methods
Diffstat (limited to 'tests/app/Census/CensusColumnBirthPlaceTest.php')
| -rw-r--r-- | tests/app/Census/CensusColumnBirthPlaceTest.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/app/Census/CensusColumnBirthPlaceTest.php b/tests/app/Census/CensusColumnBirthPlaceTest.php index f238bda0cf..a509d41201 100644 --- a/tests/app/Census/CensusColumnBirthPlaceTest.php +++ b/tests/app/Census/CensusColumnBirthPlaceTest.php @@ -30,12 +30,27 @@ class CensusColumnBirthPlaceTest extends \PHPUnit_Framework_TestCase { } /** + * Get place mock. + * + * @param string $place Gedcom Place + * + * @return \Fisharebest\Webtrees\Place + */ + private function getPlaceMock($place) + { + $placeMock = Mockery::mock('\Fisharebest\Webtrees\Place'); + $placeMock->shouldReceive('getGedcomName')->andReturn($place); + + return $placeMock; + } + + /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthPlace * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testPlaceCountry() { $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); - $individual->shouldReceive('getBirthPlace')->andReturn('Westminster, London, England'); + $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Westminster, London, England')); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $census->shouldReceive('censusPlace')->andReturn('England'); @@ -51,7 +66,7 @@ class CensusColumnBirthPlaceTest extends \PHPUnit_Framework_TestCase { */ public function testPlaceAndCountry() { $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); - $individual->shouldReceive('getBirthPlace')->andReturn('England'); + $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('England')); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $census->shouldReceive('censusPlace')->andReturn('England'); @@ -67,7 +82,7 @@ class CensusColumnBirthPlaceTest extends \PHPUnit_Framework_TestCase { */ public function testDifferentCountry() { $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); - $individual->shouldReceive('getBirthPlace')->andReturn('Paris, France'); + $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Paris, France')); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $census->shouldReceive('censusPlace')->andReturn('England'); |
