xref: /webtrees/tests/app/Census/CensusColumnConditionUsTest.php (revision 9aef375d1d8983f11b518f41ee6f490c9351cbb7)
181d1be7aSGreg Roach<?php
23976b470SGreg Roach
381d1be7aSGreg Roach/**
481d1be7aSGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
681d1be7aSGreg Roach * This program is free software: you can redistribute it and/or modify
781d1be7aSGreg Roach * it under the terms of the GNU General Public License as published by
881d1be7aSGreg Roach * the Free Software Foundation, either version 3 of the License, or
981d1be7aSGreg Roach * (at your option) any later version.
1081d1be7aSGreg Roach * This program is distributed in the hope that it will be useful,
1181d1be7aSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1281d1be7aSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1381d1be7aSGreg Roach * GNU General Public License for more details.
1481d1be7aSGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
1681d1be7aSGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2081d1be7aSGreg Roachnamespace Fisharebest\Webtrees\Census;
2181d1be7aSGreg Roach
2281d1be7aSGreg Roachuse Fisharebest\Webtrees\Date;
23ddf438a5SGreg Roachuse Fisharebest\Webtrees\Fact;
24ddf438a5SGreg Roachuse Fisharebest\Webtrees\Family;
25ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
263cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
2739ca88baSGreg Roachuse Illuminate\Support\Collection;
2881d1be7aSGreg Roach
2981d1be7aSGreg Roach/**
3081d1be7aSGreg Roach * Test harness for the class CensusColumnConditionUs
3181d1be7aSGreg Roach */
323cfcc809SGreg Roachclass CensusColumnConditionUsTest extends TestCase
33c1010edaSGreg Roach{
3481d1be7aSGreg Roach    /**
3515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
3615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
3752348eb8SGreg Roach     *
3852348eb8SGreg Roach     * @return void
3981d1be7aSGreg Roach     */
409b802b22SGreg Roach    public function testNoSpouseFamiliesMale(): void
41c1010edaSGreg Roach    {
42cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
430ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
440ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection());
450ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
4681d1be7aSGreg Roach
47cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
480ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
4981d1be7aSGreg Roach
5081d1be7aSGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
5181d1be7aSGreg Roach
525e933c21SGreg Roach        self::assertSame('S', $column->generate($individual, $individual));
5381d1be7aSGreg Roach    }
5481d1be7aSGreg Roach
5581d1be7aSGreg Roach    /**
5615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
5715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
5852348eb8SGreg Roach     *
5952348eb8SGreg Roach     * @return void
6081d1be7aSGreg Roach     */
619b802b22SGreg Roach    public function testNoSpouseFamiliesFemale(): void
62c1010edaSGreg Roach    {
63cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
640ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
650ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection());
660ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
6700225b98SGreg Roach
68cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
690ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
7000225b98SGreg Roach
7100225b98SGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
7200225b98SGreg Roach
735e933c21SGreg Roach        self::assertSame('S', $column->generate($individual, $individual));
7400225b98SGreg Roach    }
7500225b98SGreg Roach
7600225b98SGreg Roach    /**
7715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
7815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
7952348eb8SGreg Roach     *
8052348eb8SGreg Roach     * @return void
8100225b98SGreg Roach     */
829b802b22SGreg Roach    public function testNoFamilyFactsMale(): void
83c1010edaSGreg Roach    {
84cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
850ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
860ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
8781d1be7aSGreg Roach
88cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
890ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
900ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
910ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
9281d1be7aSGreg Roach
93cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
9481d1be7aSGreg Roach
9581d1be7aSGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
960ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
9781d1be7aSGreg Roach
985e933c21SGreg Roach        self::assertSame('S', $column->generate($individual, $individual));
9981d1be7aSGreg Roach    }
10081d1be7aSGreg Roach
10181d1be7aSGreg Roach    /**
10215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
10315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
10452348eb8SGreg Roach     *
10552348eb8SGreg Roach     * @return void
10681d1be7aSGreg Roach     */
1079b802b22SGreg Roach    public function testNoFamilyFactsFemale(): void
108c1010edaSGreg Roach    {
109cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
1100ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
1110ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
11281d1be7aSGreg Roach
113cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
1140ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
1150ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
1160ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
11781d1be7aSGreg Roach
118cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
11981d1be7aSGreg Roach
12081d1be7aSGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
1210ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
12281d1be7aSGreg Roach
1235e933c21SGreg Roach        self::assertSame('S', $column->generate($individual, $individual));
12400225b98SGreg Roach    }
12500225b98SGreg Roach
12600225b98SGreg Roach    /**
12715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
12815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
12952348eb8SGreg Roach     *
13052348eb8SGreg Roach     * @return void
13100225b98SGreg Roach     */
1329b802b22SGreg Roach    public function testSpouseDeadMale(): void
133c1010edaSGreg Roach    {
134cd94ca66SGreg Roach        $fact = $this->createMock(Fact::class);
1352a6fda60SGreg Roach
136cd94ca66SGreg Roach        $spouse = $this->createMock(Individual::class);
1370ecdbde6SGreg Roach        $spouse->method('getDeathDate')->willReturn(new Date('1820'));
138e76c0cf0SGreg Roach
139cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
140109b3e30SGreg Roach        $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date(''));
141109b3e30SGreg Roach        $family->expects(self::exactly(2))
142109b3e30SGreg Roach            ->method('facts')
143*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
144109b3e30SGreg Roach            ->willReturnOnConsecutiveCalls(
145109b3e30SGreg Roach                new Collection([$fact]),
146109b3e30SGreg Roach                new Collection()
147109b3e30SGreg Roach            );
148109b3e30SGreg Roach        $family->expects(self::once())->method('spouse')->willReturn($spouse);
149e76c0cf0SGreg Roach
150cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
1510ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
1520ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
153e76c0cf0SGreg Roach
154cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
155e76c0cf0SGreg Roach
156e76c0cf0SGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
1570ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
158e76c0cf0SGreg Roach
1595e933c21SGreg Roach        self::assertSame('W', $column->generate($individual, $individual));
160e76c0cf0SGreg Roach    }
161e76c0cf0SGreg Roach
162e76c0cf0SGreg Roach    /**
16315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
16415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
16552348eb8SGreg Roach     *
16652348eb8SGreg Roach     * @return void
167e76c0cf0SGreg Roach     */
1689b802b22SGreg Roach    public function testSpouseDeadFemale(): void
169c1010edaSGreg Roach    {
170cd94ca66SGreg Roach        $fact = $this->createMock(Fact::class);
1712a6fda60SGreg Roach
172cd94ca66SGreg Roach        $spouse = $this->createMock(Individual::class);
1730ecdbde6SGreg Roach        $spouse->method('getDeathDate')->willReturn(new Date('1820'));
174e76c0cf0SGreg Roach
175cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
176109b3e30SGreg Roach        $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date(''));
177109b3e30SGreg Roach        $family
178109b3e30SGreg Roach            ->expects(self::exactly(2))
179109b3e30SGreg Roach            ->method('facts')
180*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
181109b3e30SGreg Roach            ->willReturnOnConsecutiveCalls(
182109b3e30SGreg Roach                new Collection([$fact]),
183109b3e30SGreg Roach                new Collection()
184109b3e30SGreg Roach            );
185109b3e30SGreg Roach        $family->expects(self::once())->method('spouse')->willReturn($spouse);
186e76c0cf0SGreg Roach
187cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
1880ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
1890ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
190e76c0cf0SGreg Roach
191cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
192e76c0cf0SGreg Roach
193e76c0cf0SGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
1940ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
195e76c0cf0SGreg Roach
1965e933c21SGreg Roach        self::assertSame('W', $column->generate($individual, $individual));
197e76c0cf0SGreg Roach    }
198e76c0cf0SGreg Roach
199e76c0cf0SGreg Roach    /**
20015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
20115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
20252348eb8SGreg Roach     *
20352348eb8SGreg Roach     * @return void
204e76c0cf0SGreg Roach     */
2059b802b22SGreg Roach    public function testNoFamilyUnmarriedMale(): void
206c1010edaSGreg Roach    {
207cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
2080ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2090ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
21000225b98SGreg Roach
211cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
2120ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
2130ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2140ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
21500225b98SGreg Roach
216cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
2170ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
21800225b98SGreg Roach
21900225b98SGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
22000225b98SGreg Roach
2215e933c21SGreg Roach        self::assertSame('S', $column->generate($individual, $individual));
22281d1be7aSGreg Roach    }
22381d1be7aSGreg Roach
22481d1be7aSGreg Roach    /**
22515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
22615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
22752348eb8SGreg Roach     *
22852348eb8SGreg Roach     * @return void
22981d1be7aSGreg Roach     */
2309b802b22SGreg Roach    public function testNoFamilyUnmarriedFemale(): void
231c1010edaSGreg Roach    {
232cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
2330ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2340ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
23500225b98SGreg Roach
236cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
2370ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
2380ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2390ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
24000225b98SGreg Roach
241cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
2420ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
24300225b98SGreg Roach
24400225b98SGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
24500225b98SGreg Roach
2465e933c21SGreg Roach        self::assertSame('S', $column->generate($individual, $individual));
24700225b98SGreg Roach    }
24800225b98SGreg Roach
24900225b98SGreg Roach    /**
25015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
25115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
25252348eb8SGreg Roach     *
25352348eb8SGreg Roach     * @return void
25400225b98SGreg Roach     */
2559b802b22SGreg Roach    public function testChildMale(): void
256c1010edaSGreg Roach    {
257cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
2580ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2590ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
26000225b98SGreg Roach
261cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
2620ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
2630ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2640ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820'));
26500225b98SGreg Roach
266cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
2670ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
26800225b98SGreg Roach
26900225b98SGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
27000225b98SGreg Roach
2715e933c21SGreg Roach        self::assertSame('S', $column->generate($individual, $individual));
27200225b98SGreg Roach    }
27300225b98SGreg Roach
27400225b98SGreg Roach    /**
27515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
27615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
27752348eb8SGreg Roach     *
27852348eb8SGreg Roach     * @return void
27900225b98SGreg Roach     */
2809b802b22SGreg Roach    public function testChildFemale(): void
281c1010edaSGreg Roach    {
282cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
2830ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2840ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
28500225b98SGreg Roach
286cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
2870ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
2880ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2890ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820'));
29000225b98SGreg Roach
291cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
2920ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
29300225b98SGreg Roach
29400225b98SGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
29500225b98SGreg Roach
2965e933c21SGreg Roach        self::assertSame('S', $column->generate($individual, $individual));
29700225b98SGreg Roach    }
29800225b98SGreg Roach
29900225b98SGreg Roach    /**
30015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
30115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
30252348eb8SGreg Roach     *
30352348eb8SGreg Roach     * @return void
30400225b98SGreg Roach     */
3059b802b22SGreg Roach    public function testDivorcedMale(): void
306c1010edaSGreg Roach    {
307cd94ca66SGreg Roach        $fact = $this->createMock(Fact::class);
30881d1be7aSGreg Roach
309cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
310109b3e30SGreg Roach        $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date(''));
311109b3e30SGreg Roach        $family
312109b3e30SGreg Roach            ->expects(self::exactly(2))
313109b3e30SGreg Roach            ->method('facts')
314*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
315*9aef375dSGreg Roach            ->willReturnOnConsecutiveCalls(
316109b3e30SGreg Roach                new Collection([$fact]),
317109b3e30SGreg Roach                new Collection([$fact])
318109b3e30SGreg Roach            );
31981d1be7aSGreg Roach
320cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
3210ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
3220ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
32300225b98SGreg Roach
324cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
32500225b98SGreg Roach
32600225b98SGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
3270ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
32800225b98SGreg Roach
3295e933c21SGreg Roach        self::assertSame('D', $column->generate($individual, $individual));
33000225b98SGreg Roach    }
33100225b98SGreg Roach
33200225b98SGreg Roach    /**
33315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
33415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
33552348eb8SGreg Roach     *
33652348eb8SGreg Roach     * @return void
33700225b98SGreg Roach     */
3389b802b22SGreg Roach    public function testDivorcedFemale(): void
339c1010edaSGreg Roach    {
340cd94ca66SGreg Roach        $fact = $this->createMock(Fact::class);
34100225b98SGreg Roach
342cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
343109b3e30SGreg Roach        $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date(''));
344109b3e30SGreg Roach        $family
345109b3e30SGreg Roach            ->expects(self::exactly(2))
346109b3e30SGreg Roach            ->method('facts')
347*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
348*9aef375dSGreg Roach            ->willReturnOnConsecutiveCalls(
349109b3e30SGreg Roach                new Collection([$fact]),
350109b3e30SGreg Roach                new Collection([$fact])
351109b3e30SGreg Roach            );
35200225b98SGreg Roach
353cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
3540ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
3550ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
35681d1be7aSGreg Roach
357cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
35881d1be7aSGreg Roach
35981d1be7aSGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
3600ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
36181d1be7aSGreg Roach
3625e933c21SGreg Roach        self::assertSame('D', $column->generate($individual, $individual));
36381d1be7aSGreg Roach    }
364b72623feSGreg Roach
365b72623feSGreg Roach    /**
366b72623feSGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
367b72623feSGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
368b72623feSGreg Roach     *
369b72623feSGreg Roach     * @return void
370b72623feSGreg Roach     */
371b72623feSGreg Roach    public function testMarriedMale(): void
372b72623feSGreg Roach    {
373cd94ca66SGreg Roach        $fact = $this->createMock(Fact::class);
374b72623feSGreg Roach
375cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
376b72623feSGreg Roach        $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date(''));
377b72623feSGreg Roach        $family
378b72623feSGreg Roach            ->expects(self::exactly(2))
379b72623feSGreg Roach            ->method('facts')
380*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
381*9aef375dSGreg Roach            ->willReturnOnConsecutiveCalls(
382b72623feSGreg Roach                new Collection([$fact]),
383b72623feSGreg Roach                new Collection()
384b72623feSGreg Roach            );
385b72623feSGreg Roach
386cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
387b72623feSGreg Roach        $individual->method('sex')->willReturn('M');
388b72623feSGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
389b72623feSGreg Roach
390cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
391b72623feSGreg Roach
392b72623feSGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
393b72623feSGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
394b72623feSGreg Roach
395b72623feSGreg Roach        self::assertSame('M', $column->generate($individual, $individual));
396b72623feSGreg Roach    }
397b72623feSGreg Roach
398b72623feSGreg Roach    /**
399b72623feSGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionUs
400b72623feSGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
401b72623feSGreg Roach     *
402b72623feSGreg Roach     * @return void
403b72623feSGreg Roach     */
404b72623feSGreg Roach    public function testMarriedFemale(): void
405b72623feSGreg Roach    {
406cd94ca66SGreg Roach        $fact = $this->createMock(Fact::class);
407b72623feSGreg Roach
408cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
409b72623feSGreg Roach        $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date(''));
410b72623feSGreg Roach        $family
411b72623feSGreg Roach            ->expects(self::exactly(2))
412b72623feSGreg Roach            ->method('facts')
413*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
414*9aef375dSGreg Roach            ->willReturnOnConsecutiveCalls(
415b72623feSGreg Roach                new Collection([$fact]),
416b72623feSGreg Roach                new Collection()
417b72623feSGreg Roach            );
418b72623feSGreg Roach
419cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
420b72623feSGreg Roach        $individual->method('sex')->willReturn('F');
421b72623feSGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
422b72623feSGreg Roach
423cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
424b72623feSGreg Roach
425b72623feSGreg Roach        $column = new CensusColumnConditionUs($census, '', '');
426b72623feSGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
427b72623feSGreg Roach
428b72623feSGreg Roach        self::assertSame('M', $column->generate($individual, $individual));
429b72623feSGreg Roach    }
43081d1be7aSGreg Roach}
431