xref: /webtrees/tests/app/Census/CensusColumnSexMZTest.php (revision 3e983931fdde6db78f1490364106d7d46e77dea7)
1c2a8c8bfSGreg Roach<?php
2c2a8c8bfSGreg Roach
3c2a8c8bfSGreg Roach/**
4c2a8c8bfSGreg Roach * webtrees: online genealogy
56bdf7674SGreg Roach * Copyright (C) 2017 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
15c2a8c8bfSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16c2a8c8bfSGreg Roach */
17c2a8c8bfSGreg Roachnamespace Fisharebest\Webtrees\Census;
18c2a8c8bfSGreg Roach
19c2a8c8bfSGreg Roachuse Mockery;
20c2a8c8bfSGreg Roach
21c2a8c8bfSGreg Roach/**
22c2a8c8bfSGreg Roach * Test harness for the class CensusColumnSexMZ
23c2a8c8bfSGreg Roach */
24*3e983931SGreg Roachclass CensusColumnSexMZTest extends \PHPUnit\Framework\TestCase {
25c2a8c8bfSGreg Roach	/**
26c2a8c8bfSGreg Roach	 * Delete mock objects
27c2a8c8bfSGreg Roach	 */
28c2a8c8bfSGreg Roach	public function tearDown() {
29c2a8c8bfSGreg Roach		Mockery::close();
30c2a8c8bfSGreg Roach	}
31c2a8c8bfSGreg Roach
32c2a8c8bfSGreg Roach	/**
3315d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ
3415d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
35c2a8c8bfSGreg Roach	 */
36c2a8c8bfSGreg Roach	public function testMale() {
37c2a8c8bfSGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
38c2a8c8bfSGreg Roach		$individual->shouldReceive('getSex')->andReturn('M');
39c2a8c8bfSGreg Roach
40c2a8c8bfSGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
41c2a8c8bfSGreg Roach
42c2a8c8bfSGreg Roach		$column = new CensusColumnSexMZ($census, '', '');
43c2a8c8bfSGreg Roach
44c2a8c8bfSGreg Roach		$this->assertSame('M', $column->generate($individual));
45c2a8c8bfSGreg Roach	}
46c2a8c8bfSGreg Roach
47c2a8c8bfSGreg Roach	/**
4815d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ
4915d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
50c2a8c8bfSGreg Roach	 */
51c2a8c8bfSGreg Roach	public function testFeale() {
52c2a8c8bfSGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
53c2a8c8bfSGreg Roach		$individual->shouldReceive('getSex')->andReturn('F');
54c2a8c8bfSGreg Roach
55c2a8c8bfSGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
56c2a8c8bfSGreg Roach
57c2a8c8bfSGreg Roach		$column = new CensusColumnSexMZ($census, '', '');
58c2a8c8bfSGreg Roach
59c2a8c8bfSGreg Roach		$this->assertSame('Ž', $column->generate($individual));
60c2a8c8bfSGreg Roach	}
61c2a8c8bfSGreg Roach
62c2a8c8bfSGreg Roach	/**
6315d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ
6415d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
65c2a8c8bfSGreg Roach	 */
66c2a8c8bfSGreg Roach	public function testUnknownSex() {
67c2a8c8bfSGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
68c2a8c8bfSGreg Roach		$individual->shouldReceive('getSex')->andReturn('U');
69c2a8c8bfSGreg Roach
70c2a8c8bfSGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
71c2a8c8bfSGreg Roach
72c2a8c8bfSGreg Roach		$column = new CensusColumnSexMZ($census, '', '');
73c2a8c8bfSGreg Roach
74c2a8c8bfSGreg Roach		$this->assertSame('', $column->generate($individual));
75c2a8c8bfSGreg Roach	}
76c2a8c8bfSGreg Roach}
77