. */ namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Date; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\Family; use Fisharebest\Webtrees\Individual; use Mockery; /** * Test harness for the class CensusColumnConditionDanish */ class CensusColumnConditionDanishTest extends \PHPUnit_Framework_TestCase { /** * Delete mock objects */ public function tearDown() { Mockery::close(); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnConditionDanish * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testNoSpouseFamilies() { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getSpouseFamilies')->andReturn([]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionDanish($census, '', ''); $this->assertSame('Ugift', $column->generate($individual)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnConditionDanish * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testNoFamilyNoFacts() { $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('getFacts')->andReturn([]); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionDanish($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('Gift', $column->generate($individual)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnConditionDanish * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testNoFamilyUnmarried() { $fact = Mockery::mock(Fact::class); $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('getFacts')->with('_NMR')->andReturn([$fact]); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionDanish($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('Ugift', $column->generate($individual)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnConditionDanish * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testNoFamilyDivorced() { $fact = Mockery::mock(Fact::class); $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('getFacts')->with('_NMR')->andReturn([]); $family->shouldReceive('getFacts')->with('DIV')->andReturn([$fact]); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionDanish($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('Skilt', $column->generate($individual)); } }