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