1c2a8c8bfSGreg Roach<?php 23976b470SGreg Roach 3c2a8c8bfSGreg Roach/** 4c2a8c8bfSGreg Roach * webtrees: online genealogy 589f7189bSGreg Roach * Copyright (C) 2021 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; 24c2a8c8bfSGreg Roach 25c2a8c8bfSGreg Roach/** 26c2a8c8bfSGreg Roach * Test harness for the class CensusColumnSexMZ 27c2a8c8bfSGreg Roach */ 283cfcc809SGreg Roachclass CensusColumnSexMZTest extends TestCase 29c1010edaSGreg Roach{ 30c2a8c8bfSGreg Roach /** 3115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ 3215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 3352348eb8SGreg Roach * 3452348eb8SGreg Roach * @return void 35c2a8c8bfSGreg Roach */ 369b802b22SGreg Roach public function testMale(): void 37c1010edaSGreg Roach { 38*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 390ecdbde6SGreg Roach $individual->method('sex')->willReturn('M'); 40c2a8c8bfSGreg Roach 41*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 42c2a8c8bfSGreg Roach 43c2a8c8bfSGreg Roach $column = new CensusColumnSexMZ($census, '', ''); 44c2a8c8bfSGreg Roach 455e933c21SGreg Roach self::assertSame('M', $column->generate($individual, $individual)); 46c2a8c8bfSGreg Roach } 47c2a8c8bfSGreg Roach 48c2a8c8bfSGreg Roach /** 4915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ 5015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 5152348eb8SGreg Roach * 5252348eb8SGreg Roach * @return void 53c2a8c8bfSGreg Roach */ 549b802b22SGreg Roach public function testFeale(): void 55c1010edaSGreg Roach { 56*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 570ecdbde6SGreg Roach $individual->method('sex')->willReturn('F'); 58c2a8c8bfSGreg Roach 59*cd94ca66SGreg 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 66c2a8c8bfSGreg Roach /** 6715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ 6815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 6952348eb8SGreg Roach * 7052348eb8SGreg Roach * @return void 71c2a8c8bfSGreg Roach */ 729b802b22SGreg Roach public function testUnknownSex(): void 73c1010edaSGreg Roach { 74*cd94ca66SGreg Roach $individual = $this->createMock(Individual::class); 750ecdbde6SGreg Roach $individual->method('sex')->willReturn('U'); 76c2a8c8bfSGreg Roach 77*cd94ca66SGreg Roach $census = $this->createMock(CensusInterface::class); 78c2a8c8bfSGreg Roach 79c2a8c8bfSGreg Roach $column = new CensusColumnSexMZ($census, '', ''); 80c2a8c8bfSGreg Roach 815e933c21SGreg Roach self::assertSame('', $column->generate($individual, $individual)); 82c2a8c8bfSGreg Roach } 83c2a8c8bfSGreg Roach} 84