xref: /webtrees/tests/app/Census/CensusColumnConditionFrenchHommeTest.php (revision 84e2cf4e2b1803b300330f631d304db1a3c443dd)
100225b98SGreg Roach<?php
200225b98SGreg Roach/**
300225b98SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
500225b98SGreg Roach * This program is free software: you can redistribute it and/or modify
600225b98SGreg Roach * it under the terms of the GNU General Public License as published by
700225b98SGreg Roach * the Free Software Foundation, either version 3 of the License, or
800225b98SGreg Roach * (at your option) any later version.
900225b98SGreg Roach * This program is distributed in the hope that it will be useful,
1000225b98SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1100225b98SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1200225b98SGreg Roach * GNU General Public License for more details.
1300225b98SGreg Roach * You should have received a copy of the GNU General Public License
1400225b98SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1500225b98SGreg Roach */
1600225b98SGreg Roachnamespace Fisharebest\Webtrees\Census;
1700225b98SGreg Roach
1800225b98SGreg Roachuse Fisharebest\Webtrees\Date;
1900225b98SGreg Roachuse Mockery;
2000225b98SGreg Roach
2100225b98SGreg Roach/**
2200225b98SGreg Roach * Test harness for the class CensusColumnConditionFrenchHomme
2300225b98SGreg Roach */
24*84e2cf4eSGreg Roachclass CensusColumnConditionFrenchHommeTest extends \Fisharebest\Webtrees\TestCase
25c1010edaSGreg Roach{
2600225b98SGreg Roach    /**
2700225b98SGreg Roach     * Delete mock objects
2800225b98SGreg Roach     */
29c1010edaSGreg Roach    public function tearDown()
30c1010edaSGreg Roach    {
3100225b98SGreg Roach        Mockery::close();
3200225b98SGreg Roach    }
3300225b98SGreg Roach
3400225b98SGreg Roach    /**
3515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
3615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
3700225b98SGreg Roach     */
38c1010edaSGreg Roach    public function testNoSpouseFamiliesMale()
39c1010edaSGreg Roach    {
4000225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
4100225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
4213abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([]);
4300225b98SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
4400225b98SGreg Roach
4500225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
4600225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
4700225b98SGreg Roach
4800225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
4900225b98SGreg Roach
50342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
5100225b98SGreg Roach    }
5200225b98SGreg Roach
5300225b98SGreg Roach    /**
5415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
5515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
5600225b98SGreg Roach     */
57c1010edaSGreg Roach    public function testNoSpouseFamiliesFemale()
58c1010edaSGreg Roach    {
5900225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
6000225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
6113abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([]);
6200225b98SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
6300225b98SGreg Roach
6400225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
6500225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
6600225b98SGreg Roach
6700225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
6800225b98SGreg Roach
69342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
7000225b98SGreg Roach    }
7100225b98SGreg Roach
7200225b98SGreg Roach    /**
7315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
7415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
7500225b98SGreg Roach     */
76c1010edaSGreg Roach    public function testNoFamilyFactsMale()
77c1010edaSGreg Roach    {
7800225b98SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
7900225b98SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
802a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([]);
8100225b98SGreg Roach
8200225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
8313abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
842a6fda60SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
852a6fda60SGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
8600225b98SGreg Roach
8700225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
8800225b98SGreg Roach
8900225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
9000225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
9100225b98SGreg Roach
92342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
9300225b98SGreg Roach    }
9400225b98SGreg Roach
9500225b98SGreg Roach    /**
9615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
9715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
9800225b98SGreg Roach     */
99c1010edaSGreg Roach    public function testNoFamilyFactsFemale()
100c1010edaSGreg Roach    {
10100225b98SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
10200225b98SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
1032a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([]);
104e76c0cf0SGreg Roach
105e76c0cf0SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
10613abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
1072a6fda60SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
1082a6fda60SGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
109e76c0cf0SGreg Roach
110e76c0cf0SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
111e76c0cf0SGreg Roach
112e76c0cf0SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
113e76c0cf0SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
114e76c0cf0SGreg Roach
115342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
116e76c0cf0SGreg Roach    }
117e76c0cf0SGreg Roach
118e76c0cf0SGreg Roach    /**
11915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
12015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
121e76c0cf0SGreg Roach     */
122c1010edaSGreg Roach    public function testSpouseDeadMale()
123c1010edaSGreg Roach    {
1242a6fda60SGreg Roach        $fact = Mockery::mock('Fisharebest\Webtrees\Fact');
1252a6fda60SGreg Roach
126e76c0cf0SGreg Roach        $spouse = Mockery::mock('Fisharebest\Webtrees\Individual');
127e76c0cf0SGreg Roach        $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820'));
128e76c0cf0SGreg Roach
129e76c0cf0SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
130e76c0cf0SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
1312a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]);
1322a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('DIV')->andReturn([]);
133e76c0cf0SGreg Roach        $family->shouldReceive('getSpouse')->andReturn($spouse);
134e76c0cf0SGreg Roach
135e76c0cf0SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
136e76c0cf0SGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
13713abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
138e76c0cf0SGreg Roach
139e76c0cf0SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
140e76c0cf0SGreg Roach
141e76c0cf0SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
142e76c0cf0SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
143e76c0cf0SGreg Roach
144342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
145e76c0cf0SGreg Roach    }
146e76c0cf0SGreg Roach
147e76c0cf0SGreg Roach    /**
14815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
14915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
150e76c0cf0SGreg Roach     */
151c1010edaSGreg Roach    public function testSpouseDeadFemale()
152c1010edaSGreg Roach    {
1532a6fda60SGreg Roach        $fact = Mockery::mock('Fisharebest\Webtrees\Fact');
1542a6fda60SGreg Roach
155e76c0cf0SGreg Roach        $spouse = Mockery::mock('Fisharebest\Webtrees\Individual');
156e76c0cf0SGreg Roach        $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820'));
157e76c0cf0SGreg Roach
158e76c0cf0SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
159e76c0cf0SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
1602a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]);
1612a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('DIV')->andReturn([]);
162e76c0cf0SGreg Roach        $family->shouldReceive('getSpouse')->andReturn($spouse);
16300225b98SGreg Roach
16400225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
16500225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
16613abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
16700225b98SGreg Roach
16800225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
16900225b98SGreg Roach
17000225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
17100225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
17200225b98SGreg Roach
173342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
17400225b98SGreg Roach    }
17500225b98SGreg Roach
17600225b98SGreg Roach    /**
17715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
17815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
17900225b98SGreg Roach     */
180c1010edaSGreg Roach    public function testNoFamilyUnmarriedMale()
181c1010edaSGreg Roach    {
18200225b98SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
18300225b98SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
1842a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([]);
18500225b98SGreg Roach
18600225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
18700225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
18813abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
18900225b98SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
19000225b98SGreg Roach
19100225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
19200225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
19300225b98SGreg Roach
19400225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
19500225b98SGreg Roach
196342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
19700225b98SGreg Roach    }
19800225b98SGreg Roach
19900225b98SGreg Roach    /**
20015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
20115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
20200225b98SGreg Roach     */
203c1010edaSGreg Roach    public function testNoFamilyUnmarriedFemale()
204c1010edaSGreg Roach    {
20500225b98SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
20600225b98SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
2072a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([]);
20800225b98SGreg Roach
20900225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
21000225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
21113abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
21200225b98SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
21300225b98SGreg Roach
21400225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
21500225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
21600225b98SGreg Roach
21700225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
21800225b98SGreg Roach
219342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
22000225b98SGreg Roach    }
22100225b98SGreg Roach
22200225b98SGreg Roach    /**
22315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
22415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
22500225b98SGreg Roach     */
226c1010edaSGreg Roach    public function testChildMale()
227c1010edaSGreg Roach    {
22800225b98SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
22900225b98SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
2302a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([]);
23100225b98SGreg Roach
23200225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
23300225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
23413abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
23500225b98SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820'));
23600225b98SGreg Roach
23700225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
23800225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
23900225b98SGreg Roach
24000225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
24100225b98SGreg Roach
242342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
24300225b98SGreg Roach    }
24400225b98SGreg Roach
24500225b98SGreg Roach    /**
24615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
24715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
24800225b98SGreg Roach     */
249c1010edaSGreg Roach    public function testChildFemale()
250c1010edaSGreg Roach    {
25100225b98SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
25200225b98SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
2532a6fda60SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([]);
25400225b98SGreg Roach
25500225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
25600225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
25713abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
25800225b98SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820'));
25900225b98SGreg Roach
26000225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
26100225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
26200225b98SGreg Roach
26300225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
26400225b98SGreg Roach
265342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
26600225b98SGreg Roach    }
26700225b98SGreg Roach
26800225b98SGreg Roach    /**
26915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
27015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
27100225b98SGreg Roach     */
272c1010edaSGreg Roach    public function testDivorcedMale()
273c1010edaSGreg Roach    {
27400225b98SGreg Roach        $fact = Mockery::mock('Fisharebest\Webtrees\Fact');
27500225b98SGreg Roach
27600225b98SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
27700225b98SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
2780b4be234SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]);
27913abd6f3SGreg Roach        $family->shouldReceive('getFacts')->with('DIV')->andReturn([$fact]);
28000225b98SGreg Roach
28100225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
28200225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
28313abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
28400225b98SGreg Roach
28500225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
28600225b98SGreg Roach
28700225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
28800225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
28900225b98SGreg Roach
290342dcecdSGreg Roach        $this->assertSame('1', $column->generate($individual, $individual));
29100225b98SGreg Roach    }
29200225b98SGreg Roach
29300225b98SGreg Roach    /**
29415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchHomme
29515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
29600225b98SGreg Roach     */
297c1010edaSGreg Roach    public function testDivorcedFemale()
298c1010edaSGreg Roach    {
29900225b98SGreg Roach        $fact = Mockery::mock('Fisharebest\Webtrees\Fact');
30000225b98SGreg Roach
30100225b98SGreg Roach        $family = Mockery::mock('Fisharebest\Webtrees\Family');
30200225b98SGreg Roach        $family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
3030b4be234SGreg Roach        $family->shouldReceive('getFacts')->with('MARR')->andReturn([$fact]);
30413abd6f3SGreg Roach        $family->shouldReceive('getFacts')->with('DIV')->andReturn([$fact]);
30500225b98SGreg Roach
30600225b98SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
30700225b98SGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
30813abd6f3SGreg Roach        $individual->shouldReceive('getSpouseFamilies')->andReturn([$family]);
30900225b98SGreg Roach
31000225b98SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
31100225b98SGreg Roach
31200225b98SGreg Roach        $column = new CensusColumnConditionFrenchHomme($census, '', '');
31300225b98SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
31400225b98SGreg Roach
315342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
31600225b98SGreg Roach    }
31700225b98SGreg Roach}
318