xref: /webtrees/tests/app/Census/CensusColumnBirthYearTest.php (revision 342dcecd8628deacd49d86f3247fd77e64bf33c3)
1f3fa6d90SGreg Roach<?php
2f3fa6d90SGreg Roach
3f3fa6d90SGreg Roach/**
4f3fa6d90SGreg Roach * webtrees: online genealogy
51062a142SGreg Roach * Copyright (C) 2018 webtrees development team
6f3fa6d90SGreg Roach * This program is free software: you can redistribute it and/or modify
7f3fa6d90SGreg Roach * it under the terms of the GNU General Public License as published by
8f3fa6d90SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9f3fa6d90SGreg Roach * (at your option) any later version.
10f3fa6d90SGreg Roach * This program is distributed in the hope that it will be useful,
11f3fa6d90SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12f3fa6d90SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13f3fa6d90SGreg Roach * GNU General Public License for more details.
14f3fa6d90SGreg Roach * You should have received a copy of the GNU General Public License
15f3fa6d90SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16f3fa6d90SGreg Roach */
17f3fa6d90SGreg Roachnamespace Fisharebest\Webtrees\Census;
18f3fa6d90SGreg Roach
19f3fa6d90SGreg Roachuse Mockery;
20f3fa6d90SGreg Roach
21f3fa6d90SGreg Roach/**
22f3fa6d90SGreg Roach * Test harness for the class CensusColumnAge
23f3fa6d90SGreg Roach */
24c1010edaSGreg Roachclass CensusColumnBirthYearTest extends \PHPUnit\Framework\TestCase
25c1010edaSGreg Roach{
26f3fa6d90SGreg Roach    /**
27f3fa6d90SGreg Roach     * Delete mock objects
28f3fa6d90SGreg Roach     */
29c1010edaSGreg Roach    public function tearDown()
30c1010edaSGreg Roach    {
31f3fa6d90SGreg Roach        Mockery::close();
32f3fa6d90SGreg Roach    }
33f3fa6d90SGreg Roach
34f3fa6d90SGreg Roach    /**
3515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthYear
3615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
37f3fa6d90SGreg Roach     */
38c1010edaSGreg Roach    public function testGenerateColumn()
39c1010edaSGreg Roach    {
40b2dd3be6SGreg Roach        $cal_date = Mockery::mock('Fisharebest\Webtrees\Date\GregorianDate');
41f3fa6d90SGreg Roach        $cal_date->shouldReceive('format')->andReturn('1800');
42f3fa6d90SGreg Roach
43c314ecc9SGreg Roach        $date = Mockery::mock('Fisharebest\Webtrees\Date');
44f3fa6d90SGreg Roach        $date->shouldReceive('minimumDate')->andReturn($cal_date);
45f3fa6d90SGreg Roach
46c314ecc9SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
47f3fa6d90SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn($date);
48f3fa6d90SGreg Roach
49c314ecc9SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
50f3fa6d90SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1832');
51f3fa6d90SGreg Roach
52f3fa6d90SGreg Roach        $column = new CensusColumnBirthYear($census, '', '');
53f3fa6d90SGreg Roach
54*342dcecdSGreg Roach        $this->assertSame('1800', $column->generate($individual, $individual));
55f3fa6d90SGreg Roach    }
56f3fa6d90SGreg Roach}
57