xref: /webtrees/tests/app/Census/CensusColumnSexMZTest.php (revision 342dcecd8628deacd49d86f3247fd77e64bf33c3)
1c2a8c8bfSGreg Roach<?php
2c2a8c8bfSGreg Roach
3c2a8c8bfSGreg Roach/**
4c2a8c8bfSGreg Roach * webtrees: online genealogy
51062a142SGreg Roach * Copyright (C) 2018 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 */
24c1010edaSGreg Roachclass CensusColumnSexMZTest extends \PHPUnit\Framework\TestCase
25c1010edaSGreg Roach{
26c2a8c8bfSGreg Roach    /**
27c2a8c8bfSGreg Roach     * Delete mock objects
28c2a8c8bfSGreg Roach     */
29c1010edaSGreg Roach    public function tearDown()
30c1010edaSGreg Roach    {
31c2a8c8bfSGreg Roach        Mockery::close();
32c2a8c8bfSGreg Roach    }
33c2a8c8bfSGreg Roach
34c2a8c8bfSGreg Roach    /**
3515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ
3615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
37c2a8c8bfSGreg Roach     */
38c1010edaSGreg Roach    public function testMale()
39c1010edaSGreg Roach    {
40c2a8c8bfSGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
41c2a8c8bfSGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
42c2a8c8bfSGreg Roach
43c2a8c8bfSGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
44c2a8c8bfSGreg Roach
45c2a8c8bfSGreg Roach        $column = new CensusColumnSexMZ($census, '', '');
46c2a8c8bfSGreg Roach
47*342dcecdSGreg Roach        $this->assertSame('M', $column->generate($individual, $individual));
48c2a8c8bfSGreg Roach    }
49c2a8c8bfSGreg Roach
50c2a8c8bfSGreg Roach    /**
5115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ
5215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
53c2a8c8bfSGreg Roach     */
54c1010edaSGreg Roach    public function testFeale()
55c1010edaSGreg Roach    {
56c2a8c8bfSGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
57c2a8c8bfSGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
58c2a8c8bfSGreg Roach
59c2a8c8bfSGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
60c2a8c8bfSGreg Roach
61c2a8c8bfSGreg Roach        $column = new CensusColumnSexMZ($census, '', '');
62c2a8c8bfSGreg Roach
63*342dcecdSGreg Roach        $this->assertSame('Ž', $column->generate($individual, $individual));
64c2a8c8bfSGreg Roach    }
65c2a8c8bfSGreg Roach
66c2a8c8bfSGreg Roach    /**
6715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMZ
6815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
69c2a8c8bfSGreg Roach     */
70c1010edaSGreg Roach    public function testUnknownSex()
71c1010edaSGreg Roach    {
72c2a8c8bfSGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
73c2a8c8bfSGreg Roach        $individual->shouldReceive('getSex')->andReturn('U');
74c2a8c8bfSGreg Roach
75c2a8c8bfSGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
76c2a8c8bfSGreg Roach
77c2a8c8bfSGreg Roach        $column = new CensusColumnSexMZ($census, '', '');
78c2a8c8bfSGreg Roach
79*342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
80c2a8c8bfSGreg Roach    }
81c2a8c8bfSGreg Roach}
82