1da3cb887Sglarwill<?php 2da3cb887Sglarwill 3da3cb887Sglarwill/** 4da3cb887Sglarwill * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6da3cb887Sglarwill * This program is free software: you can redistribute it and/or modify 7da3cb887Sglarwill * it under the terms of the GNU General Public License as published by 8da3cb887Sglarwill * the Free Software Foundation, either version 3 of the License, or 9da3cb887Sglarwill * (at your option) any later version. 10da3cb887Sglarwill * This program is distributed in the hope that it will be useful, 11da3cb887Sglarwill * but WITHOUT ANY WARRANTY; without even the implied warranty of 12da3cb887Sglarwill * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13da3cb887Sglarwill * GNU General Public License for more details. 14da3cb887Sglarwill * You should have received a copy of the GNU General Public License 15da3cb887Sglarwill * along with this program. If not, see <https://www.gnu.org/licenses/>. 16da3cb887Sglarwill */ 17da3cb887Sglarwill 18da3cb887Sglarwilldeclare(strict_types=1); 19da3cb887Sglarwill 20da3cb887Sglarwillnamespace Fisharebest\Webtrees\Census; 21da3cb887Sglarwill 22da3cb887Sglarwilluse Fisharebest\Webtrees\Individual; 23da3cb887Sglarwilluse Fisharebest\Webtrees\TestCase; 24*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass; 25da3cb887Sglarwill 26*202c018bSGreg Roach#[CoversClass(CensusColumnSexF::class)] 27*202c018bSGreg Roach#[CoversClass(AbstractCensusColumn::class)] 28da3cb887Sglarwillclass CensusColumnSexFTest extends TestCase 29da3cb887Sglarwill{ 30da3cb887Sglarwill public function testMale(): void 31da3cb887Sglarwill { 32cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 33da3cb887Sglarwill $individual->method('sex')->willReturn('M'); 34da3cb887Sglarwill 35cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 36da3cb887Sglarwill 37da3cb887Sglarwill $column = new CensusColumnSexF($census, '', ''); 38da3cb887Sglarwill 39da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 40da3cb887Sglarwill } 41da3cb887Sglarwill 42da3cb887Sglarwill public function testFeale(): void 43da3cb887Sglarwill { 44cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 45da3cb887Sglarwill $individual->method('sex')->willReturn('F'); 46da3cb887Sglarwill 47cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 48da3cb887Sglarwill 49da3cb887Sglarwill $column = new CensusColumnSexF($census, '', ''); 50da3cb887Sglarwill 51da3cb887Sglarwill self::assertSame('X', $column->generate($individual, $individual)); 52da3cb887Sglarwill } 53da3cb887Sglarwill 54da3cb887Sglarwill public function testUnknownSex(): void 55da3cb887Sglarwill { 56cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 57da3cb887Sglarwill $individual->method('sex')->willReturn('U'); 58da3cb887Sglarwill 59cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 60da3cb887Sglarwill 61da3cb887Sglarwill $column = new CensusColumnSexF($census, '', ''); 62da3cb887Sglarwill 63da3cb887Sglarwill self::assertSame('', $column->generate($individual, $individual)); 64da3cb887Sglarwill } 65da3cb887Sglarwill} 66