xref: /webtrees/tests/app/Census/CensusColumnSexMFTest.php (revision c314ecc9a18e5e740a1c0fcb7379ef541f969dc5)
1a53db70dSGreg Roach<?php
2a53db70dSGreg Roach
3a53db70dSGreg Roach/**
4a53db70dSGreg Roach * webtrees: online genealogy
5a53db70dSGreg Roach * Copyright (C) 2015 webtrees development team
6a53db70dSGreg Roach * This program is free software: you can redistribute it and/or modify
7a53db70dSGreg Roach * it under the terms of the GNU General Public License as published by
8a53db70dSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9a53db70dSGreg Roach * (at your option) any later version.
10a53db70dSGreg Roach * This program is distributed in the hope that it will be useful,
11a53db70dSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12a53db70dSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13a53db70dSGreg Roach * GNU General Public License for more details.
14a53db70dSGreg Roach * You should have received a copy of the GNU General Public License
15a53db70dSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16a53db70dSGreg Roach */
17a53db70dSGreg Roachnamespace Fisharebest\Webtrees\Census;
18a53db70dSGreg Roach
19a53db70dSGreg Roachuse Fisharebest\Webtrees\Individual;
20a53db70dSGreg Roachuse Mockery;
21a53db70dSGreg Roach
22a53db70dSGreg Roach/**
23a53db70dSGreg Roach * Test harness for the class CensusColumnSexMF
24a53db70dSGreg Roach */
25a53db70dSGreg Roachclass CensusColumnSexMFTest extends \PHPUnit_Framework_TestCase {
26a53db70dSGreg Roach	/**
27a53db70dSGreg Roach	 * Delete mock objects
28a53db70dSGreg Roach	 */
29a53db70dSGreg Roach	public function tearDown() {
30a53db70dSGreg Roach		Mockery::close();
31a53db70dSGreg Roach	}
32a53db70dSGreg Roach
33a53db70dSGreg Roach	/**
34a53db70dSGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnSexMF
35a53db70dSGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
36a53db70dSGreg Roach	 */
37a53db70dSGreg Roach	public function testMale() {
38*c314ecc9SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
39a53db70dSGreg Roach		$individual->shouldReceive('getSex')->andReturn('M');
40a53db70dSGreg Roach
41*c314ecc9SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
42a53db70dSGreg Roach
43a53db70dSGreg Roach		$column = new CensusColumnSexMF($census, '', '');
44a53db70dSGreg Roach
45a53db70dSGreg Roach		$this->assertSame('M', $column->generate($individual));
46a53db70dSGreg Roach	}
47a53db70dSGreg Roach
48a53db70dSGreg Roach	/**
49a53db70dSGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnSexMF
50a53db70dSGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
51a53db70dSGreg Roach	 */
52a53db70dSGreg Roach	public function testFeale() {
53*c314ecc9SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
54a53db70dSGreg Roach		$individual->shouldReceive('getSex')->andReturn('F');
55a53db70dSGreg Roach
56*c314ecc9SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
57a53db70dSGreg Roach
58a53db70dSGreg Roach		$column = new CensusColumnSexMF($census, '', '');
59a53db70dSGreg Roach
60a53db70dSGreg Roach		$this->assertSame('F', $column->generate($individual));
61a53db70dSGreg Roach	}
62a53db70dSGreg Roach
63a53db70dSGreg Roach	/**
64a53db70dSGreg Roach	 * @covers Fisharebest\Webtrees\Census\CensusColumnSexMF
65a53db70dSGreg Roach	 * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn
66a53db70dSGreg Roach	 */
67a53db70dSGreg Roach	public function testUnknownSex() {
68*c314ecc9SGreg Roach		$individual = Mockery::mock('Fisharebest\Webtrees\Individual');
69a53db70dSGreg Roach		$individual->shouldReceive('getSex')->andReturn('U');
70a53db70dSGreg Roach
71*c314ecc9SGreg Roach		$census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
72a53db70dSGreg Roach
73a53db70dSGreg Roach		$column = new CensusColumnSexMF($census, '', '');
74a53db70dSGreg Roach
75a53db70dSGreg Roach		$this->assertSame('', $column->generate($individual));
76a53db70dSGreg Roach	}
77a53db70dSGreg Roach}
78