xref: /webtrees/tests/app/Census/CensusColumnSexMKTest.php (revision ddf438a50ef4ca889f688fe1c566ddf89d256ed1)
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 */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
184c219c47SGreg Roachnamespace Fisharebest\Webtrees\Census;
194c219c47SGreg Roach
20*ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
214c219c47SGreg Roachuse Mockery;
224c219c47SGreg Roach
234c219c47SGreg Roach/**
244c219c47SGreg Roach * Test harness for the class CensusColumnSexMK
254c219c47SGreg Roach */
2684e2cf4eSGreg Roachclass CensusColumnSexMKTest extends \Fisharebest\Webtrees\TestCase
27c1010edaSGreg Roach{
284c219c47SGreg Roach    /**
294c219c47SGreg Roach     * Delete mock objects
3052348eb8SGreg Roach     *
3152348eb8SGreg Roach     * @return void
324c219c47SGreg Roach     */
33c1010edaSGreg Roach    public function tearDown()
34c1010edaSGreg Roach    {
354c219c47SGreg Roach        Mockery::close();
364c219c47SGreg Roach    }
374c219c47SGreg Roach
384c219c47SGreg Roach    /**
3915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMK
4015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4152348eb8SGreg Roach     *
4252348eb8SGreg Roach     * @return void
434c219c47SGreg Roach     */
44c1010edaSGreg Roach    public function testMale()
45c1010edaSGreg Roach    {
46*ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
474c219c47SGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
484c219c47SGreg Roach
49*ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
504c219c47SGreg Roach
514c219c47SGreg Roach        $column = new CensusColumnSexMK($census, '', '');
524c219c47SGreg Roach
53342dcecdSGreg Roach        $this->assertSame('M', $column->generate($individual, $individual));
544c219c47SGreg Roach    }
554c219c47SGreg Roach
564c219c47SGreg Roach    /**
5715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMK
5815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
5952348eb8SGreg Roach     *
6052348eb8SGreg Roach     * @return void
614c219c47SGreg Roach     */
62c1010edaSGreg Roach    public function testFeale()
63c1010edaSGreg Roach    {
64*ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
654c219c47SGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
664c219c47SGreg Roach
67*ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
684c219c47SGreg Roach
694c219c47SGreg Roach        $column = new CensusColumnSexMK($census, '', '');
704c219c47SGreg Roach
71342dcecdSGreg Roach        $this->assertSame('K', $column->generate($individual, $individual));
724c219c47SGreg Roach    }
734c219c47SGreg Roach
744c219c47SGreg Roach    /**
7515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMK
7615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
7752348eb8SGreg Roach     *
7852348eb8SGreg Roach     * @return void
794c219c47SGreg Roach     */
80c1010edaSGreg Roach    public function testUnknownSex()
81c1010edaSGreg Roach    {
82*ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
834c219c47SGreg Roach        $individual->shouldReceive('getSex')->andReturn('U');
844c219c47SGreg Roach
85*ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
864c219c47SGreg Roach
874c219c47SGreg Roach        $column = new CensusColumnSexMK($census, '', '');
884c219c47SGreg Roach
89342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
904c219c47SGreg Roach    }
914c219c47SGreg Roach}
92