1c2a8c8bfSGreg Roach<?php 2c2a8c8bfSGreg Roach/** 3c2a8c8bfSGreg Roach * webtrees: online genealogy 48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 5c2a8c8bfSGreg Roach * This program is free software: you can redistribute it and/or modify 6c2a8c8bfSGreg Roach * it under the terms of the GNU General Public License as published by 7c2a8c8bfSGreg Roach * the Free Software Foundation, either version 3 of the License, or 8c2a8c8bfSGreg Roach * (at your option) any later version. 9c2a8c8bfSGreg Roach * This program is distributed in the hope that it will be useful, 10c2a8c8bfSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 11c2a8c8bfSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12c2a8c8bfSGreg Roach * GNU General Public License for more details. 13c2a8c8bfSGreg Roach * You should have received a copy of the GNU General Public License 14c2a8c8bfSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 15c2a8c8bfSGreg Roach */ 16e7f56f2aSGreg Roachdeclare(strict_types=1); 17e7f56f2aSGreg Roach 18c2a8c8bfSGreg Roachnamespace Fisharebest\Webtrees\Census; 19c2a8c8bfSGreg Roach 20ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual; 21c2a8c8bfSGreg Roachuse Mockery; 22c2a8c8bfSGreg Roach 23c2a8c8bfSGreg Roach/** 24c2a8c8bfSGreg Roach * Test harness for the class CensusColumnSexMZ 25c2a8c8bfSGreg Roach */ 2684e2cf4eSGreg Roachclass CensusColumnSexMZTest extends \Fisharebest\Webtrees\TestCase 27c1010edaSGreg Roach{ 28c2a8c8bfSGreg Roach /** 29c2a8c8bfSGreg Roach * Delete mock objects 3052348eb8SGreg Roach * 3152348eb8SGreg Roach * @return void 32c2a8c8bfSGreg Roach */ 33c1010edaSGreg Roach public function tearDown() 34c1010edaSGreg Roach { 35c2a8c8bfSGreg Roach Mockery::close(); 36c2a8c8bfSGreg Roach } 37c2a8c8bfSGreg Roach 38c2a8c8bfSGreg Roach /** 3915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ 4015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 4152348eb8SGreg Roach * 4252348eb8SGreg Roach * @return void 43c2a8c8bfSGreg Roach */ 44*9b802b22SGreg Roach public function testMale(): void 45c1010edaSGreg Roach { 46ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 47c2a8c8bfSGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 48c2a8c8bfSGreg Roach 49ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 50c2a8c8bfSGreg Roach 51c2a8c8bfSGreg Roach $column = new CensusColumnSexMZ($census, '', ''); 52c2a8c8bfSGreg Roach 53342dcecdSGreg Roach $this->assertSame('M', $column->generate($individual, $individual)); 54c2a8c8bfSGreg Roach } 55c2a8c8bfSGreg Roach 56c2a8c8bfSGreg Roach /** 5715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ 5815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 5952348eb8SGreg Roach * 6052348eb8SGreg Roach * @return void 61c2a8c8bfSGreg Roach */ 62*9b802b22SGreg Roach public function testFeale(): void 63c1010edaSGreg Roach { 64ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 65c2a8c8bfSGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 66c2a8c8bfSGreg Roach 67ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 68c2a8c8bfSGreg Roach 69c2a8c8bfSGreg Roach $column = new CensusColumnSexMZ($census, '', ''); 70c2a8c8bfSGreg Roach 71342dcecdSGreg Roach $this->assertSame('Ž', $column->generate($individual, $individual)); 72c2a8c8bfSGreg Roach } 73c2a8c8bfSGreg Roach 74c2a8c8bfSGreg Roach /** 7515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ 7615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 7752348eb8SGreg Roach * 7852348eb8SGreg Roach * @return void 79c2a8c8bfSGreg Roach */ 80*9b802b22SGreg Roach public function testUnknownSex(): void 81c1010edaSGreg Roach { 82ddf438a5SGreg Roach $individual = Mockery::mock(Individual::class); 83c2a8c8bfSGreg Roach $individual->shouldReceive('getSex')->andReturn('U'); 84c2a8c8bfSGreg Roach 85ddf438a5SGreg Roach $census = Mockery::mock(CensusInterface::class); 86c2a8c8bfSGreg Roach 87c2a8c8bfSGreg Roach $column = new CensusColumnSexMZ($census, '', ''); 88c2a8c8bfSGreg Roach 89342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 90c2a8c8bfSGreg Roach } 91c2a8c8bfSGreg Roach} 92