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