xref: /webtrees/tests/app/Census/CensusColumnSexMFTest.php (revision 3976b4703df669696105ed6b024b96d433c8fbdb)
1a53db70dSGreg Roach<?php
2*3976b470SGreg Roach
3a53db70dSGreg Roach/**
4a53db70dSGreg Roach * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
6a53db70dSGreg Roach * This program is free software: you can redistribute it and/or modify
7a53db70dSGreg Roach * it under the terms of the GNU General Public License as published by
8a53db70dSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9a53db70dSGreg Roach * (at your option) any later version.
10a53db70dSGreg Roach * This program is distributed in the hope that it will be useful,
11a53db70dSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12a53db70dSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13a53db70dSGreg Roach * GNU General Public License for more details.
14a53db70dSGreg Roach * You should have received a copy of the GNU General Public License
15a53db70dSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16a53db70dSGreg Roach */
17e7f56f2aSGreg Roachdeclare(strict_types=1);
18e7f56f2aSGreg Roach
19a53db70dSGreg Roachnamespace Fisharebest\Webtrees\Census;
20a53db70dSGreg Roach
21ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
22a53db70dSGreg Roach
23a53db70dSGreg Roach/**
24a53db70dSGreg Roach * Test harness for the class CensusColumnSexMF
25a53db70dSGreg Roach */
2684e2cf4eSGreg Roachclass CensusColumnSexMFTest extends \Fisharebest\Webtrees\TestCase
27c1010edaSGreg Roach{
28a53db70dSGreg Roach    /**
2915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF
3015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
3152348eb8SGreg Roach     *
3252348eb8SGreg Roach     * @return void
33a53db70dSGreg Roach     */
349b802b22SGreg Roach    public function testMale(): void
35c1010edaSGreg Roach    {
360ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
370ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
38a53db70dSGreg Roach
390ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
40a53db70dSGreg Roach
41a53db70dSGreg Roach        $column = new CensusColumnSexMF($census, '', '');
42a53db70dSGreg Roach
43342dcecdSGreg Roach        $this->assertSame('M', $column->generate($individual, $individual));
44a53db70dSGreg Roach    }
45a53db70dSGreg Roach
46a53db70dSGreg Roach    /**
4715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF
4815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4952348eb8SGreg Roach     *
5052348eb8SGreg Roach     * @return void
51a53db70dSGreg Roach     */
529b802b22SGreg Roach    public function testFeale(): void
53c1010edaSGreg Roach    {
540ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
550ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
56a53db70dSGreg Roach
570ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
58a53db70dSGreg Roach
59a53db70dSGreg Roach        $column = new CensusColumnSexMF($census, '', '');
60a53db70dSGreg Roach
61342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
62a53db70dSGreg Roach    }
63a53db70dSGreg Roach
64a53db70dSGreg Roach    /**
6515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF
6615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
6752348eb8SGreg Roach     *
6852348eb8SGreg Roach     * @return void
69a53db70dSGreg Roach     */
709b802b22SGreg Roach    public function testUnknownSex(): void
71c1010edaSGreg Roach    {
720ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
730ecdbde6SGreg Roach        $individual->method('sex')->willReturn('U');
74a53db70dSGreg Roach
750ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
76a53db70dSGreg Roach
77a53db70dSGreg Roach        $column = new CensusColumnSexMF($census, '', '');
78a53db70dSGreg Roach
79342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
80a53db70dSGreg Roach    }
81a53db70dSGreg Roach}
82