100225b98SGreg Roach<?php 200225b98SGreg Roach 300225b98SGreg Roach/** 400225b98SGreg Roach * webtrees: online genealogy 51062a142SGreg Roach * Copyright (C) 2018 webtrees development team 600225b98SGreg Roach * This program is free software: you can redistribute it and/or modify 700225b98SGreg Roach * it under the terms of the GNU General Public License as published by 800225b98SGreg Roach * the Free Software Foundation, either version 3 of the License, or 900225b98SGreg Roach * (at your option) any later version. 1000225b98SGreg Roach * This program is distributed in the hope that it will be useful, 1100225b98SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1200225b98SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1300225b98SGreg Roach * GNU General Public License for more details. 1400225b98SGreg Roach * You should have received a copy of the GNU General Public License 1500225b98SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 1600225b98SGreg Roach */ 1700225b98SGreg Roachnamespace Fisharebest\Webtrees\Census; 1800225b98SGreg Roach 1900225b98SGreg Roachuse Fisharebest\Webtrees\Date; 2000225b98SGreg Roachuse Mockery; 2100225b98SGreg Roach 2200225b98SGreg Roach/** 2300225b98SGreg Roach * Test harness for the class CensusColumnConditionFrenchFille 2400225b98SGreg Roach */ 25c1010edaSGreg Roachclass CensusColumnConditionFrenchFilleTest extends \PHPUnit\Framework\TestCase 26c1010edaSGreg Roach{ 2700225b98SGreg Roach /** 2800225b98SGreg Roach * Delete mock objects 2900225b98SGreg Roach */ 30c1010edaSGreg Roach public function tearDown() 31c1010edaSGreg Roach { 3200225b98SGreg Roach Mockery::close(); 3300225b98SGreg Roach } 3400225b98SGreg Roach 3500225b98SGreg Roach /** 3615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 3715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 3800225b98SGreg Roach */ 39c1010edaSGreg Roach public function testNoSpouseFamiliesMale() 40c1010edaSGreg Roach { 4100225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 4200225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 4313abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([]); 4400225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 4500225b98SGreg Roach 4600225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 4700225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 4800225b98SGreg Roach 4900225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 5000225b98SGreg Roach 51*342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 5200225b98SGreg Roach } 5300225b98SGreg Roach 5400225b98SGreg Roach /** 5515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 5615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 5700225b98SGreg Roach */ 58c1010edaSGreg Roach public function testNoSpouseFamiliesFemale() 59c1010edaSGreg Roach { 6000225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 6100225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 6213abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([]); 6300225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 6400225b98SGreg Roach 6500225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 6600225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 6700225b98SGreg Roach 6800225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 6900225b98SGreg Roach 70*342dcecdSGreg Roach $this->assertSame('1', $column->generate($individual, $individual)); 7100225b98SGreg Roach } 7200225b98SGreg Roach 7300225b98SGreg Roach /** 7415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 7515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 7600225b98SGreg Roach */ 77c1010edaSGreg Roach public function testNoFamilyFactsMale() 78c1010edaSGreg Roach { 7900225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 8000225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 812a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 8200225b98SGreg Roach 8300225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 8413abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 852a6fda60SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 862a6fda60SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 8700225b98SGreg Roach 8800225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 8900225b98SGreg Roach 9000225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 9100225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 9200225b98SGreg Roach 93*342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 9400225b98SGreg Roach } 9500225b98SGreg Roach 9600225b98SGreg Roach /** 9715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 9815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 9900225b98SGreg Roach */ 100c1010edaSGreg Roach public function testNoFamilyFactsFemale() 101c1010edaSGreg Roach { 10200225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 10300225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1042a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 105e76c0cf0SGreg Roach 106e76c0cf0SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 10713abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 1082a6fda60SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 1092a6fda60SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 110e76c0cf0SGreg Roach 111e76c0cf0SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 112e76c0cf0SGreg Roach 113e76c0cf0SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 114e76c0cf0SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 115e76c0cf0SGreg Roach 116*342dcecdSGreg Roach $this->assertSame('1', $column->generate($individual, $individual)); 117e76c0cf0SGreg Roach } 118e76c0cf0SGreg Roach 119e76c0cf0SGreg Roach /** 12015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 12115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 122e76c0cf0SGreg Roach */ 123c1010edaSGreg Roach public function testSpouseDeadMale() 124c1010edaSGreg Roach { 1252a6fda60SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 1262a6fda60SGreg Roach 127e76c0cf0SGreg Roach $spouse = Mockery::mock('Fisharebest\Webtrees\Individual'); 128e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); 129e76c0cf0SGreg Roach 130e76c0cf0SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 131e76c0cf0SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1322a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); 1332a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn([]); 134e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 135e76c0cf0SGreg Roach 136e76c0cf0SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 137e76c0cf0SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 13813abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 139e76c0cf0SGreg Roach 140e76c0cf0SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 141e76c0cf0SGreg Roach 142e76c0cf0SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 143e76c0cf0SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 144e76c0cf0SGreg Roach 145*342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 146e76c0cf0SGreg Roach } 147e76c0cf0SGreg Roach 148e76c0cf0SGreg Roach /** 14915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 15015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 151e76c0cf0SGreg Roach */ 152c1010edaSGreg Roach public function testSpouseDeadFemale() 153c1010edaSGreg Roach { 1542a6fda60SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 1552a6fda60SGreg Roach 156e76c0cf0SGreg Roach $spouse = Mockery::mock('Fisharebest\Webtrees\Individual'); 157e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); 158e76c0cf0SGreg Roach 159e76c0cf0SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 160e76c0cf0SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1612a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); 1622a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn([]); 163e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 16400225b98SGreg Roach 16500225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 16600225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 16713abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 16800225b98SGreg Roach 16900225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 17000225b98SGreg Roach 17100225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 17200225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 17300225b98SGreg Roach 174*342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 17500225b98SGreg Roach } 17600225b98SGreg Roach 17700225b98SGreg Roach /** 17815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 17915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 18000225b98SGreg Roach */ 181c1010edaSGreg Roach public function testNoFamilyUnmarriedMale() 182c1010edaSGreg Roach { 18300225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 18400225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1852a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 18600225b98SGreg Roach 18700225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 18800225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 18913abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 19000225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 19100225b98SGreg Roach 19200225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 19300225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 19400225b98SGreg Roach 19500225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 19600225b98SGreg Roach 197*342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 19800225b98SGreg Roach } 19900225b98SGreg Roach 20000225b98SGreg Roach /** 20115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 20215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 20300225b98SGreg Roach */ 204c1010edaSGreg Roach public function testNoFamilyUnmarriedFemale() 205c1010edaSGreg Roach { 20600225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 20700225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2082a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 20900225b98SGreg Roach 21000225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 21100225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 21213abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 21300225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 21400225b98SGreg Roach 21500225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 21600225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 21700225b98SGreg Roach 21800225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 21900225b98SGreg Roach 220*342dcecdSGreg Roach $this->assertSame('1', $column->generate($individual, $individual)); 22100225b98SGreg Roach } 22200225b98SGreg Roach 22300225b98SGreg Roach /** 22415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 22515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 22600225b98SGreg Roach */ 227c1010edaSGreg Roach public function testChildMale() 228c1010edaSGreg Roach { 22900225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 23000225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2312a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 23200225b98SGreg Roach 23300225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 23400225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 23513abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 23600225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); 23700225b98SGreg Roach 23800225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 23900225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 24000225b98SGreg Roach 24100225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 24200225b98SGreg Roach 243*342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 24400225b98SGreg Roach } 24500225b98SGreg Roach 24600225b98SGreg Roach /** 24715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 24815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 24900225b98SGreg Roach */ 250c1010edaSGreg Roach public function testChildFemale() 251c1010edaSGreg Roach { 25200225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 25300225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2542a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 25500225b98SGreg Roach 25600225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 25700225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 25813abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 25900225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); 26000225b98SGreg Roach 26100225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 26200225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 26300225b98SGreg Roach 26400225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 26500225b98SGreg Roach 266*342dcecdSGreg Roach $this->assertSame('1', $column->generate($individual, $individual)); 26700225b98SGreg Roach } 26800225b98SGreg Roach 26900225b98SGreg Roach /** 27015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 27115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 27200225b98SGreg Roach */ 273c1010edaSGreg Roach public function testDivorcedMale() 274c1010edaSGreg Roach { 27500225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 27600225b98SGreg Roach 27700225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 27800225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2790b4be234SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); 28013abd6f3SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn([$fact]); 28100225b98SGreg Roach 28200225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 28300225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 28413abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 28500225b98SGreg Roach 28600225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 28700225b98SGreg Roach 28800225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 28900225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 29000225b98SGreg Roach 291*342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 29200225b98SGreg Roach } 29300225b98SGreg Roach 29400225b98SGreg Roach /** 29515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille 29615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 29700225b98SGreg Roach */ 298c1010edaSGreg Roach public function testDivorcedFemale() 299c1010edaSGreg Roach { 30000225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 30100225b98SGreg Roach 30200225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 30300225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 3040b4be234SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); 30513abd6f3SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn([$fact]); 30600225b98SGreg Roach 30700225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 30800225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 30913abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 31000225b98SGreg Roach 31100225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 31200225b98SGreg Roach 31300225b98SGreg Roach $column = new CensusColumnConditionFrenchFille($census, '', ''); 31400225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 31500225b98SGreg Roach 316*342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 31700225b98SGreg Roach } 31800225b98SGreg Roach} 319