xref: /webtrees/tests/app/Census/CensusColumnBirthDateTest.php (revision 88cd67539b9b6d00c4a43b0d948a1e3cd6459ebf)
1*88cd6753SGreg Roach<?php
2*88cd6753SGreg Roach
3*88cd6753SGreg Roach/**
4*88cd6753SGreg Roach * webtrees: online genealogy
5*88cd6753SGreg Roach * Copyright (C) 2015 webtrees development team
6*88cd6753SGreg Roach * This program is free software: you can redistribute it and/or modify
7*88cd6753SGreg Roach * it under the terms of the GNU General Public License as published by
8*88cd6753SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*88cd6753SGreg Roach * (at your option) any later version.
10*88cd6753SGreg Roach * This program is distributed in the hope that it will be useful,
11*88cd6753SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*88cd6753SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*88cd6753SGreg Roach * GNU General Public License for more details.
14*88cd6753SGreg Roach * You should have received a copy of the GNU General Public License
15*88cd6753SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16*88cd6753SGreg Roach */
17*88cd6753SGreg Roach
18*88cd6753SGreg Roachnamespace Fisharebest\Webtrees\Census;
19*88cd6753SGreg Roach
20*88cd6753SGreg Roachuse Fisharebest\Webtrees\Date;
21*88cd6753SGreg Roachuse Fisharebest\Webtrees\Individual;
22*88cd6753SGreg Roachuse Mockery;
23*88cd6753SGreg Roach
24*88cd6753SGreg Roach/**
25*88cd6753SGreg Roach * Test harness for the class CensusColumnAge
26*88cd6753SGreg Roach */
27*88cd6753SGreg Roachclass CensusColumnBirthDateTest extends \PHPUnit_Framework_TestCase {
28*88cd6753SGreg Roach	/**
29*88cd6753SGreg Roach	 * Delete mock objects
30*88cd6753SGreg Roach	 */
31*88cd6753SGreg Roach	public function tearDown() {
32*88cd6753SGreg Roach		Mockery::close();
33*88cd6753SGreg Roach	}
34*88cd6753SGreg Roach
35*88cd6753SGreg Roach	/**
36*88cd6753SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnBirthDate
37*88cd6753SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
38*88cd6753SGreg Roach	 */
39*88cd6753SGreg Roach	public function testGenerateColumn() {
40*88cd6753SGreg Roach		$date = Mockery::mock(Date::class);
41*88cd6753SGreg Roach		$date->shouldReceive('display')->andReturn('1 January 1800');
42*88cd6753SGreg Roach
43*88cd6753SGreg Roach		$individual = Mockery::mock(Individual::class);
44*88cd6753SGreg Roach		$individual->shouldReceive('getEstimatedBirthDate')->andReturn($date);
45*88cd6753SGreg Roach
46*88cd6753SGreg Roach		$census = Mockery::mock(CensusInterface::class);
47*88cd6753SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1832');
48*88cd6753SGreg Roach
49*88cd6753SGreg Roach		$column = new CensusColumnBirthDate($census, '', '');
50*88cd6753SGreg Roach
51*88cd6753SGreg Roach		$this->assertSame('1 January 1800', $column->generate($individual));
52*88cd6753SGreg Roach	}
53*88cd6753SGreg Roach}
54