. */ 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)); } }