188cd6753SGreg Roach<?php 288cd6753SGreg Roach 388cd6753SGreg Roach/** 488cd6753SGreg Roach * webtrees: online genealogy 588cd6753SGreg Roach * Copyright (C) 2015 webtrees development team 688cd6753SGreg Roach * This program is free software: you can redistribute it and/or modify 788cd6753SGreg Roach * it under the terms of the GNU General Public License as published by 888cd6753SGreg Roach * the Free Software Foundation, either version 3 of the License, or 988cd6753SGreg Roach * (at your option) any later version. 1088cd6753SGreg Roach * This program is distributed in the hope that it will be useful, 1188cd6753SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1288cd6753SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1388cd6753SGreg Roach * GNU General Public License for more details. 1488cd6753SGreg Roach * You should have received a copy of the GNU General Public License 1588cd6753SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 1688cd6753SGreg Roach */ 1788cd6753SGreg Roach 1888cd6753SGreg Roachnamespace Fisharebest\Webtrees\Census; 1988cd6753SGreg Roach 2088cd6753SGreg Roachuse Fisharebest\Webtrees\Date; 2188cd6753SGreg Roachuse Fisharebest\Webtrees\Individual; 2288cd6753SGreg Roachuse Mockery; 2388cd6753SGreg Roach 2488cd6753SGreg Roach/** 2588cd6753SGreg Roach * Test harness for the class CensusColumnAge 2688cd6753SGreg Roach */ 2788cd6753SGreg Roachclass CensusColumnBirthDateTest extends \PHPUnit_Framework_TestCase { 2888cd6753SGreg Roach /** 2988cd6753SGreg Roach * Delete mock objects 3088cd6753SGreg Roach */ 3188cd6753SGreg Roach public function tearDown() { 3288cd6753SGreg Roach Mockery::close(); 3388cd6753SGreg Roach } 3488cd6753SGreg Roach 3588cd6753SGreg Roach /** 3688cd6753SGreg Roach * @covers Fisharebest\Webtrees\Census\CensusColumnBirthDate 3788cd6753SGreg Roach * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn 3888cd6753SGreg Roach */ 3988cd6753SGreg Roach public function testGenerateColumn() { 40*f3fa6d90SGreg Roach $cal_date = Mockery::mock(Date\CalendarDate::class); 41*f3fa6d90SGreg Roach $cal_date->shouldReceive('format')->andReturn('1 1 1800'); 42*f3fa6d90SGreg Roach 4388cd6753SGreg Roach $date = Mockery::mock(Date::class); 44*f3fa6d90SGreg Roach $date->shouldReceive('minimumDate')->andReturn($cal_date); 4588cd6753SGreg Roach 4688cd6753SGreg Roach $individual = Mockery::mock(Individual::class); 4788cd6753SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn($date); 4888cd6753SGreg Roach 4988cd6753SGreg Roach $census = Mockery::mock(CensusInterface::class); 5088cd6753SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1832'); 5188cd6753SGreg Roach 5288cd6753SGreg Roach $column = new CensusColumnBirthDate($census, '', ''); 5388cd6753SGreg Roach 54*f3fa6d90SGreg Roach $this->assertSame('1 1 1800', $column->generate($individual)); 5588cd6753SGreg Roach } 5688cd6753SGreg Roach} 57