1da3cb887Sglarwill<?php 2da3cb887Sglarwill 3da3cb887Sglarwill/** 4da3cb887Sglarwill * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 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 { 42cd94ca66SGreg 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 47cd94ca66SGreg 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 { 63cd94ca66SGreg 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 68cd94ca66SGreg 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 { 84cd94ca66SGreg Roach $family = $this->createMock(Family::class); 85da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 86da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 87da3cb887Sglarwill 88cd94ca66SGreg 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 93cd94ca66SGreg 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 { 109cd94ca66SGreg Roach $family = $this->createMock(Family::class); 110da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 111da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 112da3cb887Sglarwill 113cd94ca66SGreg 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 118cd94ca66SGreg 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 { 134cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 135da3cb887Sglarwill 136cd94ca66SGreg Roach $spouse = $this->createMock(Individual::class); 137da3cb887Sglarwill $spouse->method('getDeathDate')->willReturn(new Date('1820')); 138da3cb887Sglarwill 139cd94ca66SGreg 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') 143*9aef375dSGreg Roach ->with(self::withConsecutive([['MARR'], ['DIV']])) 144da3cb887Sglarwill ->willReturnOnConsecutiveCalls( 145da3cb887Sglarwill new Collection([$fact]), 146da3cb887Sglarwill new Collection() 147da3cb887Sglarwill ); 148da3cb887Sglarwill $family->expects(self::once())->method('spouse')->willReturn($spouse); 149da3cb887Sglarwill 150cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 151da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 152da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 153da3cb887Sglarwill 154cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 155da3cb887Sglarwill 156da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 157da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 158da3cb887Sglarwill 159da3cb887Sglarwill self::assertSame('W', $column->generate($individual, $individual)); 160da3cb887Sglarwill } 161da3cb887Sglarwill 162da3cb887Sglarwill /** 163da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 164da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 165da3cb887Sglarwill * 166da3cb887Sglarwill * @return void 167da3cb887Sglarwill */ 168da3cb887Sglarwill public function testSpouseDeadFemale(): void 169da3cb887Sglarwill { 170cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 171da3cb887Sglarwill 172cd94ca66SGreg Roach $spouse = $this->createMock(Individual::class); 173da3cb887Sglarwill $spouse->method('getDeathDate')->willReturn(new Date('1820')); 174da3cb887Sglarwill 175cd94ca66SGreg Roach $family = $this->createMock(Family::class); 176da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 177da3cb887Sglarwill $family 178da3cb887Sglarwill ->expects(self::exactly(2)) 179da3cb887Sglarwill ->method('facts') 180*9aef375dSGreg Roach ->with(self::withConsecutive([['MARR'], ['DIV']])) 181da3cb887Sglarwill ->willReturnOnConsecutiveCalls( 182da3cb887Sglarwill new Collection([$fact]), 183da3cb887Sglarwill new Collection() 184da3cb887Sglarwill ); 185da3cb887Sglarwill $family->expects(self::once())->method('spouse')->willReturn($spouse); 186da3cb887Sglarwill 187cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 188da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 189da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 190da3cb887Sglarwill 191cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 192da3cb887Sglarwill 193da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 194da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 195da3cb887Sglarwill 196da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 197da3cb887Sglarwill } 198da3cb887Sglarwill 199da3cb887Sglarwill /** 200da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 201da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 202da3cb887Sglarwill * 203da3cb887Sglarwill * @return void 204da3cb887Sglarwill */ 205da3cb887Sglarwill public function testNoFamilyUnmarriedMale(): void 206da3cb887Sglarwill { 207cd94ca66SGreg Roach $family = $this->createMock(Family::class); 208da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 209da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 210da3cb887Sglarwill 211cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 212da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 213da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 214da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800')); 215da3cb887Sglarwill 216cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 217da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 218da3cb887Sglarwill 219da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 220da3cb887Sglarwill 221da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 222da3cb887Sglarwill } 223da3cb887Sglarwill 224da3cb887Sglarwill /** 225da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 226da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 227da3cb887Sglarwill * 228da3cb887Sglarwill * @return void 229da3cb887Sglarwill */ 230da3cb887Sglarwill public function testNoFamilyUnmarriedFemale(): void 231da3cb887Sglarwill { 232cd94ca66SGreg Roach $family = $this->createMock(Family::class); 233da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 234da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 235da3cb887Sglarwill 236cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 237da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 238da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 239da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800')); 240da3cb887Sglarwill 241cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 242da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 243da3cb887Sglarwill 244da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 245da3cb887Sglarwill 246da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 247da3cb887Sglarwill } 248da3cb887Sglarwill 249da3cb887Sglarwill /** 250da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 251da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 252da3cb887Sglarwill * 253da3cb887Sglarwill * @return void 254da3cb887Sglarwill */ 255da3cb887Sglarwill public function testChildMale(): void 256da3cb887Sglarwill { 257cd94ca66SGreg Roach $family = $this->createMock(Family::class); 258da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 259da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 260da3cb887Sglarwill 261cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 262da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 263da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 264da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820')); 265da3cb887Sglarwill 266cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 267da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 268da3cb887Sglarwill 269da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 270da3cb887Sglarwill 271da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 272da3cb887Sglarwill } 273da3cb887Sglarwill 274da3cb887Sglarwill /** 275da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 276da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 277da3cb887Sglarwill * 278da3cb887Sglarwill * @return void 279da3cb887Sglarwill */ 280da3cb887Sglarwill public function testChildFemale(): void 281da3cb887Sglarwill { 282cd94ca66SGreg Roach $family = $this->createMock(Family::class); 283da3cb887Sglarwill $family->method('getMarriageDate')->willReturn(new Date('')); 284da3cb887Sglarwill $family->method('facts')->with(['MARR'])->willReturn(new Collection()); 285da3cb887Sglarwill 286cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 287da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 288da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 289da3cb887Sglarwill $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820')); 290da3cb887Sglarwill 291cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 292da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 293da3cb887Sglarwill 294da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 295da3cb887Sglarwill 296da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 297da3cb887Sglarwill } 298da3cb887Sglarwill 299da3cb887Sglarwill /** 300da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 301da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 302da3cb887Sglarwill * 303da3cb887Sglarwill * @return void 304da3cb887Sglarwill */ 305da3cb887Sglarwill public function testDivorcedMale(): void 306da3cb887Sglarwill { 307cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 308da3cb887Sglarwill 309cd94ca66SGreg Roach $family = $this->createMock(Family::class); 310da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 311da3cb887Sglarwill $family 312da3cb887Sglarwill ->expects(self::exactly(2)) 313da3cb887Sglarwill ->method('facts') 314*9aef375dSGreg Roach ->with(self::withConsecutive([['MARR'], ['DIV']])) 315*9aef375dSGreg Roach ->willReturnOnConsecutiveCalls( 316da3cb887Sglarwill new Collection([$fact]), 317da3cb887Sglarwill new Collection([$fact]) 318da3cb887Sglarwill ); 319da3cb887Sglarwill 320cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 321da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 322da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 323da3cb887Sglarwill 324cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 325da3cb887Sglarwill 326da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 327da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 328da3cb887Sglarwill 329da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 330da3cb887Sglarwill } 331da3cb887Sglarwill 332da3cb887Sglarwill /** 333da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 334da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 335da3cb887Sglarwill * 336da3cb887Sglarwill * @return void 337da3cb887Sglarwill */ 338da3cb887Sglarwill public function testDivorcedFemale(): void 339da3cb887Sglarwill { 340cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 341da3cb887Sglarwill 342cd94ca66SGreg Roach $family = $this->createMock(Family::class); 343da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 344da3cb887Sglarwill $family 345da3cb887Sglarwill ->expects(self::exactly(2)) 346da3cb887Sglarwill ->method('facts') 347*9aef375dSGreg Roach ->with(self::withConsecutive([['MARR'], ['DIV']])) 348*9aef375dSGreg Roach ->willReturnOnConsecutiveCalls( 349da3cb887Sglarwill new Collection([$fact]), 350da3cb887Sglarwill new Collection([$fact]) 351da3cb887Sglarwill ); 352da3cb887Sglarwill 353cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 354da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 355da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 356da3cb887Sglarwill 357cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 358da3cb887Sglarwill 359da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 360da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 361da3cb887Sglarwill 362da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 363da3cb887Sglarwill } 364da3cb887Sglarwill 365da3cb887Sglarwill /** 366da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 367da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 368da3cb887Sglarwill * 369da3cb887Sglarwill * @return void 370da3cb887Sglarwill */ 371da3cb887Sglarwill public function testMarriedMale(): void 372da3cb887Sglarwill { 373cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 374da3cb887Sglarwill 375cd94ca66SGreg Roach $family = $this->createMock(Family::class); 376da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 377da3cb887Sglarwill $family 378da3cb887Sglarwill ->expects(self::exactly(2)) 379da3cb887Sglarwill ->method('facts') 380*9aef375dSGreg Roach ->with(self::withConsecutive([['MARR'], ['DIV']])) 381*9aef375dSGreg Roach ->willReturnOnConsecutiveCalls( 382da3cb887Sglarwill new Collection([$fact]), 383da3cb887Sglarwill new Collection() 384da3cb887Sglarwill ); 385da3cb887Sglarwill 386cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 387da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 388da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 389da3cb887Sglarwill 390cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 391da3cb887Sglarwill 392da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 393da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 394da3cb887Sglarwill 395da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 396da3cb887Sglarwill } 397da3cb887Sglarwill 398da3cb887Sglarwill /** 399da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionCanadaWidowedMale 400da3cb887Sglarwill * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition 401da3cb887Sglarwill * 402da3cb887Sglarwill * @return void 403da3cb887Sglarwill */ 404da3cb887Sglarwill public function testMarriedFemale(): void 405da3cb887Sglarwill { 406cd94ca66SGreg Roach $fact = $this->createMock(Fact::class); 407da3cb887Sglarwill 408cd94ca66SGreg Roach $family = $this->createMock(Family::class); 409da3cb887Sglarwill $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); 410da3cb887Sglarwill $family 411da3cb887Sglarwill ->expects(self::exactly(2)) 412da3cb887Sglarwill ->method('facts') 413*9aef375dSGreg Roach ->with(self::withConsecutive([['MARR'], ['DIV']])) 414*9aef375dSGreg Roach ->willReturnOnConsecutiveCalls( 415da3cb887Sglarwill new Collection([$fact]), 416da3cb887Sglarwill new Collection() 417da3cb887Sglarwill ); 418da3cb887Sglarwill 419cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 420da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 421da3cb887Sglarwill $individual->method('spouseFamilies')->willReturn(new Collection([$family])); 422da3cb887Sglarwill 423cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 424da3cb887Sglarwill 425da3cb887Sglarwill $column = new CensusColumnConditionCanadaWidowedMale($census, '', ''); 426da3cb887Sglarwill $census->method('censusDate')->willReturn('30 JUN 1830'); 427da3cb887Sglarwill 428da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 429da3cb887Sglarwill } 430da3cb887Sglarwill} 431