From 4fc9500e42872f656cd6981846f3188c5c21b5fe Mon Sep 17 00:00:00 2001 From: Greg Roach Date: Mon, 5 Dec 2016 14:29:00 +0000 Subject: Fix #1122 Census column marriage/birth months for future dates --- .../CensusColumnMonthIfMarriedWithinYearTest.php | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'tests/app/Census/CensusColumnMonthIfMarriedWithinYearTest.php') diff --git a/tests/app/Census/CensusColumnMonthIfMarriedWithinYearTest.php b/tests/app/Census/CensusColumnMonthIfMarriedWithinYearTest.php index 08d546a752..aca477d979 100644 --- a/tests/app/Census/CensusColumnMonthIfMarriedWithinYearTest.php +++ b/tests/app/Census/CensusColumnMonthIfMarriedWithinYearTest.php @@ -56,7 +56,7 @@ class CensusColumnMonthIfMarriedWithinYearTest extends \PHPUnit_Framework_TestCa * @covers Fisharebest\Webtrees\Census\CensusColumnMonthIfMarriedWithinYear * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ - public function testNotMarriedWithinYear() { + public function testMarriedOverYearBeforeTheCensus() { $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); $fact->shouldReceive('getDate')->andReturn(new Date('01 JAN 1859')); @@ -74,6 +74,28 @@ class CensusColumnMonthIfMarriedWithinYearTest extends \PHPUnit_Framework_TestCa $this->assertSame('', $column->generate($individual)); } + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnMonthIfMarriedWithinYear + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + 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(array($fact)); + + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); + + $column = new CensusColumnMonthIfMarriedWithinYear($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } + /** * @covers Fisharebest\Webtrees\Census\CensusColumnMonthIfMarriedWithinYear * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn -- cgit v1.3