100225b98SGreg Roach<?php 200225b98SGreg Roach 300225b98SGreg Roach/** 400225b98SGreg Roach * webtrees: online genealogy 500225b98SGreg Roach * Copyright (C) 2016 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 Fisharebest\Webtrees\Fact; 2100225b98SGreg Roachuse Fisharebest\Webtrees\Family; 2200225b98SGreg Roachuse Fisharebest\Webtrees\Individual; 2300225b98SGreg Roachuse Mockery; 2400225b98SGreg Roach 2500225b98SGreg Roach/** 2600225b98SGreg Roach * Test harness for the class CensusColumnConditionFrenchHomme 2700225b98SGreg Roach */ 2800225b98SGreg Roachclass CensusColumnConditionFrenchHommeTest extends \PHPUnit_Framework_TestCase { 2900225b98SGreg Roach /** 3000225b98SGreg Roach * Delete mock objects 3100225b98SGreg Roach */ 3200225b98SGreg Roach public function tearDown() { 3300225b98SGreg Roach Mockery::close(); 3400225b98SGreg Roach } 3500225b98SGreg Roach 3600225b98SGreg Roach /** 3700225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 3800225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 3900225b98SGreg Roach */ 4000225b98SGreg Roach public function testNoSpouseFamiliesMale() { 4100225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 4200225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 4300225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array()); 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 CensusColumnConditionFrenchHomme($census, '', ''); 5000225b98SGreg Roach 51d8e2dd8bSGreg Roach $this->assertSame('', $column->generate($individual)); 5200225b98SGreg Roach } 5300225b98SGreg Roach 5400225b98SGreg Roach /** 5500225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 5600225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 5700225b98SGreg Roach */ 5800225b98SGreg Roach public function testNoSpouseFamiliesFemale() { 5900225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 6000225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 6100225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array()); 6200225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 6300225b98SGreg Roach 6400225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 6500225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 6600225b98SGreg Roach 6700225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 6800225b98SGreg Roach 6900225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 7000225b98SGreg Roach } 7100225b98SGreg Roach 7200225b98SGreg Roach /** 7300225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 7400225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 7500225b98SGreg Roach */ 76*e76c0cf0SGreg Roach public function testNoFamilyFactsMale() { 77*e76c0cf0SGreg Roach $spouse = Mockery::mock('Fisharebest\Webtrees\Individual'); 78*e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1850')); 79*e76c0cf0SGreg Roach 8000225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 8100225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 8200225b98SGreg Roach $family->shouldReceive('getFacts')->andReturn(array()); 83*e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 8400225b98SGreg Roach 8500225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 8600225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 8700225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 8800225b98SGreg Roach 8900225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 9000225b98SGreg Roach 9100225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 9200225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 9300225b98SGreg Roach 94d8e2dd8bSGreg Roach $this->assertSame('1', $column->generate($individual)); 9500225b98SGreg Roach } 9600225b98SGreg Roach 9700225b98SGreg Roach /** 9800225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 9900225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 10000225b98SGreg Roach */ 101*e76c0cf0SGreg Roach public function testNoFamilyFactsFemale() { 102*e76c0cf0SGreg Roach $spouse = Mockery::mock('Fisharebest\Webtrees\Individual'); 103*e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1850')); 104*e76c0cf0SGreg Roach 10500225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 10600225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 10700225b98SGreg Roach $family->shouldReceive('getFacts')->andReturn(array()); 108*e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 109*e76c0cf0SGreg Roach 110*e76c0cf0SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 111*e76c0cf0SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 112*e76c0cf0SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 113*e76c0cf0SGreg Roach 114*e76c0cf0SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 115*e76c0cf0SGreg Roach 116*e76c0cf0SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 117*e76c0cf0SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 118*e76c0cf0SGreg Roach 119*e76c0cf0SGreg Roach $this->assertSame('', $column->generate($individual)); 120*e76c0cf0SGreg Roach } 121*e76c0cf0SGreg Roach 122*e76c0cf0SGreg Roach /** 123*e76c0cf0SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 124*e76c0cf0SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 125*e76c0cf0SGreg Roach */ 126*e76c0cf0SGreg Roach public function testSpouseDeadMale() { 127*e76c0cf0SGreg Roach $spouse = Mockery::mock('Fisharebest\Webtrees\Individual'); 128*e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); 129*e76c0cf0SGreg Roach 130*e76c0cf0SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 131*e76c0cf0SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 132*e76c0cf0SGreg Roach $family->shouldReceive('getFacts')->andReturn(array()); 133*e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 134*e76c0cf0SGreg Roach 135*e76c0cf0SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 136*e76c0cf0SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 137*e76c0cf0SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 138*e76c0cf0SGreg Roach 139*e76c0cf0SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 140*e76c0cf0SGreg Roach 141*e76c0cf0SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 142*e76c0cf0SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 143*e76c0cf0SGreg Roach 144*e76c0cf0SGreg Roach $this->assertSame('', $column->generate($individual)); 145*e76c0cf0SGreg Roach } 146*e76c0cf0SGreg Roach 147*e76c0cf0SGreg Roach /** 148*e76c0cf0SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 149*e76c0cf0SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 150*e76c0cf0SGreg Roach */ 151*e76c0cf0SGreg Roach public function testSpouseDeadFemale() { 152*e76c0cf0SGreg Roach $spouse = Mockery::mock('Fisharebest\Webtrees\Individual'); 153*e76c0cf0SGreg Roach $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); 154*e76c0cf0SGreg Roach 155*e76c0cf0SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 156*e76c0cf0SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 157*e76c0cf0SGreg Roach $family->shouldReceive('getFacts')->andReturn(array()); 158*e76c0cf0SGreg Roach $family->shouldReceive('getSpouse')->andReturn($spouse); 15900225b98SGreg Roach 16000225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 16100225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 16200225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 16300225b98SGreg Roach 16400225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 16500225b98SGreg Roach 16600225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 16700225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 16800225b98SGreg Roach 16900225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 17000225b98SGreg Roach } 17100225b98SGreg Roach 17200225b98SGreg Roach /** 17300225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 17400225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 17500225b98SGreg Roach */ 17600225b98SGreg Roach public function testNoFamilyUnmarriedMale() { 17700225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 17800225b98SGreg Roach 17900225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 18000225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 18100225b98SGreg Roach $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact)); 18200225b98SGreg Roach 18300225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 18400225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 18500225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 18600225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 18700225b98SGreg Roach 18800225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 18900225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 19000225b98SGreg Roach 19100225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 19200225b98SGreg Roach 193d8e2dd8bSGreg Roach $this->assertSame('', $column->generate($individual)); 19400225b98SGreg Roach } 19500225b98SGreg Roach 19600225b98SGreg Roach /** 19700225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 19800225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 19900225b98SGreg Roach */ 20000225b98SGreg Roach public function testNoFamilyUnmarriedFemale() { 20100225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 20200225b98SGreg Roach 20300225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 20400225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 20500225b98SGreg Roach $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact)); 20600225b98SGreg Roach 20700225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 20800225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 20900225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 21000225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); 21100225b98SGreg Roach 21200225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 21300225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 21400225b98SGreg Roach 21500225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 21600225b98SGreg Roach 21700225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 21800225b98SGreg Roach } 21900225b98SGreg Roach 22000225b98SGreg Roach /** 22100225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 22200225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 22300225b98SGreg Roach */ 22400225b98SGreg Roach public function testChildMale() { 22500225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 22600225b98SGreg Roach 22700225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 22800225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 22900225b98SGreg Roach $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact)); 23000225b98SGreg Roach 23100225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 23200225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 23300225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 23400225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); 23500225b98SGreg Roach 23600225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 23700225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 23800225b98SGreg Roach 23900225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 24000225b98SGreg Roach 24100225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 24200225b98SGreg Roach } 24300225b98SGreg Roach 24400225b98SGreg Roach /** 24500225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 24600225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 24700225b98SGreg Roach */ 24800225b98SGreg Roach public function testChildFemale() { 24900225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 25000225b98SGreg Roach 25100225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 25200225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 25300225b98SGreg Roach $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact)); 25400225b98SGreg Roach 25500225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 25600225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 25700225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 25800225b98SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); 25900225b98SGreg Roach 26000225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 26100225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 26200225b98SGreg Roach 26300225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 26400225b98SGreg Roach 26500225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 26600225b98SGreg Roach } 26700225b98SGreg Roach 26800225b98SGreg Roach /** 26900225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 27000225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 27100225b98SGreg Roach */ 27200225b98SGreg Roach public function testDivorcedMale() { 27300225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 27400225b98SGreg Roach 27500225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 27600225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 27700225b98SGreg Roach $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array()); 27800225b98SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn(array($fact)); 27900225b98SGreg Roach 28000225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 28100225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 28200225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 28300225b98SGreg Roach 28400225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 28500225b98SGreg Roach 28600225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 28700225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 28800225b98SGreg Roach 289d8e2dd8bSGreg Roach $this->assertSame('1', $column->generate($individual)); 29000225b98SGreg Roach } 29100225b98SGreg Roach 29200225b98SGreg Roach /** 29300225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme 29400225b98SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 29500225b98SGreg Roach */ 29600225b98SGreg Roach public function testDivorcedFemale() { 29700225b98SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 29800225b98SGreg Roach 29900225b98SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 30000225b98SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 30100225b98SGreg Roach $family->shouldReceive('getFacts')->with('_NMR')->andReturn(array()); 30200225b98SGreg Roach $family->shouldReceive('getFacts')->with('DIV')->andReturn(array($fact)); 30300225b98SGreg Roach 30400225b98SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 30500225b98SGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 30600225b98SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 30700225b98SGreg Roach 30800225b98SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 30900225b98SGreg Roach 31000225b98SGreg Roach $column = new CensusColumnConditionFrenchHomme($census, '', ''); 31100225b98SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); 31200225b98SGreg Roach 31300225b98SGreg Roach $this->assertSame('', $column->generate($individual)); 31400225b98SGreg Roach } 31500225b98SGreg Roach} 316