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