. */ 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('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn(array()); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $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('Fisharebest\Webtrees\Family'); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('getFacts')->andReturn(array()); $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $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('Fisharebest\Webtrees\Fact'); $family = Mockery::mock('Fisharebest\Webtrees\Family'); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact)); $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $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('Fisharebest\Webtrees\Fact'); $family = Mockery::mock('Fisharebest\Webtrees\Family'); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array()); $family->shouldReceive('getFacts')->with('DIV')->andReturn(array($fact)); $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $column = new CensusColumnConditionDanish($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('Skilt', $column->generate($individual)); } }