xref: /webtrees/tests/app/Census/CensusColumnBirthDayTest.php (revision 0ecdbde6aab590acff4665ec491a8427f5b7c90e)
1ce92b752Smpwt<?php
2ce92b752Smpwt/**
3ce92b752Smpwt * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
5ce92b752Smpwt * This program is free software: you can redistribute it and/or modify
6ce92b752Smpwt * it under the terms of the GNU General Public License as published by
7ce92b752Smpwt * the Free Software Foundation, either version 3 of the License, or
8ce92b752Smpwt * (at your option) any later version.
9ce92b752Smpwt * This program is distributed in the hope that it will be useful,
10ce92b752Smpwt * but WITHOUT ANY WARRANTY; without even the implied warranty of
11ce92b752Smpwt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12ce92b752Smpwt * GNU General Public License for more details.
13ce92b752Smpwt * You should have received a copy of the GNU General Public License
14ce92b752Smpwt * along with this program. If not, see <http://www.gnu.org/licenses/>.
15ce92b752Smpwt */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
18ce92b752Smpwtnamespace Fisharebest\Webtrees\Census;
19ce92b752Smpwt
20ddf438a5SGreg Roachuse Fisharebest\Webtrees\Date;
21ddf438a5SGreg Roachuse Fisharebest\Webtrees\Date\GregorianDate;
22ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
23ce92b752Smpwt
24ce92b752Smpwt/**
25ce92b752Smpwt * Test harness for the class CensusColumnAge
26ce92b752Smpwt */
2784e2cf4eSGreg Roachclass CensusColumnBirthDayTest extends \Fisharebest\Webtrees\TestCase
28c1010edaSGreg Roach{
29ce92b752Smpwt    /**
3015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthDay
3115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
3252348eb8SGreg Roach     *
3352348eb8SGreg Roach     * @return void
34ce92b752Smpwt     */
359b802b22SGreg Roach    public function testGenerateColumn(): void
36c1010edaSGreg Roach    {
37*0ecdbde6SGreg Roach        $cal_date = $this->createMock(GregorianDate::class);
38*0ecdbde6SGreg Roach        $cal_date->method('format')->willReturn('30');
39ce92b752Smpwt
40*0ecdbde6SGreg Roach        $date = $this->createMock(Date::class);
41*0ecdbde6SGreg Roach        $date->method('minimumDate')->willReturn($cal_date);
42ce92b752Smpwt
43*0ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
44*0ecdbde6SGreg Roach        $individual->method('getEstimatedBirthDate')->willReturn($date);
45ce92b752Smpwt
46*0ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
47*0ecdbde6SGreg Roach        $census->method('censusDate')->willReturn('30 JUN 1832');
48ce92b752Smpwt
49ce92b752Smpwt        $column = new CensusColumnBirthDay($census, '', '');
50ce92b752Smpwt
51342dcecdSGreg Roach        $this->assertSame('30', $column->generate($individual, $individual));
52ce92b752Smpwt    }
53ce92b752Smpwt}
54