1a53db70dSGreg Roach<?php 2a53db70dSGreg Roach/** 3a53db70dSGreg Roach * webtrees: online genealogy 41062a142SGreg Roach * Copyright (C) 2018 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 */ 16a53db70dSGreg Roachnamespace Fisharebest\Webtrees\Census; 17a53db70dSGreg Roach 18a53db70dSGreg Roachuse Mockery; 19a53db70dSGreg Roach 20a53db70dSGreg Roach/** 21a53db70dSGreg Roach * Test harness for the class CensusColumnSexMF 22a53db70dSGreg Roach */ 23*84e2cf4eSGreg Roachclass CensusColumnSexMFTest extends \Fisharebest\Webtrees\TestCase 24c1010edaSGreg Roach{ 25a53db70dSGreg Roach /** 26a53db70dSGreg Roach * Delete mock objects 27a53db70dSGreg Roach */ 28c1010edaSGreg Roach public function tearDown() 29c1010edaSGreg Roach { 30a53db70dSGreg Roach Mockery::close(); 31a53db70dSGreg Roach } 32a53db70dSGreg Roach 33a53db70dSGreg Roach /** 3415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF 3515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 36a53db70dSGreg Roach */ 37c1010edaSGreg Roach public function testMale() 38c1010edaSGreg Roach { 39c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 40a53db70dSGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 41a53db70dSGreg Roach 42c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 43a53db70dSGreg Roach 44a53db70dSGreg Roach $column = new CensusColumnSexMF($census, '', ''); 45a53db70dSGreg Roach 46342dcecdSGreg Roach $this->assertSame('M', $column->generate($individual, $individual)); 47a53db70dSGreg Roach } 48a53db70dSGreg Roach 49a53db70dSGreg Roach /** 5015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF 5115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 52a53db70dSGreg Roach */ 53c1010edaSGreg Roach public function testFeale() 54c1010edaSGreg Roach { 55c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 56a53db70dSGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 57a53db70dSGreg Roach 58c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 59a53db70dSGreg Roach 60a53db70dSGreg Roach $column = new CensusColumnSexMF($census, '', ''); 61a53db70dSGreg Roach 62342dcecdSGreg Roach $this->assertSame('F', $column->generate($individual, $individual)); 63a53db70dSGreg Roach } 64a53db70dSGreg Roach 65a53db70dSGreg Roach /** 6615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF 6715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 68a53db70dSGreg Roach */ 69c1010edaSGreg Roach public function testUnknownSex() 70c1010edaSGreg Roach { 71c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 72a53db70dSGreg Roach $individual->shouldReceive('getSex')->andReturn('U'); 73a53db70dSGreg Roach 74c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 75a53db70dSGreg Roach 76a53db70dSGreg Roach $column = new CensusColumnSexMF($census, '', ''); 77a53db70dSGreg Roach 78342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 79a53db70dSGreg Roach } 80a53db70dSGreg Roach} 81