xref: /webtrees/tests/app/Census/CensusColumnBirthDaySlashMonthTest.php (revision c314ecc9a18e5e740a1c0fcb7379ef541f969dc5)
14c219c47SGreg Roach<?php
24c219c47SGreg Roach
34c219c47SGreg Roach/**
44c219c47SGreg Roach * webtrees: online genealogy
54c219c47SGreg Roach * Copyright (C) 2015 webtrees development team
64c219c47SGreg Roach * This program is free software: you can redistribute it and/or modify
74c219c47SGreg Roach * it under the terms of the GNU General Public License as published by
84c219c47SGreg Roach * the Free Software Foundation, either version 3 of the License, or
94c219c47SGreg Roach * (at your option) any later version.
104c219c47SGreg Roach * This program is distributed in the hope that it will be useful,
114c219c47SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
124c219c47SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
134c219c47SGreg Roach * GNU General Public License for more details.
144c219c47SGreg Roach * You should have received a copy of the GNU General Public License
154c219c47SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
164c219c47SGreg Roach */
174c219c47SGreg Roachnamespace Fisharebest\Webtrees\Census;
184c219c47SGreg Roach
194c219c47SGreg Roachuse Fisharebest\Webtrees\Date;
204c219c47SGreg Roachuse Fisharebest\Webtrees\Individual;
214c219c47SGreg Roachuse Mockery;
224c219c47SGreg Roach
234c219c47SGreg Roach/**
244c219c47SGreg Roach * Test harness for the class CensusColumnBirthDaySlashMonthTest
254c219c47SGreg Roach */
264c219c47SGreg Roachclass CensusColumnBirthDaySlashMonthTest extends \PHPUnit_Framework_TestCase {
274c219c47SGreg Roach	/**
284c219c47SGreg Roach	 * Delete mock objects
294c219c47SGreg Roach	 */
304c219c47SGreg Roach	public function tearDown() {
314c219c47SGreg Roach		Mockery::close();
324c219c47SGreg Roach	}
334c219c47SGreg Roach
344c219c47SGreg Roach	/**
354c219c47SGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnBirthDaySlashMonthTest
364c219c47SGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
374c219c47SGreg Roach	 */
384c219c47SGreg Roach	public function testGenerateColumn() {
39*c314ecc9SGreg Roach		$cal_date = Mockery::mock('Fisharebest\Webtrees\Date\CalendarDate');
404c219c47SGreg Roach		$cal_date->shouldReceive('format')->andReturn('30/6');
414c219c47SGreg Roach
42*c314ecc9SGreg Roach		$date = Mockery::mock('Fisharebest\Webtrees\Date');
434c219c47SGreg Roach		$date->shouldReceive('minimumJulianDay')->andReturn($cal_date);
444c219c47SGreg Roach		$date->shouldReceive('maximumJulianDay')->andReturn($cal_date);
454c219c47SGreg Roach		$date->shouldReceive('minimumDate')->andReturn($cal_date);
464c219c47SGreg Roach
47*c314ecc9SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
484c219c47SGreg Roach		$individual->shouldReceive('getBirthDate')->andReturn($date);
494c219c47SGreg Roach
50*c314ecc9SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
514c219c47SGreg Roach		$census->shouldReceive('censusDate')->andReturn('30 JUN 1832');
524c219c47SGreg Roach
534c219c47SGreg Roach		$column = new CensusColumnBirthDaySlashMonth($census, '', '');
544c219c47SGreg Roach
554c219c47SGreg Roach		$this->assertSame('30/6', $column->generate($individual));
564c219c47SGreg Roach	}
574c219c47SGreg Roach}
58