xref: /webtrees/tests/app/Census/CensusColumnBirthDaySlashMonthTest.php (revision 52348eb8c11b06a8488e13475e6561273832716a)
14c219c47SGreg Roach<?php
24c219c47SGreg Roach/**
34c219c47SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
54c219c47SGreg Roach * This program is free software: you can redistribute it and/or modify
64c219c47SGreg Roach * it under the terms of the GNU General Public License as published by
74c219c47SGreg Roach * the Free Software Foundation, either version 3 of the License, or
84c219c47SGreg Roach * (at your option) any later version.
94c219c47SGreg Roach * This program is distributed in the hope that it will be useful,
104c219c47SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
114c219c47SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124c219c47SGreg Roach * GNU General Public License for more details.
134c219c47SGreg Roach * You should have received a copy of the GNU General Public License
144c219c47SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
154c219c47SGreg Roach */
164c219c47SGreg Roachnamespace Fisharebest\Webtrees\Census;
174c219c47SGreg Roach
184c219c47SGreg Roachuse Mockery;
194c219c47SGreg Roach
204c219c47SGreg Roach/**
214c219c47SGreg Roach * Test harness for the class CensusColumnBirthDaySlashMonthTest
224c219c47SGreg Roach */
2384e2cf4eSGreg Roachclass CensusColumnBirthDaySlashMonthTest extends \Fisharebest\Webtrees\TestCase
24c1010edaSGreg Roach{
254c219c47SGreg Roach    /**
264c219c47SGreg Roach     * Delete mock objects
27*52348eb8SGreg Roach     *
28*52348eb8SGreg Roach     * @return void
294c219c47SGreg Roach     */
30c1010edaSGreg Roach    public function tearDown()
31c1010edaSGreg Roach    {
324c219c47SGreg Roach        Mockery::close();
334c219c47SGreg Roach    }
344c219c47SGreg Roach
354c219c47SGreg Roach    /**
3615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBirthDaySlashMonthTest
3715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
38*52348eb8SGreg Roach     *
39*52348eb8SGreg Roach     * @return void
404c219c47SGreg Roach     */
41c1010edaSGreg Roach    public function testGenerateColumn()
42c1010edaSGreg Roach    {
43b2dd3be6SGreg Roach        $cal_date = Mockery::mock('Fisharebest\Webtrees\Date\GregorianDate');
444c219c47SGreg Roach        $cal_date->shouldReceive('format')->andReturn('30/6');
454c219c47SGreg Roach
46c314ecc9SGreg Roach        $date = Mockery::mock('Fisharebest\Webtrees\Date');
47220febf9SGreg Roach        $date->shouldReceive('minimumJulianDay')->andReturn(2390364);
48220febf9SGreg Roach        $date->shouldReceive('maximumJulianDay')->andReturn(2390364);
494c219c47SGreg Roach        $date->shouldReceive('minimumDate')->andReturn($cal_date);
504c219c47SGreg Roach
51c314ecc9SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
524c219c47SGreg Roach        $individual->shouldReceive('getBirthDate')->andReturn($date);
534c219c47SGreg Roach
54c314ecc9SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
554c219c47SGreg Roach        $census->shouldReceive('censusDate')->andReturn('30 JUN 1832');
564c219c47SGreg Roach
574c219c47SGreg Roach        $column = new CensusColumnBirthDaySlashMonth($census, '', '');
584c219c47SGreg Roach
59342dcecdSGreg Roach        $this->assertSame('30/6', $column->generate($individual, $individual));
604c219c47SGreg Roach    }
614c219c47SGreg Roach}
62