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 --- .../Census/CensusColumnMarriedWithinYearTest.php | 24 +++++++++++++++++++++- .../CensusColumnMonthIfBornWithinYearTest.php | 20 +++++++++++++++++- .../CensusColumnMonthIfMarriedWithinYearTest.php | 24 +++++++++++++++++++++- 3 files changed, 65 insertions(+), 3 deletions(-) (limited to 'tests/app/Census') diff --git a/tests/app/Census/CensusColumnMarriedWithinYearTest.php b/tests/app/Census/CensusColumnMarriedWithinYearTest.php index 0fe75c5d92..115cf66d3e 100644 --- a/tests/app/Census/CensusColumnMarriedWithinYearTest.php +++ b/tests/app/Census/CensusColumnMarriedWithinYearTest.php @@ -56,7 +56,7 @@ class CensusColumnMarriedWithinYearTest extends \PHPUnit_Framework_TestCase { * @covers Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear * @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 CensusColumnMarriedWithinYearTest extends \PHPUnit_Framework_TestCase { $this->assertSame('', $column->generate($individual)); } + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear + * @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 CensusColumnMarriedWithinYear($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } + /** * @covers Fisharebest\Webtrees\Census\CensusColumnMarriedWithinYear * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn diff --git a/tests/app/Census/CensusColumnMonthIfBornWithinYearTest.php b/tests/app/Census/CensusColumnMonthIfBornWithinYearTest.php index f652368abe..b7d2ecb259 100644 --- a/tests/app/Census/CensusColumnMonthIfBornWithinYearTest.php +++ b/tests/app/Census/CensusColumnMonthIfBornWithinYearTest.php @@ -50,7 +50,7 @@ class CensusColumnMonthIfBornWithinYearTest extends \PHPUnit_Framework_TestCase * @covers Fisharebest\Webtrees\Census\CensusColumnMonthIfBornWithinYear * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ - public function testNotBornWithinYear() { + public function testBornOverYearBeforeTheCensus() { $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getBirthDate')->andReturn(new Date('01 JAN 1859')); @@ -62,6 +62,24 @@ class CensusColumnMonthIfBornWithinYearTest extends \PHPUnit_Framework_TestCase $this->assertSame('', $column->generate($individual)); } + /** + * @covers Fisharebest\Webtrees\Census\CensusColumnMonthIfBornWithinYear + * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn + */ + public function testBornAfterTheCensus() { + $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); + $individual->shouldReceive('getBirthDate')->andReturn(new Date('02 JUN 1860')); + + $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); + $census->shouldReceive('censusDate')->andReturn('01 JUN 1860'); + + + $column = new CensusColumnMonthIfBornWithinYear($census, '', ''); + + $this->assertSame('', $column->generate($individual)); + } + + /** * @covers Fisharebest\Webtrees\Census\CensusColumnMonthIfBornWithinYear * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 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