100225b98SGreg Roach<?php 200225b98SGreg Roach 300225b98SGreg Roach/** 400225b98SGreg Roach * webtrees: online genealogy 56bdf7674SGreg Roach * Copyright (C) 2017 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 CensusColumnConditionFrenchFemme 2400225b98SGreg Roach */ 25*3e983931SGreg Roachclass CensusColumnConditionFrenchFemmeTest extends \PHPUnit\Framework\TestCase { 2600225b98SGreg Roach /** 2700225b98SGreg Roach * Delete mock objects 2800225b98SGreg Roach */ 2900225b98SGreg Roach public function tearDown() { 3000225b98SGreg Roach Mockery::close(); 3100225b98SGreg Roach } 3200225b98SGreg Roach 3300225b98SGreg Roach /** 3415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 3515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 3600225b98SGreg Roach */ 3700225b98SGreg Roach public function testNoSpouseFamiliesMale() { 3800225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 3900225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 4013abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([]); 4100225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 4200225b98SGreg Roach 4300225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 4400225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 4500225b98SGreg Roach 4600225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 4700225b98SGreg Roach 4800225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 4900225b98SGreg Roach } 5000225b98SGreg Roach 5100225b98SGreg Roach /** 5215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 5315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 5400225b98SGreg Roach */ 5500225b98SGreg Roach public function testNoSpouseFamiliesFemale() { 5600225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 5700225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 5813abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([]); 5900225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 6000225b98SGreg Roach 6100225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 6200225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 6300225b98SGreg Roach 6400225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 6500225b98SGreg Roach 66d8e2dd8bSGreg Roach $this->assertSame('', $column->generate($individual)); 6700225b98SGreg Roach } 6800225b98SGreg Roach 6900225b98SGreg Roach /** 7015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 7115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 7200225b98SGreg Roach */ 73e76c0cf0SGreg Roach public function testNoFamilyFactsMale() { 7400225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 7500225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 762a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 7700225b98SGreg Roach 7800225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 7913abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 802a6fda60SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 812a6fda60SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 8200225b98SGreg Roach 8300225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 8400225b98SGreg Roach 8500225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 8600225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 8700225b98SGreg Roach 8800225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 8900225b98SGreg Roach } 9000225b98SGreg Roach 9100225b98SGreg Roach /** 9215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 9315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 9400225b98SGreg Roach */ 95e76c0cf0SGreg Roach public function testNoFamilyFactsFemale() { 9600225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 9700225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 982a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 9900225b98SGreg Roach 10000225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 10113abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 1022a6fda60SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 1032a6fda60SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 10400225b98SGreg Roach 10500225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 10600225b98SGreg Roach 10700225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 10800225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 10900225b98SGreg Roach 1102a6fda60SGreg Roach $this->assertSame('', $column->generate($individual)); 11100225b98SGreg Roach } 11200225b98SGreg Roach 11300225b98SGreg Roach /** 11415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 11515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 11600225b98SGreg Roach */ 117e76c0cf0SGreg Roach public function testSpouseDeadMale() { 1182a6fda60SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 1192a6fda60SGreg Roach 120e76c0cf0SGreg Roach $spouse = Mockery::mock('Fisharebest\Webtrees\Individual'); 121e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); 122e76c0cf0SGreg Roach 123e76c0cf0SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 124e76c0cf0SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1252a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); 1262a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn([]); 127e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 128e76c0cf0SGreg Roach 129e76c0cf0SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 130e76c0cf0SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 13113abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 132e76c0cf0SGreg Roach 133e76c0cf0SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 134e76c0cf0SGreg Roach 135e76c0cf0SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 136e76c0cf0SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 137e76c0cf0SGreg Roach 138e76c0cf0SGreg Roach $this->assertSame('', $column->generate($individual)); 139e76c0cf0SGreg Roach } 140e76c0cf0SGreg Roach 141e76c0cf0SGreg Roach /** 14215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 14315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 144e76c0cf0SGreg Roach */ 145e76c0cf0SGreg Roach public function testSpouseDeadFemale() { 1462a6fda60SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 1472a6fda60SGreg Roach 148e76c0cf0SGreg Roach $spouse = Mockery::mock('Fisharebest\Webtrees\Individual'); 149e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); 150e76c0cf0SGreg Roach 151e76c0cf0SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 152e76c0cf0SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1532a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); 1542a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn([]); 155e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 156e76c0cf0SGreg Roach 157e76c0cf0SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 158e76c0cf0SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 15913abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 160e76c0cf0SGreg Roach 161e76c0cf0SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 162e76c0cf0SGreg Roach 163e76c0cf0SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 164e76c0cf0SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 165e76c0cf0SGreg Roach 166e76c0cf0SGreg Roach $this->assertSame('', $column->generate($individual)); 167e76c0cf0SGreg Roach } 168e76c0cf0SGreg Roach 169e76c0cf0SGreg Roach /** 17015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 17115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 172e76c0cf0SGreg Roach */ 17300225b98SGreg Roach public function testNoFamilyUnmarriedMale() { 17400225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 17500225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1762a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 17700225b98SGreg Roach 17800225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 17900225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 18013abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 18100225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 18200225b98SGreg Roach 18300225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 18400225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 18500225b98SGreg Roach 18600225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 18700225b98SGreg Roach 18800225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 18900225b98SGreg Roach } 19000225b98SGreg Roach 19100225b98SGreg Roach /** 19215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 19315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 19400225b98SGreg Roach */ 19500225b98SGreg Roach public function testNoFamilyUnmarriedFemale() { 19600225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 19700225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 1982a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 19900225b98SGreg Roach 20000225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 20100225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 20213abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 20300225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 20400225b98SGreg Roach 20500225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 20600225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 20700225b98SGreg Roach 20800225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 20900225b98SGreg Roach 210d8e2dd8bSGreg Roach $this->assertSame('', $column->generate($individual)); 21100225b98SGreg Roach } 21200225b98SGreg Roach 21300225b98SGreg Roach /** 21415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 21515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 21600225b98SGreg Roach */ 21700225b98SGreg Roach public function testChildMale() { 21800225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 21900225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2202a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 22100225b98SGreg Roach 22200225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 22300225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 22413abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 22500225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); 22600225b98SGreg Roach 22700225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 22800225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 22900225b98SGreg Roach 23000225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 23100225b98SGreg Roach 23200225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 23300225b98SGreg Roach } 23400225b98SGreg Roach 23500225b98SGreg Roach /** 23615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 23715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 23800225b98SGreg Roach */ 23900225b98SGreg Roach public function testChildFemale() { 24000225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 24100225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2422a6fda60SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([]); 24300225b98SGreg Roach 24400225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 24500225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 24613abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 24700225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); 24800225b98SGreg Roach 24900225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 25000225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 25100225b98SGreg Roach 25200225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 25300225b98SGreg Roach 25400225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 25500225b98SGreg Roach } 25600225b98SGreg Roach 25700225b98SGreg Roach /** 25815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 25915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 26000225b98SGreg Roach */ 26100225b98SGreg Roach public function testDivorcedMale() { 26200225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 26300225b98SGreg Roach 26400225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 26500225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2660b4be234SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); 26713abd6f3SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn([$fact]); 26800225b98SGreg Roach 26900225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 27000225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 27113abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 27200225b98SGreg Roach 27300225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 27400225b98SGreg Roach 27500225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 27600225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 27700225b98SGreg Roach 27800225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 27900225b98SGreg Roach } 28000225b98SGreg Roach 28100225b98SGreg Roach /** 28215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme 28315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 28400225b98SGreg Roach */ 28500225b98SGreg Roach public function testDivorcedFemale() { 28600225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 28700225b98SGreg Roach 28800225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 28900225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 2900b4be234SGreg Roach $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]); 29113abd6f3SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn([$fact]); 29200225b98SGreg Roach 29300225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 29400225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 29513abd6f3SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]); 29600225b98SGreg Roach 29700225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 29800225b98SGreg Roach 29900225b98SGreg Roach $column = new CensusColumnConditionFrenchFemme($census, '', ''); 30000225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 30100225b98SGreg Roach 302d8e2dd8bSGreg Roach $this->assertSame('1', $column->generate($individual)); 30300225b98SGreg Roach } 30400225b98SGreg Roach} 305