1f3fa6d90SGreg Roach<?php 2f3fa6d90SGreg Roach/** 3f3fa6d90SGreg Roach * webtrees: online genealogy 41062a142SGreg Roach * Copyright (C) 2018 webtrees development team 5f3fa6d90SGreg Roach * This program is free software: you can redistribute it and/or modify 6f3fa6d90SGreg Roach * it under the terms of the GNU General Public License as published by 7f3fa6d90SGreg Roach * the Free Software Foundation, either version 3 of the License, or 8f3fa6d90SGreg Roach * (at your option) any later version. 9f3fa6d90SGreg Roach * This program is distributed in the hope that it will be useful, 10f3fa6d90SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 11f3fa6d90SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12f3fa6d90SGreg Roach * GNU General Public License for more details. 13f3fa6d90SGreg Roach * You should have received a copy of the GNU General Public License 14f3fa6d90SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 15f3fa6d90SGreg Roach */ 16*e7f56f2aSGreg Roachdeclare(strict_types=1); 17*e7f56f2aSGreg Roach 18f3fa6d90SGreg Roachnamespace Fisharebest\Webtrees\Census; 19f3fa6d90SGreg Roach 20f3fa6d90SGreg Roachuse Mockery; 21f3fa6d90SGreg Roach 22f3fa6d90SGreg Roach/** 23f3fa6d90SGreg Roach * Test harness for the class CensusColumnAge 24f3fa6d90SGreg Roach */ 2584e2cf4eSGreg Roachclass CensusColumnBirthYearTest extends \Fisharebest\Webtrees\TestCase 26c1010edaSGreg Roach{ 27f3fa6d90SGreg Roach /** 28f3fa6d90SGreg Roach * Delete mock objects 2952348eb8SGreg Roach * 3052348eb8SGreg Roach * @return void 31f3fa6d90SGreg Roach */ 32c1010edaSGreg Roach public function tearDown() 33c1010edaSGreg Roach { 34f3fa6d90SGreg Roach Mockery::close(); 35f3fa6d90SGreg Roach } 36f3fa6d90SGreg Roach 37f3fa6d90SGreg Roach /** 3815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthYear 3915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 4052348eb8SGreg Roach * 4152348eb8SGreg Roach * @return void 42f3fa6d90SGreg Roach */ 43c1010edaSGreg Roach public function testGenerateColumn() 44c1010edaSGreg Roach { 45b2dd3be6SGreg Roach $cal_date = Mockery::mock('Fisharebest\Webtrees\Date\GregorianDate'); 46f3fa6d90SGreg Roach $cal_date->shouldReceive('format')->andReturn('1800'); 47f3fa6d90SGreg Roach 48c314ecc9SGreg Roach $date = Mockery::mock('Fisharebest\Webtrees\Date'); 49f3fa6d90SGreg Roach $date->shouldReceive('minimumDate')->andReturn($cal_date); 50f3fa6d90SGreg Roach 51c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 52f3fa6d90SGreg Roach $individual->shouldReceive('getEstimatedBirthDate')->andReturn($date); 53f3fa6d90SGreg Roach 54c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 55f3fa6d90SGreg Roach $census->shouldReceive('censusDate')->andReturn('30 JUN 1832'); 56f3fa6d90SGreg Roach 57f3fa6d90SGreg Roach $column = new CensusColumnBirthYear($census, '', ''); 58f3fa6d90SGreg Roach 59342dcecdSGreg Roach $this->assertSame('1800', $column->generate($individual, $individual)); 60f3fa6d90SGreg Roach } 61f3fa6d90SGreg Roach} 62