xref: /webtrees/tests/app/Census/CensusColumnBirthMonthTest.php (revision 8fcd0d32e56ee262912bbdb593202cfd1cbc1615)
1f3fa6d90SGreg Roach<?php
2f3fa6d90SGreg Roach/**
3f3fa6d90SGreg Roach * webtrees: online genealogy
4*8fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
5f3fa6d90SGreg Roach * This program is free software: you can redistribute it and/or modify
6f3fa6d90SGreg Roach * it under the terms of the GNU General Public License as published by
7f3fa6d90SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8f3fa6d90SGreg Roach * (at your option) any later version.
9f3fa6d90SGreg Roach * This program is distributed in the hope that it will be useful,
10f3fa6d90SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11f3fa6d90SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12f3fa6d90SGreg Roach * GNU General Public License for more details.
13f3fa6d90SGreg Roach * You should have received a copy of the GNU General Public License
14f3fa6d90SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15f3fa6d90SGreg Roach */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
18f3fa6d90SGreg Roachnamespace Fisharebest\Webtrees\Census;
19f3fa6d90SGreg Roach
20ddf438a5SGreg Roachuse Fisharebest\Webtrees\Date;
21ddf438a5SGreg Roachuse Fisharebest\Webtrees\Date\GregorianDate;
22ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
23f3fa6d90SGreg Roachuse Mockery;
24f3fa6d90SGreg Roach
25f3fa6d90SGreg Roach/**
26f3fa6d90SGreg Roach * Test harness for the class CensusColumnAge
27f3fa6d90SGreg Roach */
2884e2cf4eSGreg Roachclass CensusColumnBirthMonthTest extends \Fisharebest\Webtrees\TestCase
29c1010edaSGreg Roach{
30f3fa6d90SGreg Roach    /**
31f3fa6d90SGreg Roach     * Delete mock objects
3252348eb8SGreg Roach     *
3352348eb8SGreg Roach     * @return void
34f3fa6d90SGreg Roach     */
35c1010edaSGreg Roach    public function tearDown()
36c1010edaSGreg Roach    {
37f3fa6d90SGreg Roach        Mockery::close();
38f3fa6d90SGreg Roach    }
39f3fa6d90SGreg Roach
40f3fa6d90SGreg Roach    /**
4115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthMonth
4215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4352348eb8SGreg Roach     *
4452348eb8SGreg Roach     * @return void
45f3fa6d90SGreg Roach     */
46c1010edaSGreg Roach    public function testGenerateColumn()
47c1010edaSGreg Roach    {
48ddf438a5SGreg Roach        $cal_date = Mockery::mock(GregorianDate::class);
49f3fa6d90SGreg Roach        $cal_date->shouldReceive('format')->andReturn('Jan');
50f3fa6d90SGreg Roach
51ddf438a5SGreg Roach        $date = Mockery::mock(Date::class);
52f3fa6d90SGreg Roach        $date->shouldReceive('minimumDate')->andReturn($cal_date);
53f3fa6d90SGreg Roach
54ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
55f3fa6d90SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn($date);
56f3fa6d90SGreg Roach
57ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
58f3fa6d90SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1832');
59f3fa6d90SGreg Roach
60f3fa6d90SGreg Roach        $column = new CensusColumnBirthMonth($census, '', '');
61f3fa6d90SGreg Roach
62342dcecdSGreg Roach        $this->assertSame('Jan', $column->generate($individual, $individual));
63f3fa6d90SGreg Roach    }
64f3fa6d90SGreg Roach}
65