xref: /webtrees/tests/app/Census/CensusColumnConditionFrenchVeufTest.php (revision 3976b4703df669696105ed6b024b96d433c8fbdb)
100225b98SGreg Roach<?php
2*3976b470SGreg Roach
300225b98SGreg Roach/**
400225b98SGreg Roach * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 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
1500225b98SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1600225b98SGreg Roach */
17e7f56f2aSGreg Roachdeclare(strict_types=1);
18e7f56f2aSGreg Roach
1900225b98SGreg Roachnamespace Fisharebest\Webtrees\Census;
2000225b98SGreg Roach
2100225b98SGreg Roachuse Fisharebest\Webtrees\Date;
22ddf438a5SGreg Roachuse Fisharebest\Webtrees\Fact;
23ddf438a5SGreg Roachuse Fisharebest\Webtrees\Family;
24ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
2539ca88baSGreg Roachuse Illuminate\Support\Collection;
2600225b98SGreg Roach
2700225b98SGreg Roach/**
2800225b98SGreg Roach * Test harness for the class CensusColumnConditionFrenchVeuf
2900225b98SGreg Roach */
3084e2cf4eSGreg Roachclass CensusColumnConditionFrenchVeufTest extends \Fisharebest\Webtrees\TestCase
31c1010edaSGreg Roach{
3200225b98SGreg Roach    /**
3315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
3415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
3552348eb8SGreg Roach     *
3652348eb8SGreg Roach     * @return void
3700225b98SGreg Roach     */
389b802b22SGreg Roach    public function testNoSpouseFamiliesMale(): void
39c1010edaSGreg Roach    {
400ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
410ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
420ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection());
430ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
4400225b98SGreg Roach
450ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
460ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
4700225b98SGreg Roach
4800225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
4900225b98SGreg Roach
50342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
5100225b98SGreg Roach    }
5200225b98SGreg Roach
5300225b98SGreg Roach    /**
5415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
5515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
5652348eb8SGreg Roach     *
5752348eb8SGreg Roach     * @return void
5800225b98SGreg Roach     */
599b802b22SGreg Roach    public function testNoSpouseFamiliesFemale(): void
60c1010edaSGreg Roach    {
610ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
620ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
630ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection());
640ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
6500225b98SGreg Roach
660ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
670ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
6800225b98SGreg Roach
6900225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
7000225b98SGreg Roach
71342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
7200225b98SGreg Roach    }
7300225b98SGreg Roach
7400225b98SGreg Roach    /**
7515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
7615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
7752348eb8SGreg Roach     *
7852348eb8SGreg Roach     * @return void
7900225b98SGreg Roach     */
809b802b22SGreg Roach    public function testNoFamilyFactsMale(): void
81c1010edaSGreg Roach    {
820ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
830ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
840ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
8500225b98SGreg Roach
860ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
870ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
880ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
890ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
9000225b98SGreg Roach
910ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
9200225b98SGreg Roach
9300225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
940ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
9500225b98SGreg Roach
96342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
9700225b98SGreg Roach    }
9800225b98SGreg Roach
9900225b98SGreg Roach    /**
10015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
10115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
10252348eb8SGreg Roach     *
10352348eb8SGreg Roach     * @return void
10400225b98SGreg Roach     */
1059b802b22SGreg Roach    public function testNoFamilyFactsFemale(): void
106c1010edaSGreg Roach    {
1070ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
1080ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
1090ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
110e76c0cf0SGreg Roach
1110ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1120ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
1130ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
1140ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
115e76c0cf0SGreg Roach
1160ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
117e76c0cf0SGreg Roach
118e76c0cf0SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
1190ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
120e76c0cf0SGreg Roach
121342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
122e76c0cf0SGreg Roach    }
123e76c0cf0SGreg Roach
124e76c0cf0SGreg Roach    /**
12515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
12615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
12752348eb8SGreg Roach     *
12852348eb8SGreg Roach     * @return void
129e76c0cf0SGreg Roach     */
1309b802b22SGreg Roach    public function testSpouseDeadMale(): void
131c1010edaSGreg Roach    {
1320ecdbde6SGreg Roach        $fact = $this->createMock(Fact::class);
1332a6fda60SGreg Roach
1340ecdbde6SGreg Roach        $spouse = $this->createMock(Individual::class);
1350ecdbde6SGreg Roach        $spouse->method('getDeathDate')->willReturn(new Date('1820'));
136e76c0cf0SGreg Roach
1370ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
1380ecdbde6SGreg Roach        $family->expects($this->at(0))->method('getMarriageDate')->willReturn(new Date(''));
1390ecdbde6SGreg Roach        $family->expects($this->at(1))->method('facts')->with(['MARR'])->willReturn(new Collection([$fact]));
1400ecdbde6SGreg Roach        $family->expects($this->at(2))->method('facts')->with(['DIV'])->willReturn(new Collection());
1410ecdbde6SGreg Roach        $family->expects($this->at(3))->method('spouse')->willReturn($spouse);
142e76c0cf0SGreg Roach
1430ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1440ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
1450ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
146e76c0cf0SGreg Roach
1470ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
148e76c0cf0SGreg Roach
149e76c0cf0SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
1500ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
151e76c0cf0SGreg Roach
152342dcecdSGreg Roach        $this->assertSame('1', $column->generate($individual, $individual));
153e76c0cf0SGreg Roach    }
154e76c0cf0SGreg Roach
155e76c0cf0SGreg Roach    /**
15615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
15715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
15852348eb8SGreg Roach     *
15952348eb8SGreg Roach     * @return void
160e76c0cf0SGreg Roach     */
1619b802b22SGreg Roach    public function testSpouseDeadFemale(): void
162c1010edaSGreg Roach    {
1630ecdbde6SGreg Roach        $fact = $this->createMock(Fact::class);
1642a6fda60SGreg Roach
1650ecdbde6SGreg Roach        $spouse = $this->createMock(Individual::class);
1660ecdbde6SGreg Roach        $spouse->method('getDeathDate')->willReturn(new Date('1820'));
167e76c0cf0SGreg Roach
1680ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
1690ecdbde6SGreg Roach        $family->expects($this->at(0))->method('getMarriageDate')->willReturn(new Date(''));
1700ecdbde6SGreg Roach        $family->expects($this->at(1))->method('facts')->with(['MARR'])->willReturn(new Collection([$fact]));
1710ecdbde6SGreg Roach        $family->expects($this->at(2))->method('facts')->with(['DIV'])->willReturn(new Collection());
1720ecdbde6SGreg Roach        $family->expects($this->at(3))->method('spouse')->willReturn($spouse);
17300225b98SGreg Roach
1740ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1750ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
1760ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
17700225b98SGreg Roach
1780ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
17900225b98SGreg Roach
18000225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
1810ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
18200225b98SGreg Roach
183342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
18400225b98SGreg Roach    }
18500225b98SGreg Roach
18600225b98SGreg Roach    /**
18715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
18815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
18952348eb8SGreg Roach     *
19052348eb8SGreg Roach     * @return void
19100225b98SGreg Roach     */
1929b802b22SGreg Roach    public function testNoFamilyUnmarriedMale(): void
193c1010edaSGreg Roach    {
1940ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
1950ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
1960ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
19700225b98SGreg Roach
1980ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1990ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
2000ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2010ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
20200225b98SGreg Roach
2030ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2040ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
20500225b98SGreg Roach
20600225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
20700225b98SGreg Roach
208342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
20900225b98SGreg Roach    }
21000225b98SGreg Roach
21100225b98SGreg Roach    /**
21215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
21315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
21452348eb8SGreg Roach     *
21552348eb8SGreg Roach     * @return void
21600225b98SGreg Roach     */
2179b802b22SGreg Roach    public function testNoFamilyUnmarriedFemale(): void
218c1010edaSGreg Roach    {
2190ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
2200ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2210ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
22200225b98SGreg Roach
2230ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
2240ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
2250ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2260ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1800'));
22700225b98SGreg Roach
2280ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2290ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
23000225b98SGreg Roach
23100225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
23200225b98SGreg Roach
233342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
23400225b98SGreg Roach    }
23500225b98SGreg Roach
23600225b98SGreg Roach    /**
23715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
23815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
23952348eb8SGreg Roach     *
24052348eb8SGreg Roach     * @return void
24100225b98SGreg Roach     */
2429b802b22SGreg Roach    public function testChildMale(): void
243c1010edaSGreg Roach    {
2440ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
2450ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2460ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
24700225b98SGreg Roach
2480ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
2490ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
2500ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2510ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820'));
25200225b98SGreg Roach
2530ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2540ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
25500225b98SGreg Roach
25600225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
25700225b98SGreg Roach
258342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
25900225b98SGreg Roach    }
26000225b98SGreg Roach
26100225b98SGreg Roach    /**
26215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
26315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
26452348eb8SGreg Roach     *
26552348eb8SGreg Roach     * @return void
26600225b98SGreg Roach     */
2679b802b22SGreg Roach    public function testChildFemale(): void
268c1010edaSGreg Roach    {
2690ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
2700ecdbde6SGreg Roach        $family->method('getMarriageDate')->willReturn(new Date(''));
2710ecdbde6SGreg Roach        $family->method('facts')->with(['MARR'])->willReturn(new Collection());
27200225b98SGreg Roach
2730ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
2740ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
2750ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
2760ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn(new Date('1820'));
27700225b98SGreg Roach
2780ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2790ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
28000225b98SGreg Roach
28100225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
28200225b98SGreg Roach
283342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
28400225b98SGreg Roach    }
28500225b98SGreg Roach
28600225b98SGreg Roach    /**
28715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
28815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
28952348eb8SGreg Roach     *
29052348eb8SGreg Roach     * @return void
29100225b98SGreg Roach     */
2929b802b22SGreg Roach    public function testDivorcedMale(): void
293c1010edaSGreg Roach    {
2940ecdbde6SGreg Roach        $fact = $this->createMock(Fact::class);
29500225b98SGreg Roach
2960ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
2970ecdbde6SGreg Roach        $family->expects($this->at(0))->method('getMarriageDate')->willReturn(new Date(''));
2980ecdbde6SGreg Roach        $family->expects($this->at(1))->method('facts')->with(['MARR'])->willReturn(new Collection([$fact]));
2990ecdbde6SGreg Roach        $family->expects($this->at(2))->method('facts')->with(['DIV'])->willReturn(new Collection([$fact]));
30000225b98SGreg Roach
3010ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
3020ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
3030ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
30400225b98SGreg Roach
3050ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
30600225b98SGreg Roach
30700225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
3080ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
30900225b98SGreg Roach
310342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
31100225b98SGreg Roach    }
31200225b98SGreg Roach
31300225b98SGreg Roach    /**
31415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchVeuf
31515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
31652348eb8SGreg Roach     *
31752348eb8SGreg Roach     * @return void
31800225b98SGreg Roach     */
3199b802b22SGreg Roach    public function testDivorcedFemale(): void
320c1010edaSGreg Roach    {
3210ecdbde6SGreg Roach        $fact = $this->createMock(Fact::class);
32200225b98SGreg Roach
3230ecdbde6SGreg Roach        $family = $this->createMock(Family::class);
3240ecdbde6SGreg Roach        $family->expects($this->at(0))->method('getMarriageDate')->willReturn(new Date(''));
3250ecdbde6SGreg Roach        $family->expects($this->at(1))->method('facts')->with(['MARR'])->willReturn(new Collection([$fact]));
3260ecdbde6SGreg Roach        $family->expects($this->at(2))->method('facts')->with(['DIV'])->willReturn(new Collection([$fact]));
32700225b98SGreg Roach
3280ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
3290ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
3300ecdbde6SGreg Roach        $individual->method('spouseFamilies')->willReturn(new Collection([$family]));
33100225b98SGreg Roach
3320ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
33300225b98SGreg Roach
33400225b98SGreg Roach        $column = new CensusColumnConditionFrenchVeuf($census, '', '');
3350ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1830');
33600225b98SGreg Roach
337342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
33800225b98SGreg Roach    }
33900225b98SGreg Roach}
340