xref: /webtrees/tests/app/Census/CensusColumnBirthDaySlashMonthYearTest.php (revision ddf438a50ef4ca889f688fe1c566ddf89d256ed1)
14c219c47SGreg Roach<?php
24c219c47SGreg Roach/**
34c219c47SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
54c219c47SGreg Roach * This program is free software: you can redistribute it and/or modify
64c219c47SGreg Roach * it under the terms of the GNU General Public License as published by
74c219c47SGreg Roach * the Free Software Foundation, either version 3 of the License, or
84c219c47SGreg Roach * (at your option) any later version.
94c219c47SGreg Roach * This program is distributed in the hope that it will be useful,
104c219c47SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
114c219c47SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124c219c47SGreg Roach * GNU General Public License for more details.
134c219c47SGreg Roach * You should have received a copy of the GNU General Public License
144c219c47SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
154c219c47SGreg Roach */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
184c219c47SGreg Roachnamespace Fisharebest\Webtrees\Census;
194c219c47SGreg Roach
20*ddf438a5SGreg Roachuse Fisharebest\Webtrees\Date;
21*ddf438a5SGreg Roachuse Fisharebest\Webtrees\Date\GregorianDate;
22*ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
234c219c47SGreg Roachuse Mockery;
244c219c47SGreg Roach
254c219c47SGreg Roach/**
264c219c47SGreg Roach * Test harness for the class CensusColumnBirthDaySlashMonthYearTest
274c219c47SGreg Roach */
2884e2cf4eSGreg Roachclass CensusColumnBirthDaySlashMonthYearTest extends \Fisharebest\Webtrees\TestCase
29c1010edaSGreg Roach{
304c219c47SGreg Roach    /**
314c219c47SGreg Roach     * Delete mock objects
3252348eb8SGreg Roach     *
3352348eb8SGreg Roach     * @return void
344c219c47SGreg Roach     */
35c1010edaSGreg Roach    public function tearDown()
36c1010edaSGreg Roach    {
374c219c47SGreg Roach        Mockery::close();
384c219c47SGreg Roach    }
394c219c47SGreg Roach
404c219c47SGreg Roach    /**
4115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthDaySlashMonthYearTest
4215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4352348eb8SGreg Roach     *
4452348eb8SGreg Roach     * @return void
454c219c47SGreg Roach     */
46c1010edaSGreg Roach    public function testGenerateColumn()
47c1010edaSGreg Roach    {
48*ddf438a5SGreg Roach        $cal_date = Mockery::mock(GregorianDate::class);
494c219c47SGreg Roach        $cal_date->shouldReceive('format')->andReturn('30/6 1832');
504c219c47SGreg Roach
51*ddf438a5SGreg Roach        $date = Mockery::mock(Date::class);
52220febf9SGreg Roach        $date->shouldReceive('minimumJulianDay')->andReturn(2390364);
53220febf9SGreg Roach        $date->shouldReceive('maximumJulianDay')->andReturn(2390364);
544c219c47SGreg Roach        $date->shouldReceive('minimumDate')->andReturn($cal_date);
554c219c47SGreg Roach
56*ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
574c219c47SGreg Roach        $individual->shouldReceive('getBirthDate')->andReturn($date);
584c219c47SGreg Roach
59*ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
604c219c47SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1832');
614c219c47SGreg Roach
624c219c47SGreg Roach        $column = new CensusColumnBirthDaySlashMonthYear($census, '', '');
634c219c47SGreg Roach
64342dcecdSGreg Roach        $this->assertSame('30/6 1832', $column->generate($individual, $individual));
654c219c47SGreg Roach    }
664c219c47SGreg Roach}
67