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