100225b98SGreg Roach<?php 200225b98SGreg Roach/** 300225b98SGreg Roach * webtrees: online genealogy 4*8fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 500225b98SGreg Roach * This program is free software: you can redistribute it and/or modify 600225b98SGreg Roach * it under the terms of the GNU General Public License as published by 700225b98SGreg Roach * the Free Software Foundation, either version 3 of the License, or 800225b98SGreg Roach * (at your option) any later version. 900225b98SGreg Roach * This program is distributed in the hope that it will be useful, 1000225b98SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1100225b98SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1200225b98SGreg Roach * GNU General Public License for more details. 1300225b98SGreg Roach * You should have received a copy of the GNU General Public License 1400225b98SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 1500225b98SGreg Roach */ 16e7f56f2aSGreg Roachdeclare(strict_types=1); 17e7f56f2aSGreg Roach 1800225b98SGreg Roachnamespace Fisharebest\Webtrees\Census; 1900225b98SGreg Roach 2000225b98SGreg Roachuse Fisharebest\Webtrees\Date; 21ddf438a5SGreg Roachuse Fisharebest\Webtrees\Fact; 22ddf438a5SGreg Roachuse Fisharebest\Webtrees\Family; 23ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual; 2400225b98SGreg Roachuse Mockery; 2500225b98SGreg Roach 2600225b98SGreg Roach/** 2700225b98SGreg Roach * Test harness for the class CensusColumnConditionFrenchVeuf 2800225b98SGreg Roach */ 2984e2cf4eSGreg Roachclass CensusColumnConditionFrenchVeufTest extends \Fisharebest\Webtrees\TestCase 30c1010edaSGreg Roach{ 3100225b98SGreg Roach /** 3200225b98SGreg Roach * Delete mock objects 3352348eb8SGreg Roach * 3452348eb8SGreg Roach * @return void 3500225b98SGreg Roach */ 36c1010edaSGreg Roach public function tearDown() 37c1010edaSGreg Roach { 3800225b98SGreg Roach Mockery::close(); 3900225b98SGreg Roach } 4000225b98SGreg Roach 4100225b98SGreg Roach /** 4215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 4315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 4452348eb8SGreg Roach * 4552348eb8SGreg Roach * @return void 4600225b98SGreg Roach */ 47c1010edaSGreg Roach public function testNoSpouseFamiliesMale() 48c1010edaSGreg Roach { 49ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 5000225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 5113abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([]); 5200225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 5300225b98SGreg Roach 54ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 5500225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 5600225b98SGreg Roach 5700225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 5800225b98SGreg Roach 59342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 6000225b98SGreg Roach } 6100225b98SGreg Roach 6200225b98SGreg Roach /** 6315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 6415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 6552348eb8SGreg Roach * 6652348eb8SGreg Roach * @return void 6700225b98SGreg Roach */ 68c1010edaSGreg Roach public function testNoSpouseFamiliesFemale() 69c1010edaSGreg Roach { 70ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 7100225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 7213abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([]); 7300225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 7400225b98SGreg Roach 75ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 7600225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 7700225b98SGreg Roach 7800225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 7900225b98SGreg Roach 80342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 8100225b98SGreg Roach } 8200225b98SGreg Roach 8300225b98SGreg Roach /** 8415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 8515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 8652348eb8SGreg Roach * 8752348eb8SGreg Roach * @return void 8800225b98SGreg Roach */ 89c1010edaSGreg Roach public function testNoFamilyFactsMale() 90c1010edaSGreg Roach { 91ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 9200225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 938d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([]); 9400225b98SGreg Roach 95ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 9613abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 972a6fda60SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 982a6fda60SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 9900225b98SGreg Roach 100ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 10100225b98SGreg Roach 10200225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 10300225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 10400225b98SGreg Roach 105342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 10600225b98SGreg Roach } 10700225b98SGreg Roach 10800225b98SGreg Roach /** 10915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 11015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 11152348eb8SGreg Roach * 11252348eb8SGreg Roach * @return void 11300225b98SGreg Roach */ 114c1010edaSGreg Roach public function testNoFamilyFactsFemale() 115c1010edaSGreg Roach { 116ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 11700225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1188d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([]); 119e76c0cf0SGreg Roach 120ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 12113abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 1222a6fda60SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 1232a6fda60SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 124e76c0cf0SGreg Roach 125ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 126e76c0cf0SGreg Roach 127e76c0cf0SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 128e76c0cf0SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 129e76c0cf0SGreg Roach 130342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 131e76c0cf0SGreg Roach } 132e76c0cf0SGreg Roach 133e76c0cf0SGreg Roach /** 13415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 13515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 13652348eb8SGreg Roach * 13752348eb8SGreg Roach * @return void 138e76c0cf0SGreg Roach */ 139c1010edaSGreg Roach public function testSpouseDeadMale() 140c1010edaSGreg Roach { 141ddf438a5SGreg Roach $fact = Mockery::mock(Fact::class); 1422a6fda60SGreg Roach 143ddf438a5SGreg Roach $spouse = Mockery::mock(Individual::class); 144e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); 145e76c0cf0SGreg Roach 146ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 147e76c0cf0SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1488d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([$fact]); 1498d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['DIV'])->andReturn([]); 150e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 151e76c0cf0SGreg Roach 152ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 153e76c0cf0SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 15413abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 155e76c0cf0SGreg Roach 156ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 157e76c0cf0SGreg Roach 158e76c0cf0SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 159e76c0cf0SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 160e76c0cf0SGreg Roach 161342dcecdSGreg Roach $this->assertSame('1', $column->generate($individual, $individual)); 162e76c0cf0SGreg Roach } 163e76c0cf0SGreg Roach 164e76c0cf0SGreg Roach /** 16515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 16615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 16752348eb8SGreg Roach * 16852348eb8SGreg Roach * @return void 169e76c0cf0SGreg Roach */ 170c1010edaSGreg Roach public function testSpouseDeadFemale() 171c1010edaSGreg Roach { 172ddf438a5SGreg Roach $fact = Mockery::mock(Fact::class); 1732a6fda60SGreg Roach 174ddf438a5SGreg Roach $spouse = Mockery::mock(Individual::class); 175e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); 176e76c0cf0SGreg Roach 177ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 178e76c0cf0SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1798d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([$fact]); 1808d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['DIV'])->andReturn([]); 181e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 18200225b98SGreg Roach 183ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 18400225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 18513abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 18600225b98SGreg Roach 187ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 18800225b98SGreg Roach 18900225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 19000225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 19100225b98SGreg Roach 192342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 19300225b98SGreg Roach } 19400225b98SGreg Roach 19500225b98SGreg Roach /** 19615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 19715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 19852348eb8SGreg Roach * 19952348eb8SGreg Roach * @return void 20000225b98SGreg Roach */ 201c1010edaSGreg Roach public function testNoFamilyUnmarriedMale() 202c1010edaSGreg Roach { 203ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 20400225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2058d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([]); 20600225b98SGreg Roach 207ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 20800225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 20913abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 21000225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 21100225b98SGreg Roach 212ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 21300225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 21400225b98SGreg Roach 21500225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 21600225b98SGreg Roach 217342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 21800225b98SGreg Roach } 21900225b98SGreg Roach 22000225b98SGreg Roach /** 22115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 22215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 22352348eb8SGreg Roach * 22452348eb8SGreg Roach * @return void 22500225b98SGreg Roach */ 226c1010edaSGreg Roach public function testNoFamilyUnmarriedFemale() 227c1010edaSGreg Roach { 228ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 22900225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2308d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([]); 23100225b98SGreg Roach 232ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 23300225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 23413abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 23500225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 23600225b98SGreg Roach 237ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 23800225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 23900225b98SGreg Roach 24000225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 24100225b98SGreg Roach 242342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 24300225b98SGreg Roach } 24400225b98SGreg Roach 24500225b98SGreg Roach /** 24615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 24715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 24852348eb8SGreg Roach * 24952348eb8SGreg Roach * @return void 25000225b98SGreg Roach */ 251c1010edaSGreg Roach public function testChildMale() 252c1010edaSGreg Roach { 253ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 25400225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2558d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([]); 25600225b98SGreg Roach 257ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 25800225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 25913abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 26000225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); 26100225b98SGreg Roach 262ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 26300225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 26400225b98SGreg Roach 26500225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 26600225b98SGreg Roach 267342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 26800225b98SGreg Roach } 26900225b98SGreg Roach 27000225b98SGreg Roach /** 27115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 27215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 27352348eb8SGreg Roach * 27452348eb8SGreg Roach * @return void 27500225b98SGreg Roach */ 276c1010edaSGreg Roach public function testChildFemale() 277c1010edaSGreg Roach { 278ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 27900225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2808d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([]); 28100225b98SGreg Roach 282ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 28300225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 28413abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 28500225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); 28600225b98SGreg Roach 287ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 28800225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 28900225b98SGreg Roach 29000225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 29100225b98SGreg Roach 292342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 29300225b98SGreg Roach } 29400225b98SGreg Roach 29500225b98SGreg Roach /** 29615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 29715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 29852348eb8SGreg Roach * 29952348eb8SGreg Roach * @return void 30000225b98SGreg Roach */ 301c1010edaSGreg Roach public function testDivorcedMale() 302c1010edaSGreg Roach { 303ddf438a5SGreg Roach $fact = Mockery::mock(Fact::class); 30400225b98SGreg Roach 305ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 30600225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 3078d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([$fact]); 3088d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['DIV'])->andReturn([$fact]); 30900225b98SGreg Roach 310ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 31100225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 31213abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 31300225b98SGreg Roach 314ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 31500225b98SGreg Roach 31600225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 31700225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 31800225b98SGreg Roach 319342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 32000225b98SGreg Roach } 32100225b98SGreg Roach 32200225b98SGreg Roach /** 32315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf 32415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 32552348eb8SGreg Roach * 32652348eb8SGreg Roach * @return void 32700225b98SGreg Roach */ 328c1010edaSGreg Roach public function testDivorcedFemale() 329c1010edaSGreg Roach { 330ddf438a5SGreg Roach $fact = Mockery::mock(Fact::class); 33100225b98SGreg Roach 332ddf438a5SGreg Roach $family = Mockery::mock(Family::class); 33300225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 3348d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['MARR'])->andReturn([$fact]); 3358d0ebef0SGreg Roach $family->shouldReceive('facts')->with(['DIV'])->andReturn([$fact]); 33600225b98SGreg Roach 337ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 33800225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 33913abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 34000225b98SGreg Roach 341ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 34200225b98SGreg Roach 34300225b98SGreg Roach $column = new CensusColumnConditionFrenchVeuf($census, '', ''); 34400225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 34500225b98SGreg Roach 346342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 34700225b98SGreg Roach } 34800225b98SGreg Roach} 349