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