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 */ 2384e2cf4eSGreg Roachclass CensusColumnSexMFTest extends \Fisharebest\Webtrees\TestCase 24c1010edaSGreg Roach{ 25a53db70dSGreg Roach /** 26a53db70dSGreg Roach * Delete mock objects 27*52348eb8SGreg Roach * 28*52348eb8SGreg Roach * @return void 29a53db70dSGreg Roach */ 30c1010edaSGreg Roach public function tearDown() 31c1010edaSGreg Roach { 32a53db70dSGreg Roach Mockery::close(); 33a53db70dSGreg Roach } 34a53db70dSGreg Roach 35a53db70dSGreg Roach /** 3615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF 3715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 38*52348eb8SGreg Roach * 39*52348eb8SGreg Roach * @return void 40a53db70dSGreg Roach */ 41c1010edaSGreg Roach public function testMale() 42c1010edaSGreg Roach { 43c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 44a53db70dSGreg Roach $individual->shouldReceive('getSex')->andReturn('M'); 45a53db70dSGreg Roach 46c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 47a53db70dSGreg Roach 48a53db70dSGreg Roach $column = new CensusColumnSexMF($census, '', ''); 49a53db70dSGreg Roach 50342dcecdSGreg Roach $this->assertSame('M', $column->generate($individual, $individual)); 51a53db70dSGreg Roach } 52a53db70dSGreg Roach 53a53db70dSGreg Roach /** 5415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF 5515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 56*52348eb8SGreg Roach * 57*52348eb8SGreg Roach * @return void 58a53db70dSGreg Roach */ 59c1010edaSGreg Roach public function testFeale() 60c1010edaSGreg Roach { 61c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 62a53db70dSGreg Roach $individual->shouldReceive('getSex')->andReturn('F'); 63a53db70dSGreg Roach 64c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 65a53db70dSGreg Roach 66a53db70dSGreg Roach $column = new CensusColumnSexMF($census, '', ''); 67a53db70dSGreg Roach 68342dcecdSGreg Roach $this->assertSame('F', $column->generate($individual, $individual)); 69a53db70dSGreg Roach } 70a53db70dSGreg Roach 71a53db70dSGreg Roach /** 7215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF 7315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 74*52348eb8SGreg Roach * 75*52348eb8SGreg Roach * @return void 76a53db70dSGreg Roach */ 77c1010edaSGreg Roach public function testUnknownSex() 78c1010edaSGreg Roach { 79c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 80a53db70dSGreg Roach $individual->shouldReceive('getSex')->andReturn('U'); 81a53db70dSGreg Roach 82c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 83a53db70dSGreg Roach 84a53db70dSGreg Roach $column = new CensusColumnSexMF($census, '', ''); 85a53db70dSGreg Roach 86342dcecdSGreg Roach $this->assertSame('', $column->generate($individual, $individual)); 87a53db70dSGreg Roach } 88a53db70dSGreg Roach} 89