xref: /webtrees/tests/app/Census/CensusColumnSexMZTest.php (revision 5a8afed46297e8105e3e5a33ce37e6a8e88bc79d)
1c2a8c8bfSGreg Roach<?php
23976b470SGreg Roach
3c2a8c8bfSGreg Roach/**
4c2a8c8bfSGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6c2a8c8bfSGreg Roach * This program is free software: you can redistribute it and/or modify
7c2a8c8bfSGreg Roach * it under the terms of the GNU General Public License as published by
8c2a8c8bfSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9c2a8c8bfSGreg Roach * (at your option) any later version.
10c2a8c8bfSGreg Roach * This program is distributed in the hope that it will be useful,
11c2a8c8bfSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12c2a8c8bfSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13c2a8c8bfSGreg Roach * GNU General Public License for more details.
14c2a8c8bfSGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16c2a8c8bfSGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
20c2a8c8bfSGreg Roachnamespace Fisharebest\Webtrees\Census;
21c2a8c8bfSGreg Roach
22ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
233cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
24*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
25c2a8c8bfSGreg Roach
26*202c018bSGreg Roach#[CoversClass(CensusColumnSexMZ::class)]
27*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)]
283cfcc809SGreg Roachclass CensusColumnSexMZTest extends TestCase
29c1010edaSGreg Roach{
309b802b22SGreg Roach    public function testMale(): void
31c1010edaSGreg Roach    {
32cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
330ecdbde6SGreg Roach        $individual->method('sex')->willReturn('M');
34c2a8c8bfSGreg Roach
35cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
36c2a8c8bfSGreg Roach
37c2a8c8bfSGreg Roach        $column = new CensusColumnSexMZ($census, '', '');
38c2a8c8bfSGreg Roach
395e933c21SGreg Roach        self::assertSame('M', $column->generate($individual, $individual));
40c2a8c8bfSGreg Roach    }
41c2a8c8bfSGreg Roach
429b802b22SGreg Roach    public function testFeale(): void
43c1010edaSGreg Roach    {
44cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
450ecdbde6SGreg Roach        $individual->method('sex')->willReturn('F');
46c2a8c8bfSGreg Roach
47cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
48c2a8c8bfSGreg Roach
49c2a8c8bfSGreg Roach        $column = new CensusColumnSexMZ($census, '', '');
50c2a8c8bfSGreg Roach
515e933c21SGreg Roach        self::assertSame('Ž', $column->generate($individual, $individual));
52c2a8c8bfSGreg Roach    }
53c2a8c8bfSGreg Roach
549b802b22SGreg Roach    public function testUnknownSex(): void
55c1010edaSGreg Roach    {
56cd94ca66SGreg Roach        $individual = $this->createMock(Individual::class);
570ecdbde6SGreg Roach        $individual->method('sex')->willReturn('U');
58c2a8c8bfSGreg Roach
59cd94ca66SGreg Roach        $census = $this->createMock(CensusInterface::class);
60c2a8c8bfSGreg Roach
61c2a8c8bfSGreg Roach        $column = new CensusColumnSexMZ($census, '', '');
62c2a8c8bfSGreg Roach
635e933c21SGreg Roach        self::assertSame('', $column->generate($individual, $individual));
64c2a8c8bfSGreg Roach    }
65c2a8c8bfSGreg Roach}
66