xref: /webtrees/tests/app/Census/CensusColumnConditionDanishTest.php (revision c314ecc9a18e5e740a1c0fcb7379ef541f969dc5)
1101af0b4SGreg Roach<?php
2101af0b4SGreg Roach
3101af0b4SGreg Roach/**
4101af0b4SGreg Roach * webtrees: online genealogy
5101af0b4SGreg Roach * Copyright (C) 2015 webtrees development team
6101af0b4SGreg Roach * This program is free software: you can redistribute it and/or modify
7101af0b4SGreg Roach * it under the terms of the GNU General Public License as published by
8101af0b4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9101af0b4SGreg Roach * (at your option) any later version.
10101af0b4SGreg Roach * This program is distributed in the hope that it will be useful,
11101af0b4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12101af0b4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13101af0b4SGreg Roach * GNU General Public License for more details.
14101af0b4SGreg Roach * You should have received a copy of the GNU General Public License
15101af0b4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16101af0b4SGreg Roach */
17101af0b4SGreg Roachnamespace Fisharebest\Webtrees\Census;
18101af0b4SGreg Roach
19101af0b4SGreg Roachuse Fisharebest\Webtrees\Date;
2073d4df56SGreg Roachuse Fisharebest\Webtrees\Fact;
2173d4df56SGreg Roachuse Fisharebest\Webtrees\Family;
22101af0b4SGreg Roachuse Fisharebest\Webtrees\Individual;
23101af0b4SGreg Roachuse Mockery;
24101af0b4SGreg Roach
25101af0b4SGreg Roach/**
2673d4df56SGreg Roach * Test harness for the class CensusColumnConditionDanish
27101af0b4SGreg Roach */
28101af0b4SGreg Roachclass CensusColumnConditionDanishTest extends \PHPUnit_Framework_TestCase {
29101af0b4SGreg Roach	/**
30101af0b4SGreg Roach	 * Delete mock objects
31101af0b4SGreg Roach	 */
32101af0b4SGreg Roach	public function tearDown() {
33101af0b4SGreg Roach		Mockery::close();
34101af0b4SGreg Roach	}
35101af0b4SGreg Roach
36101af0b4SGreg Roach	/**
3773d4df56SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionDanish
38101af0b4SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
39101af0b4SGreg Roach	 */
4073d4df56SGreg Roach	public function testNoSpouseFamilies() {
41*c314ecc9SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
42e2052359SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array());
43101af0b4SGreg Roach
44*c314ecc9SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
45101af0b4SGreg Roach
4673d4df56SGreg Roach		$column = new CensusColumnConditionDanish($census, '', '');
47101af0b4SGreg Roach
4873d4df56SGreg Roach		$this->assertSame('Ugift', $column->generate($individual));
4973d4df56SGreg Roach	}
5073d4df56SGreg Roach
5173d4df56SGreg Roach	/**
5273d4df56SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionDanish
5373d4df56SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
5473d4df56SGreg Roach	 */
5573d4df56SGreg Roach	public function testNoFamilyNoFacts() {
56*c314ecc9SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
5773d4df56SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
58e2052359SGreg Roach		$family->shouldReceive('getFacts')->andReturn(array());
5973d4df56SGreg Roach
60*c314ecc9SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
61e2052359SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
6273d4df56SGreg Roach
63*c314ecc9SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
6473d4df56SGreg Roach
6573d4df56SGreg Roach		$column = new CensusColumnConditionDanish($census, '', '');
6673d4df56SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
6773d4df56SGreg Roach
6873d4df56SGreg Roach		$this->assertSame('Gift', $column->generate($individual));
6973d4df56SGreg Roach	}
7073d4df56SGreg Roach
7173d4df56SGreg Roach	/**
7273d4df56SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionDanish
7373d4df56SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
7473d4df56SGreg Roach	 */
7573d4df56SGreg Roach	public function testNoFamilyUnmarried() {
76*c314ecc9SGreg Roach		$fact = Mockery::mock('Fisharebest\Webtrees\Fact');
7773d4df56SGreg Roach
78*c314ecc9SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
7973d4df56SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
80e2052359SGreg Roach		$family->shouldReceive('getFacts')->with('_NMR')->andReturn(array($fact));
8173d4df56SGreg Roach
82*c314ecc9SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
83e2052359SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
8473d4df56SGreg Roach
85*c314ecc9SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
8673d4df56SGreg Roach
8773d4df56SGreg Roach		$column = new CensusColumnConditionDanish($census, '', '');
8873d4df56SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
8973d4df56SGreg Roach
9073d4df56SGreg Roach		$this->assertSame('Ugift', $column->generate($individual));
9173d4df56SGreg Roach	}
9273d4df56SGreg Roach
9373d4df56SGreg Roach	/**
9473d4df56SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnConditionDanish
9573d4df56SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
9673d4df56SGreg Roach	 */
9773d4df56SGreg Roach	public function testNoFamilyDivorced() {
98*c314ecc9SGreg Roach		$fact = Mockery::mock('Fisharebest\Webtrees\Fact');
9973d4df56SGreg Roach
100*c314ecc9SGreg Roach		$family = Mockery::mock('Fisharebest\Webtrees\Family');
10173d4df56SGreg Roach		$family->shouldReceive('getMarriageDate')->andReturn(new Date(''));
102e2052359SGreg Roach		$family->shouldReceive('getFacts')->with('_NMR')->andReturn(array());
103e2052359SGreg Roach		$family->shouldReceive('getFacts')->with('DIV')->andReturn(array($fact));
10473d4df56SGreg Roach
105*c314ecc9SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
106e2052359SGreg Roach		$individual->shouldReceive('getSpouseFamilies')->andReturn(array($family));
10773d4df56SGreg Roach
108*c314ecc9SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
10973d4df56SGreg Roach
11073d4df56SGreg Roach		$column = new CensusColumnConditionDanish($census, '', '');
11173d4df56SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1830');
11273d4df56SGreg Roach
11373d4df56SGreg Roach		$this->assertSame('Skilt', $column->generate($individual));
114101af0b4SGreg Roach	}
115101af0b4SGreg Roach}
116