xref: /webtrees/tests/app/Census/CensusColumnBirthDateTest.php (revision e7f56f2af615447ab1a7646851f88b465ace9e04)
188cd6753SGreg Roach<?php
288cd6753SGreg Roach/**
388cd6753SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
588cd6753SGreg Roach * This program is free software: you can redistribute it and/or modify
688cd6753SGreg Roach * it under the terms of the GNU General Public License as published by
788cd6753SGreg Roach * the Free Software Foundation, either version 3 of the License, or
888cd6753SGreg Roach * (at your option) any later version.
988cd6753SGreg Roach * This program is distributed in the hope that it will be useful,
1088cd6753SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1188cd6753SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1288cd6753SGreg Roach * GNU General Public License for more details.
1388cd6753SGreg Roach * You should have received a copy of the GNU General Public License
1488cd6753SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1588cd6753SGreg Roach */
16*e7f56f2aSGreg Roachdeclare(strict_types=1);
17*e7f56f2aSGreg Roach
1888cd6753SGreg Roachnamespace Fisharebest\Webtrees\Census;
1988cd6753SGreg Roach
2088cd6753SGreg Roachuse Mockery;
2188cd6753SGreg Roach
2288cd6753SGreg Roach/**
2388cd6753SGreg Roach * Test harness for the class CensusColumnAge
2488cd6753SGreg Roach */
2584e2cf4eSGreg Roachclass CensusColumnBirthDateTest extends \Fisharebest\Webtrees\TestCase
26c1010edaSGreg Roach{
2788cd6753SGreg Roach    /**
2888cd6753SGreg Roach     * Delete mock objects
2952348eb8SGreg Roach     *
3052348eb8SGreg Roach     * @return void
3188cd6753SGreg Roach     */
32c1010edaSGreg Roach    public function tearDown()
33c1010edaSGreg Roach    {
3488cd6753SGreg Roach        Mockery::close();
3588cd6753SGreg Roach    }
3688cd6753SGreg Roach
3788cd6753SGreg Roach    /**
3815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthDate
3915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4052348eb8SGreg Roach     *
4152348eb8SGreg Roach     * @return void
4288cd6753SGreg Roach     */
43c1010edaSGreg Roach    public function testGenerateColumn()
44c1010edaSGreg Roach    {
45b2dd3be6SGreg Roach        $cal_date = Mockery::mock('Fisharebest\Webtrees\Date\GregorianDate');
46f3fa6d90SGreg Roach        $cal_date->shouldReceive('format')->andReturn('1 1 1800');
47f3fa6d90SGreg Roach
48c314ecc9SGreg Roach        $date = Mockery::mock('Fisharebest\Webtrees\Date');
49f3fa6d90SGreg Roach        $date->shouldReceive('minimumDate')->andReturn($cal_date);
5088cd6753SGreg Roach
51c314ecc9SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
5288cd6753SGreg Roach        $individual->shouldReceive('getEstimatedBirthDate')->andReturn($date);
5388cd6753SGreg Roach
54c314ecc9SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
5588cd6753SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1832');
5688cd6753SGreg Roach
5788cd6753SGreg Roach        $column = new CensusColumnBirthDate($census, '', '');
5888cd6753SGreg Roach
59342dcecdSGreg Roach        $this->assertSame('1 1 1800', $column->generate($individual, $individual));
6088cd6753SGreg Roach    }
6188cd6753SGreg Roach}
62