xref: /webtrees/tests/app/Census/CensusColumnConditionFrenchFilleTest.php (revision d8e2dd8b9de7d6ddf1de4910b053c5cad8dbb7b2)
100225b98SGreg Roach<?php
200225b98SGreg Roach
300225b98SGreg Roach/**
400225b98SGreg Roach * webtrees: online genealogy
500225b98SGreg Roach * Copyright (C) 2016 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 */
1700225b98SGreg Roachnamespace Fisharebest\Webtrees\Census;
1800225b98SGreg Roach
1900225b98SGreg Roachuse Fisharebest\Webtrees\Date;
2000225b98SGreg Roachuse Fisharebest\Webtrees\Fact;
2100225b98SGreg Roachuse Fisharebest\Webtrees\Family;
2200225b98SGreg Roachuse Fisharebest\Webtrees\Individual;
2300225b98SGreg Roachuse Mockery;
2400225b98SGreg Roach
2500225b98SGreg Roach/**
2600225b98SGreg Roach * Test harness for the class CensusColumnConditionFrenchFille
2700225b98SGreg Roach */
2800225b98SGreg Roachclass CensusColumnConditionFrenchFilleTest extends \PHPUnit_Framework_TestCase {
2900225b98SGreg Roach	/**
3000225b98SGreg Roach	 * Delete mock objects
3100225b98SGreg Roach	 */
3200225b98SGreg Roach	public function tearDown() {
3300225b98SGreg Roach		Mockery::close();
3400225b98SGreg Roach	}
3500225b98SGreg Roach
3600225b98SGreg Roach	/**
3700225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
3800225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
3900225b98SGreg Roach	 */
4000225b98SGreg Roach	public function testNoSpouseFamiliesMale() {
4100225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
4200225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('M');
4300225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array());
4400225b98SGreg Roach		$individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
4500225b98SGreg Roach
4600225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
4700225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
4800225b98SGreg Roach
4900225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
5000225b98SGreg Roach
5100225b98SGreg Roach		$this->assertSame('', $column->generate($individual));
5200225b98SGreg Roach	}
5300225b98SGreg Roach
5400225b98SGreg Roach	/**
5500225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
5600225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
5700225b98SGreg Roach	 */
5800225b98SGreg Roach	public function testNoSpouseFamiliesFemale() {
5900225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
6000225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('F');
6100225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array());
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 CensusColumnConditionFrenchFille($census, '', '');
6800225b98SGreg Roach
69*d8e2dd8bSGreg Roach		$this->assertSame('1', $column->generate($individual));
7000225b98SGreg Roach	}
7100225b98SGreg Roach
7200225b98SGreg Roach	/**
7300225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
7400225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
7500225b98SGreg Roach	 */
7600225b98SGreg Roach	public function testNoFamilyNoFactsMale() {
7700225b98SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
7800225b98SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
7900225b98SGreg Roach		$family->shouldReceive('getFacts')->andReturn(array());
8000225b98SGreg Roach
8100225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
8200225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('M');
8300225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
8400225b98SGreg Roach
8500225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
8600225b98SGreg Roach
8700225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
8800225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
8900225b98SGreg Roach
9000225b98SGreg Roach		$this->assertSame('', $column->generate($individual));
9100225b98SGreg Roach	}
9200225b98SGreg Roach
9300225b98SGreg Roach	/**
9400225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
9500225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
9600225b98SGreg Roach	 */
9700225b98SGreg Roach	public function testNoFamilyNoFactsFemale() {
9800225b98SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
9900225b98SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
10000225b98SGreg Roach		$family->shouldReceive('getFacts')->andReturn(array());
10100225b98SGreg Roach
10200225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
10300225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('F');
10400225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
10500225b98SGreg Roach
10600225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
10700225b98SGreg Roach
10800225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
10900225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
11000225b98SGreg Roach
11100225b98SGreg Roach		$this->assertSame('', $column->generate($individual));
11200225b98SGreg Roach	}
11300225b98SGreg Roach
11400225b98SGreg Roach	/**
11500225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
11600225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
11700225b98SGreg Roach	 */
11800225b98SGreg Roach	public function testNoFamilyUnmarriedMale() {
11900225b98SGreg Roach		$fact = Mockery::mock('Fisharebest\Webtrees\Fact');
12000225b98SGreg Roach
12100225b98SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
12200225b98SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
12300225b98SGreg Roach		$family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact));
12400225b98SGreg Roach
12500225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
12600225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('M');
12700225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
12800225b98SGreg Roach		$individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
12900225b98SGreg Roach
13000225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
13100225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
13200225b98SGreg Roach
13300225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
13400225b98SGreg Roach
13500225b98SGreg Roach		$this->assertSame('', $column->generate($individual));
13600225b98SGreg Roach	}
13700225b98SGreg Roach
13800225b98SGreg Roach	/**
13900225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
14000225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
14100225b98SGreg Roach	 */
14200225b98SGreg Roach	public function testNoFamilyUnmarriedFemale() {
14300225b98SGreg Roach		$fact = Mockery::mock('Fisharebest\Webtrees\Fact');
14400225b98SGreg Roach
14500225b98SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
14600225b98SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
14700225b98SGreg Roach		$family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact));
14800225b98SGreg Roach
14900225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
15000225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('F');
15100225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
15200225b98SGreg Roach		$individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800'));
15300225b98SGreg Roach
15400225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
15500225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
15600225b98SGreg Roach
15700225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
15800225b98SGreg Roach
159*d8e2dd8bSGreg Roach		$this->assertSame('1', $column->generate($individual));
16000225b98SGreg Roach	}
16100225b98SGreg Roach
16200225b98SGreg Roach	/**
16300225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
16400225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
16500225b98SGreg Roach	 */
16600225b98SGreg Roach	public function testChildMale() {
16700225b98SGreg Roach		$fact = Mockery::mock('Fisharebest\Webtrees\Fact');
16800225b98SGreg Roach
16900225b98SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
17000225b98SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
17100225b98SGreg Roach		$family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact));
17200225b98SGreg Roach
17300225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
17400225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('M');
17500225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
17600225b98SGreg Roach		$individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820'));
17700225b98SGreg Roach
17800225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
17900225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
18000225b98SGreg Roach
18100225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
18200225b98SGreg Roach
18300225b98SGreg Roach		$this->assertSame('', $column->generate($individual));
18400225b98SGreg Roach	}
18500225b98SGreg Roach
18600225b98SGreg Roach	/**
18700225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
18800225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
18900225b98SGreg Roach	 */
19000225b98SGreg Roach	public function testChildFemale() {
19100225b98SGreg Roach		$fact = Mockery::mock('Fisharebest\Webtrees\Fact');
19200225b98SGreg Roach
19300225b98SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
19400225b98SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
19500225b98SGreg Roach		$family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact));
19600225b98SGreg Roach
19700225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
19800225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('F');
19900225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
20000225b98SGreg Roach		$individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820'));
20100225b98SGreg Roach
20200225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
20300225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
20400225b98SGreg Roach
20500225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
20600225b98SGreg Roach
207*d8e2dd8bSGreg Roach		$this->assertSame('1', $column->generate($individual));
20800225b98SGreg Roach	}
20900225b98SGreg Roach
21000225b98SGreg Roach	/**
21100225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
21200225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
21300225b98SGreg Roach	 */
21400225b98SGreg Roach	public function testDivorcedMale() {
21500225b98SGreg Roach		$fact = Mockery::mock('Fisharebest\Webtrees\Fact');
21600225b98SGreg Roach
21700225b98SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
21800225b98SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
21900225b98SGreg Roach		$family->shouldReceive('getFacts')->with('_NMR')->andReturn(array());
22000225b98SGreg Roach		$family->shouldReceive('getFacts')->with('DIV')->andReturn(array($fact));
22100225b98SGreg Roach
22200225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
22300225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('M');
22400225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
22500225b98SGreg Roach
22600225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
22700225b98SGreg Roach
22800225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
22900225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
23000225b98SGreg Roach
23100225b98SGreg Roach		$this->assertSame('', $column->generate($individual));
23200225b98SGreg Roach	}
23300225b98SGreg Roach
23400225b98SGreg Roach	/**
23500225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionFrenchFille
23600225b98SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumnCondition
23700225b98SGreg Roach	 */
23800225b98SGreg Roach	public function testDivorcedFemale() {
23900225b98SGreg Roach		$fact = Mockery::mock('Fisharebest\Webtrees\Fact');
24000225b98SGreg Roach
24100225b98SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
24200225b98SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
24300225b98SGreg Roach		$family->shouldReceive('getFacts')->with('_NMR')->andReturn(array());
24400225b98SGreg Roach		$family->shouldReceive('getFacts')->with('DIV')->andReturn(array($fact));
24500225b98SGreg Roach
24600225b98SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
24700225b98SGreg Roach		$individual->shouldReceive('getSex')->andReturn('F');
24800225b98SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
24900225b98SGreg Roach
25000225b98SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
25100225b98SGreg Roach
25200225b98SGreg Roach		$column = new CensusColumnConditionFrenchFille($census, '', '');
25300225b98SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
25400225b98SGreg Roach
25500225b98SGreg Roach		$this->assertSame('', $column->generate($individual));
25600225b98SGreg Roach	}
25700225b98SGreg Roach}
258