. */ namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Family; use Fisharebest\Webtrees\Individual; use Mockery; /** * Test harness for the class CensusColumnFatherForeign */ class CensusColumnFatherForeignTest extends \PHPUnit_Framework_TestCase { /** * Delete mock objects */ public function tearDown() { Mockery::close(); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnFatherForeign * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testSameCountry() { $father = Mockery::mock(Individual::class); $father->shouldReceive('getBirthPlace')->andReturn('London, England'); $family = Mockery::mock(Family::class); $family->shouldReceive('getHusband')->andReturn($father); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getPrimaryChildFamily')->andReturn($family); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusPlace')->andReturn('England'); $column = new CensusColumnFatherForeign($census, '', ''); $this->assertSame('', $column->generate($individual)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnFatherForeign * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testDifferentCountry() { $father = Mockery::mock(Individual::class); $father->shouldReceive('getBirthPlace')->andReturn('London, England'); $family = Mockery::mock(Family::class); $family->shouldReceive('getHusband')->andReturn($father); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getPrimaryChildFamily')->andReturn($family); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusPlace')->andReturn('Ireland'); $column = new CensusColumnFatherForeign($census, '', ''); $this->assertSame('Y', $column->generate($individual)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnFatherForeign * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testPlaceNoParent() { $family = Mockery::mock(Family::class); $family->shouldReceive('getHusband')->andReturn(null); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getPrimaryChildFamily')->andReturn($family); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusPlace')->andReturn('England'); $column = new CensusColumnFatherForeign($census, '', ''); $this->assertSame('', $column->generate($individual)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnFatherForeign * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testPlaceNoParentFamily() { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getPrimaryChildFamily')->andReturn(null); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusPlace')->andReturn('England'); $column = new CensusColumnFatherForeign($census, '', ''); $this->assertSame('', $column->generate($individual)); } }