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