1101af0b4SGreg Roach<?php 2101af0b4SGreg Roach 3101af0b4SGreg Roach/** 4101af0b4SGreg Roach * webtrees: online genealogy 5*369c0ce6SGreg Roach * Copyright (C) 2016 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() { 41c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 42e2052359SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array()); 43101af0b4SGreg Roach 44c314ecc9SGreg 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() { 56c314ecc9SGreg Roach $family = Mockery::mock('Fisharebest\Webtrees\Family'); 5773d4df56SGreg Roach $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); 58e2052359SGreg Roach $family->shouldReceive('getFacts')->andReturn(array()); 5973d4df56SGreg Roach 60c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 61e2052359SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 6273d4df56SGreg Roach 63c314ecc9SGreg 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() { 76c314ecc9SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 7773d4df56SGreg Roach 78c314ecc9SGreg 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 82c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 83e2052359SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 8473d4df56SGreg Roach 85c314ecc9SGreg 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() { 98c314ecc9SGreg Roach $fact = Mockery::mock('Fisharebest\Webtrees\Fact'); 9973d4df56SGreg Roach 100c314ecc9SGreg 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 105c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 106e2052359SGreg Roach $individual->shouldReceive('getSpouseFamilies')->andReturn(array($family)); 10773d4df56SGreg Roach 108c314ecc9SGreg 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