1da3cb887Sglarwill<?php 2da3cb887Sglarwill 3da3cb887Sglarwill/** 4da3cb887Sglarwill * webtrees: online genealogy 5da3cb887Sglarwill * Copyright (C) 2021 webtrees development team 6da3cb887Sglarwill * This program is free software: you can redistribute it and/or modify 7da3cb887Sglarwill * it under the terms of the GNU General Public License as published by 8da3cb887Sglarwill * the Free Software Foundation, either version 3 of the License, or 9da3cb887Sglarwill * (at your option) any later version. 10da3cb887Sglarwill * This program is distributed in the hope that it will be useful, 11da3cb887Sglarwill * but WITHOUT ANY WARRANTY; without even the implied warranty of 12da3cb887Sglarwill * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13da3cb887Sglarwill * GNU General Public License for more details. 14da3cb887Sglarwill * You should have received a copy of the GNU General Public License 15da3cb887Sglarwill * along with this program. If not, see <https://www.gnu.org/licenses/>. 16da3cb887Sglarwill */ 17da3cb887Sglarwill 18da3cb887Sglarwilldeclare(strict_types=1); 19da3cb887Sglarwill 20da3cb887Sglarwillnamespace Fisharebest\Webtrees\Census; 21da3cb887Sglarwill 22da3cb887Sglarwilluse Fisharebest\Webtrees\Date; 23da3cb887Sglarwilluse Fisharebest\Webtrees\Fact; 24da3cb887Sglarwilluse Fisharebest\Webtrees\Family; 25da3cb887Sglarwilluse Fisharebest\Webtrees\Individual; 26da3cb887Sglarwilluse Fisharebest\Webtrees\TestCase; 27da3cb887Sglarwilluse Illuminate\Support\Collection; 28da3cb887Sglarwill 29da3cb887Sglarwill/** 30da3cb887Sglarwill * Test harness for the class CensusColumnConditionCanadaWidowedMale 31da3cb887Sglarwill */ 32da3cb887Sglarwillclass CensusColumnConditionCanadaWidowedMaleTest extends TestCase 33da3cb887Sglarwill{ 34da3cb887Sglarwill /** 35da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 36da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 37da3cb887Sglarwill * 38da3cb887Sglarwill * @return void 39da3cb887Sglarwill */ 40da3cb887Sglarwill public function testNoSpouseFamiliesMale(): void 41da3cb887Sglarwill { 42*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 43da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 44da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection()); 45da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800')); 46da3cb887Sglarwill 47*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 48da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 49da3cb887Sglarwill 50da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 51da3cb887Sglarwill 52da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 53da3cb887Sglarwill } 54da3cb887Sglarwill 55da3cb887Sglarwill /** 56da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 57da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 58da3cb887Sglarwill * 59da3cb887Sglarwill * @return void 60da3cb887Sglarwill */ 61da3cb887Sglarwill public function testNoSpouseFamiliesFemale(): void 62da3cb887Sglarwill { 63*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 64da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 65da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection()); 66da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800')); 67da3cb887Sglarwill 68*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 69da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 70da3cb887Sglarwill 71da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 72da3cb887Sglarwill 73da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 74da3cb887Sglarwill } 75da3cb887Sglarwill 76da3cb887Sglarwill /** 77da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 78da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 79da3cb887Sglarwill * 80da3cb887Sglarwill * @return void 81da3cb887Sglarwill */ 82da3cb887Sglarwill public function testNoFamilyFactsMale(): void 83da3cb887Sglarwill { 84*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 85da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 86da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 87da3cb887Sglarwill 88*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 89da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 90da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800')); 91da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 92da3cb887Sglarwill 93*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 94da3cb887Sglarwill 95da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 96da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 97da3cb887Sglarwill 98da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 99da3cb887Sglarwill } 100da3cb887Sglarwill 101da3cb887Sglarwill /** 102da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 103da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 104da3cb887Sglarwill * 105da3cb887Sglarwill * @return void 106da3cb887Sglarwill */ 107da3cb887Sglarwill public function testNoFamilyFactsFemale(): void 108da3cb887Sglarwill { 109*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 110da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 111da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 112da3cb887Sglarwill 113*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 114da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 115da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800')); 116da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 117da3cb887Sglarwill 118*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 119da3cb887Sglarwill 120da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 121da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 122da3cb887Sglarwill 123da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 124da3cb887Sglarwill } 125da3cb887Sglarwill 126da3cb887Sglarwill /** 127da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 128da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 129da3cb887Sglarwill * 130da3cb887Sglarwill * @return void 131da3cb887Sglarwill */ 132da3cb887Sglarwill public function testSpouseDeadMale(): void 133da3cb887Sglarwill { 134*cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 135da3cb887Sglarwill 136*cd94ca66SGreg Roach $spouse = $this->createMock(Individual::class); 137da3cb887Sglarwill $spouse->method('getDeathDate')->willReturn(new Date('1820')); 138da3cb887Sglarwill 139*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 140da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 141da3cb887Sglarwill $family->expects(self::exactly(2)) 142da3cb887Sglarwill ->method('facts') 143da3cb887Sglarwill ->withConsecutive( 144da3cb887Sglarwill [['MARR']], 145da3cb887Sglarwill [['DIV']] 146da3cb887Sglarwill ) 147da3cb887Sglarwill ->willReturnOnConsecutiveCalls( 148da3cb887Sglarwill new Collection([$fact]), 149da3cb887Sglarwill new Collection() 150da3cb887Sglarwill ); 151da3cb887Sglarwill $family->expects(self::once())->method('spouse')->willReturn($spouse); 152da3cb887Sglarwill 153*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 154da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 155da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 156da3cb887Sglarwill 157*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 158da3cb887Sglarwill 159da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 160da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 161da3cb887Sglarwill 162da3cb887Sglarwill self::assertSame('W', $column->generate($individual, $individual)); 163da3cb887Sglarwill } 164da3cb887Sglarwill 165da3cb887Sglarwill /** 166da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 167da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 168da3cb887Sglarwill * 169da3cb887Sglarwill * @return void 170da3cb887Sglarwill */ 171da3cb887Sglarwill public function testSpouseDeadFemale(): void 172da3cb887Sglarwill { 173*cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 174da3cb887Sglarwill 175*cd94ca66SGreg Roach $spouse = $this->createMock(Individual::class); 176da3cb887Sglarwill $spouse->method('getDeathDate')->willReturn(new Date('1820')); 177da3cb887Sglarwill 178*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 179da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 180da3cb887Sglarwill $family 181da3cb887Sglarwill ->expects(self::exactly(2)) 182da3cb887Sglarwill ->method('facts') 183da3cb887Sglarwill ->withConsecutive( 184da3cb887Sglarwill [['MARR']], 185da3cb887Sglarwill [['DIV']] 186da3cb887Sglarwill ) 187da3cb887Sglarwill ->willReturnOnConsecutiveCalls( 188da3cb887Sglarwill new Collection([$fact]), 189da3cb887Sglarwill new Collection() 190da3cb887Sglarwill ); 191da3cb887Sglarwill $family->expects(self::once())->method('spouse')->willReturn($spouse); 192da3cb887Sglarwill 193*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 194da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 195da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 196da3cb887Sglarwill 197*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 198da3cb887Sglarwill 199da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 200da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 201da3cb887Sglarwill 202da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 203da3cb887Sglarwill } 204da3cb887Sglarwill 205da3cb887Sglarwill /** 206da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 207da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 208da3cb887Sglarwill * 209da3cb887Sglarwill * @return void 210da3cb887Sglarwill */ 211da3cb887Sglarwill public function testNoFamilyUnmarriedMale(): void 212da3cb887Sglarwill { 213*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 214da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 215da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 216da3cb887Sglarwill 217*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 218da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 219da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 220da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800')); 221da3cb887Sglarwill 222*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 223da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 224da3cb887Sglarwill 225da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 226da3cb887Sglarwill 227da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 228da3cb887Sglarwill } 229da3cb887Sglarwill 230da3cb887Sglarwill /** 231da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 232da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 233da3cb887Sglarwill * 234da3cb887Sglarwill * @return void 235da3cb887Sglarwill */ 236da3cb887Sglarwill public function testNoFamilyUnmarriedFemale(): void 237da3cb887Sglarwill { 238*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 239da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 240da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 241da3cb887Sglarwill 242*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 243da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 244da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 245da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800')); 246da3cb887Sglarwill 247*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 248da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 249da3cb887Sglarwill 250da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 251da3cb887Sglarwill 252da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 253da3cb887Sglarwill } 254da3cb887Sglarwill 255da3cb887Sglarwill /** 256da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 257da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 258da3cb887Sglarwill * 259da3cb887Sglarwill * @return void 260da3cb887Sglarwill */ 261da3cb887Sglarwill public function testChildMale(): void 262da3cb887Sglarwill { 263*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 264da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 265da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 266da3cb887Sglarwill 267*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 268da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 269da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 270da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820')); 271da3cb887Sglarwill 272*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 273da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 274da3cb887Sglarwill 275da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 276da3cb887Sglarwill 277da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 278da3cb887Sglarwill } 279da3cb887Sglarwill 280da3cb887Sglarwill /** 281da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 282da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 283da3cb887Sglarwill * 284da3cb887Sglarwill * @return void 285da3cb887Sglarwill */ 286da3cb887Sglarwill public function testChildFemale(): void 287da3cb887Sglarwill { 288*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 289da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 290da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 291da3cb887Sglarwill 292*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 293da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 294da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 295da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820')); 296da3cb887Sglarwill 297*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 298da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 299da3cb887Sglarwill 300da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 301da3cb887Sglarwill 302da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 303da3cb887Sglarwill } 304da3cb887Sglarwill 305da3cb887Sglarwill /** 306da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 307da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 308da3cb887Sglarwill * 309da3cb887Sglarwill * @return void 310da3cb887Sglarwill */ 311da3cb887Sglarwill public function testDivorcedMale(): void 312da3cb887Sglarwill { 313*cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 314da3cb887Sglarwill 315*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 316da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 317da3cb887Sglarwill $family 318da3cb887Sglarwill ->expects(self::exactly(2)) 319da3cb887Sglarwill ->method('facts') 320da3cb887Sglarwill ->withConsecutive( 321da3cb887Sglarwill [['MARR']], 322da3cb887Sglarwill [['DIV']] 323da3cb887Sglarwill )->willReturnOnConsecutiveCalls( 324da3cb887Sglarwill new Collection([$fact]), 325da3cb887Sglarwill new Collection([$fact]) 326da3cb887Sglarwill ); 327da3cb887Sglarwill 328*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 329da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 330da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 331da3cb887Sglarwill 332*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 333da3cb887Sglarwill 334da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 335da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 336da3cb887Sglarwill 337da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 338da3cb887Sglarwill } 339da3cb887Sglarwill 340da3cb887Sglarwill /** 341da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 342da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 343da3cb887Sglarwill * 344da3cb887Sglarwill * @return void 345da3cb887Sglarwill */ 346da3cb887Sglarwill public function testDivorcedFemale(): void 347da3cb887Sglarwill { 348*cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 349da3cb887Sglarwill 350*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 351da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 352da3cb887Sglarwill $family 353da3cb887Sglarwill ->expects(self::exactly(2)) 354da3cb887Sglarwill ->method('facts') 355da3cb887Sglarwill ->withConsecutive( 356da3cb887Sglarwill [['MARR']], 357da3cb887Sglarwill [['DIV']] 358da3cb887Sglarwill )->willReturnOnConsecutiveCalls( 359da3cb887Sglarwill new Collection([$fact]), 360da3cb887Sglarwill new Collection([$fact]) 361da3cb887Sglarwill ); 362da3cb887Sglarwill 363*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 364da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 365da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 366da3cb887Sglarwill 367*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 368da3cb887Sglarwill 369da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 370da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 371da3cb887Sglarwill 372da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 373da3cb887Sglarwill } 374da3cb887Sglarwill 375da3cb887Sglarwill /** 376da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 377da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 378da3cb887Sglarwill * 379da3cb887Sglarwill * @return void 380da3cb887Sglarwill */ 381da3cb887Sglarwill public function testMarriedMale(): void 382da3cb887Sglarwill { 383*cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 384da3cb887Sglarwill 385*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 386da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 387da3cb887Sglarwill $family 388da3cb887Sglarwill ->expects(self::exactly(2)) 389da3cb887Sglarwill ->method('facts') 390da3cb887Sglarwill ->withConsecutive( 391da3cb887Sglarwill [['MARR']], 392da3cb887Sglarwill [['DIV']] 393da3cb887Sglarwill )->willReturnOnConsecutiveCalls( 394da3cb887Sglarwill new Collection([$fact]), 395da3cb887Sglarwill new Collection() 396da3cb887Sglarwill ); 397da3cb887Sglarwill 398*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 399da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 400da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 401da3cb887Sglarwill 402*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 403da3cb887Sglarwill 404da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 405da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 406da3cb887Sglarwill 407da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 408da3cb887Sglarwill } 409da3cb887Sglarwill 410da3cb887Sglarwill /** 411da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 412da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 413da3cb887Sglarwill * 414da3cb887Sglarwill * @return void 415da3cb887Sglarwill */ 416da3cb887Sglarwill public function testMarriedFemale(): void 417da3cb887Sglarwill { 418*cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 419da3cb887Sglarwill 420*cd94ca66SGreg Roach $family = $this->createMock(Family::class); 421da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 422da3cb887Sglarwill $family 423da3cb887Sglarwill ->expects(self::exactly(2)) 424da3cb887Sglarwill ->method('facts') 425da3cb887Sglarwill ->withConsecutive( 426da3cb887Sglarwill [['MARR']], 427da3cb887Sglarwill [['DIV']] 428da3cb887Sglarwill )->willReturnOnConsecutiveCalls( 429da3cb887Sglarwill new Collection([$fact]), 430da3cb887Sglarwill new Collection() 431da3cb887Sglarwill ); 432da3cb887Sglarwill 433*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 434da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 435da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 436da3cb887Sglarwill 437*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 438da3cb887Sglarwill 439da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 440da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 441da3cb887Sglarwill 442da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 443da3cb887Sglarwill } 444da3cb887Sglarwill} 445