. */ namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Date; use Mockery; /** * Test harness for the class CensusColumnMarriedWithinYear */ class CensusColumnMarriedWithinYearTest extends \Fisharebest\Webtrees\TestCase { /** * Delete mock objects * * @return void */ public function tearDown() { Mockery::close(); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testMarriedWithinYear() { $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); $fact->shouldReceive('getDate')->andReturn(new Date('01 DEC 1859')); $family = Mockery::mock('Fisharebest\Webtrees\Family'); $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); $column = new CensusColumnMarriedWithinYear($census, '', ''); $this->assertSame('Y', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testMarriedOverYearBeforeTheCensus() { $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); $fact->shouldReceive('getDate')->andReturn(new Date('01 JAN 1859')); $family = Mockery::mock('Fisharebest\Webtrees\Family'); $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); $column = new CensusColumnMarriedWithinYear($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testMarriedAfterTheCensus() { $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); $fact->shouldReceive('getDate')->andReturn(new Date('02 JUN 1860')); $family = Mockery::mock('Fisharebest\Webtrees\Family'); $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); $column = new CensusColumnMarriedWithinYear($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testNoMarriage() { $family = Mockery::mock('Fisharebest\Webtrees\Family'); $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); $column = new CensusColumnMarriedWithinYear($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testNoSpouseFamily() { $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getSpouseFamilies')->andReturn([]); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); $column = new CensusColumnMarriedWithinYear($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } }