xref: /webtrees/tests/app/Census/CensusColumnConditionFrenchFemmeTest.php (revision 9aef375d1d8983f11b518f41ee6f490c9351cbb7)
100225b98SGreg Roach<?php
23976b470SGreg Roach
300225b98SGreg Roach/**
400225b98SGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
600225b98SGreg Roach * This program is free software: you can redistribute it and/or modify
700225b98SGreg Roach * it under the terms of the GNU General Public License as published by
800225b98SGreg Roach * the Free Software Foundation, either version 3 of the License, or
900225b98SGreg Roach * (at your option) any later version.
1000225b98SGreg Roach * This program is distributed in the hope that it will be useful,
1100225b98SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1200225b98SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1300225b98SGreg Roach * GNU General Public License for more details.
1400225b98SGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
1600225b98SGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2000225b98SGreg Roachnamespace Fisharebest\Webtrees\Census;
2100225b98SGreg Roach
2200225b98SGreg 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;
2800225b98SGreg Roach
2900225b98SGreg Roach/**
3000225b98SGreg Roach * Test harness for the class CensusColumnConditionFrenchFemme
3100225b98SGreg Roach */
323cfcc809SGreg Roachclass CensusColumnConditionFrenchFemmeTest extends TestCase
33c1010edaSGreg Roach{
3400225b98SGreg Roach    /**
3515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
3615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
3752348eb8SGreg Roach     *
3852348eb8SGreg Roach     * @return void
3900225b98SGreg 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'));
4600225b98SGreg Roach
47cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
480ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
4900225b98SGreg Roach
5000225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
5100225b98SGreg Roach
525e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
5300225b98SGreg Roach    }
5400225b98SGreg Roach
5500225b98SGreg Roach    /**
5615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
5715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
5852348eb8SGreg Roach     *
5952348eb8SGreg Roach     * @return void
6000225b98SGreg 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 CensusColumnConditionFrenchFemme($census, '', '');
7200225b98SGreg Roach
735e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
7400225b98SGreg Roach    }
7500225b98SGreg Roach
7600225b98SGreg Roach    /**
7715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
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());
8700225b98SGreg 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');
9200225b98SGreg Roach
93cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
9400225b98SGreg Roach
9500225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
960ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
9700225b98SGreg Roach
985e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
9900225b98SGreg Roach    }
10000225b98SGreg Roach
10100225b98SGreg Roach    /**
10215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
10315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
10452348eb8SGreg Roach     *
10552348eb8SGreg Roach     * @return void
10600225b98SGreg 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());
11200225b98SGreg 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');
11700225b98SGreg Roach
118cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
11900225b98SGreg Roach
12000225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
1210ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
12200225b98SGreg Roach
1235e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
12400225b98SGreg Roach    }
12500225b98SGreg Roach
12600225b98SGreg Roach    /**
12715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
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
141109b3e30SGreg Roach            ->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 CensusColumnConditionFrenchFemme($census, '', '');
1570ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
158e76c0cf0SGreg Roach
1595e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
160e76c0cf0SGreg Roach    }
161e76c0cf0SGreg Roach
162e76c0cf0SGreg Roach    /**
16315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
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
177109b3e30SGreg Roach            ->expects(self::exactly(2))
178109b3e30SGreg Roach            ->method('facts')
179*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
180109b3e30SGreg Roach            ->willReturnOnConsecutiveCalls(
181109b3e30SGreg Roach                new Collection([$fact]),
182109b3e30SGreg Roach                new Collection()
183109b3e30SGreg Roach            );
184109b3e30SGreg Roach        $family->expects(self::once())->method('spouse')->willReturn($spouse);
185e76c0cf0SGreg Roach
186cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
1870ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
1880ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
189e76c0cf0SGreg Roach
190cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
191e76c0cf0SGreg Roach
192e76c0cf0SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
1930ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
194e76c0cf0SGreg Roach
1955e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
196e76c0cf0SGreg Roach    }
197e76c0cf0SGreg Roach
198e76c0cf0SGreg Roach    /**
19915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
20015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
20152348eb8SGreg Roach     *
20252348eb8SGreg Roach     * @return void
203e76c0cf0SGreg Roach     */
2049b802b22SGreg Roach    public function testNoFamilyUnmarriedMale(): void
205c1010edaSGreg Roach    {
206cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
2070ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2080ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
20900225b98SGreg Roach
210cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
2110ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
2120ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2130ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
21400225b98SGreg Roach
215cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
2160ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
21700225b98SGreg Roach
21800225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
21900225b98SGreg Roach
2205e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
22100225b98SGreg Roach    }
22200225b98SGreg Roach
22300225b98SGreg Roach    /**
22415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
22515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
22652348eb8SGreg Roach     *
22752348eb8SGreg Roach     * @return void
22800225b98SGreg Roach     */
2299b802b22SGreg Roach    public function testNoFamilyUnmarriedFemale(): void
230c1010edaSGreg Roach    {
231cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
2320ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2330ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
23400225b98SGreg Roach
235cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
2360ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
2370ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2380ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
23900225b98SGreg Roach
240cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
2410ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
24200225b98SGreg Roach
24300225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
24400225b98SGreg Roach
2455e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
24600225b98SGreg Roach    }
24700225b98SGreg Roach
24800225b98SGreg Roach    /**
24915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
25015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
25152348eb8SGreg Roach     *
25252348eb8SGreg Roach     * @return void
25300225b98SGreg Roach     */
2549b802b22SGreg Roach    public function testChildMale(): void
255c1010edaSGreg Roach    {
256cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
2570ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2580ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
25900225b98SGreg Roach
260cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
2610ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
2620ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2630ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820'));
26400225b98SGreg Roach
265cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
2660ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
26700225b98SGreg Roach
26800225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
26900225b98SGreg Roach
2705e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
27100225b98SGreg Roach    }
27200225b98SGreg Roach
27300225b98SGreg Roach    /**
27415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
27515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
27652348eb8SGreg Roach     *
27752348eb8SGreg Roach     * @return void
27800225b98SGreg Roach     */
2799b802b22SGreg Roach    public function testChildFemale(): void
280c1010edaSGreg Roach    {
281cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
2820ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2830ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
28400225b98SGreg Roach
285cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
2860ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
2870ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2880ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820'));
28900225b98SGreg Roach
290cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
2910ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
29200225b98SGreg Roach
29300225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
29400225b98SGreg Roach
2955e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
29600225b98SGreg Roach    }
29700225b98SGreg Roach
29800225b98SGreg Roach    /**
29915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
30015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
30152348eb8SGreg Roach     *
30252348eb8SGreg Roach     * @return void
30300225b98SGreg Roach     */
3049b802b22SGreg Roach    public function testDivorcedMale(): void
305c1010edaSGreg Roach    {
306cd94ca66SGreg Roach        $fact = $this->createMock(Fact::class);
30700225b98SGreg Roach
308cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
309109b3e30SGreg Roach        $family
310109b3e30SGreg Roach            ->expects(self::exactly(2))
311109b3e30SGreg Roach            ->method('facts')
312*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
313109b3e30SGreg Roach            ->willReturn(
314109b3e30SGreg Roach                new Collection([$fact]),
315109b3e30SGreg Roach                new Collection([$fact])
316109b3e30SGreg Roach            );
31700225b98SGreg Roach
318cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
3190ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
3200ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
32100225b98SGreg Roach
322cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
32300225b98SGreg Roach
32400225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
3250ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
32600225b98SGreg Roach
3275e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
32800225b98SGreg Roach    }
32900225b98SGreg Roach
33000225b98SGreg Roach    /**
33115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFemme
33215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
33352348eb8SGreg Roach     *
33452348eb8SGreg Roach     * @return void
33500225b98SGreg Roach     */
3369b802b22SGreg Roach    public function testDivorcedFemale(): void
337c1010edaSGreg Roach    {
338cd94ca66SGreg Roach        $fact = $this->createMock(Fact::class);
33900225b98SGreg Roach
340cd94ca66SGreg Roach        $family = $this->createMock(Family::class);
341109b3e30SGreg Roach        $family
342109b3e30SGreg Roach            ->expects(self::exactly(2))
343109b3e30SGreg Roach            ->method('facts')
344*9aef375dSGreg Roach            ->with(self::withConsecutive([['MARR'], ['DIV']]))
345109b3e30SGreg Roach            ->willReturn(
346109b3e30SGreg Roach                new Collection([$fact]),
347109b3e30SGreg Roach                new Collection([$fact])
348109b3e30SGreg Roach            );
34900225b98SGreg Roach
350cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
3510ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
3520ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
35300225b98SGreg Roach
354cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
35500225b98SGreg Roach
35600225b98SGreg Roach        $column = new CensusColumnConditionFrenchFemme($census, '', '');
3570ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
35800225b98SGreg Roach
3595e933c21SGreg Roach        self::assertSame('1', $column->generate($individual, $individual));
36000225b98SGreg Roach    }
36100225b98SGreg Roach}
362