xref: /webtrees/tests/app/Census/CensusColumnBirthDaySlashMonthYearTest.php (revision 89f7189b61a494347591c99bdb92afb7d8b66e1b)
14c219c47SGreg Roach<?php
23976b470SGreg Roach
34c219c47SGreg Roach/**
44c219c47SGreg Roach * webtrees: online genealogy
5*89f7189bSGreg Roach * Copyright (C) 2021 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
15*89f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
164c219c47SGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
204c219c47SGreg Roachnamespace Fisharebest\Webtrees\Census;
214c219c47SGreg Roach
22ddf438a5SGreg Roachuse Fisharebest\Webtrees\Date;
23ddf438a5SGreg Roachuse Fisharebest\Webtrees\Date\GregorianDate;
24ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
253cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
264c219c47SGreg Roach
274c219c47SGreg Roach/**
284c219c47SGreg Roach * Test harness for the class CensusColumnBirthDaySlashMonthYearTest
294c219c47SGreg Roach */
303cfcc809SGreg Roachclass CensusColumnBirthDaySlashMonthYearTest extends TestCase
31c1010edaSGreg Roach{
324c219c47SGreg Roach    /**
3315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthDaySlashMonthYearTest
3415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
3552348eb8SGreg Roach     *
3652348eb8SGreg Roach     * @return void
374c219c47SGreg Roach     */
389b802b22SGreg Roach    public function testGenerateColumn(): void
39c1010edaSGreg Roach    {
405e933c21SGreg Roach        $cal_date = self::createMock(GregorianDate::class);
410ecdbde6SGreg Roach        $cal_date->method('format')->willReturn('30/6 1832');
424c219c47SGreg Roach
435e933c21SGreg Roach        $date = self::createMock(Date::class);
440ecdbde6SGreg Roach        $date->method('minimumJulianDay')->willReturn(2390364);
450ecdbde6SGreg Roach        $date->method('maximumJulianDay')->willReturn(2390364);
460ecdbde6SGreg Roach        $date->method('minimumDate')->willReturn($cal_date);
474c219c47SGreg Roach
485e933c21SGreg Roach        $individual = self::createMock(Individual::class);
490ecdbde6SGreg Roach        $individual->method('getBirthDate')->willReturn($date);
504c219c47SGreg Roach
515e933c21SGreg Roach        $census = self::createMock(CensusInterface::class);
520ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1832');
534c219c47SGreg Roach
544c219c47SGreg Roach        $column = new CensusColumnBirthDaySlashMonthYear($census, '', '');
554c219c47SGreg Roach
565e933c21SGreg Roach        self::assertSame('30/6 1832', $column->generate($individual, $individual));
574c219c47SGreg Roach    }
584c219c47SGreg Roach}
59