xref: /webtrees/tests/app/Census/CensusColumnSexMFTest.php (revision e7f56f2af615447ab1a7646851f88b465ace9e04)
1a53db70dSGreg Roach<?php
2a53db70dSGreg Roach/**
3a53db70dSGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
5a53db70dSGreg Roach * This program is free software: you can redistribute it and/or modify
6a53db70dSGreg Roach * it under the terms of the GNU General Public License as published by
7a53db70dSGreg Roach * the Free Software Foundation, either version 3 of the License, or
8a53db70dSGreg Roach * (at your option) any later version.
9a53db70dSGreg Roach * This program is distributed in the hope that it will be useful,
10a53db70dSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11a53db70dSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12a53db70dSGreg Roach * GNU General Public License for more details.
13a53db70dSGreg Roach * You should have received a copy of the GNU General Public License
14a53db70dSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15a53db70dSGreg Roach */
16*e7f56f2aSGreg Roachdeclare(strict_types=1);
17*e7f56f2aSGreg Roach
18a53db70dSGreg Roachnamespace Fisharebest\Webtrees\Census;
19a53db70dSGreg Roach
20a53db70dSGreg Roachuse Mockery;
21a53db70dSGreg Roach
22a53db70dSGreg Roach/**
23a53db70dSGreg Roach * Test harness for the class CensusColumnSexMF
24a53db70dSGreg Roach */
2584e2cf4eSGreg Roachclass CensusColumnSexMFTest extends \Fisharebest\Webtrees\TestCase
26c1010edaSGreg Roach{
27a53db70dSGreg Roach    /**
28a53db70dSGreg Roach     * Delete mock objects
2952348eb8SGreg Roach     *
3052348eb8SGreg Roach     * @return void
31a53db70dSGreg Roach     */
32c1010edaSGreg Roach    public function tearDown()
33c1010edaSGreg Roach    {
34a53db70dSGreg Roach        Mockery::close();
35a53db70dSGreg Roach    }
36a53db70dSGreg Roach
37a53db70dSGreg Roach    /**
3815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF
3915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4052348eb8SGreg Roach     *
4152348eb8SGreg Roach     * @return void
42a53db70dSGreg Roach     */
43c1010edaSGreg Roach    public function testMale()
44c1010edaSGreg Roach    {
45c314ecc9SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
46a53db70dSGreg Roach        $individual->shouldReceive('getSex')->andReturn('M');
47a53db70dSGreg Roach
48c314ecc9SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
49a53db70dSGreg Roach
50a53db70dSGreg Roach        $column = new CensusColumnSexMF($census, '', '');
51a53db70dSGreg Roach
52342dcecdSGreg Roach        $this->assertSame('M', $column->generate($individual, $individual));
53a53db70dSGreg Roach    }
54a53db70dSGreg Roach
55a53db70dSGreg Roach    /**
5615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF
5715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
5852348eb8SGreg Roach     *
5952348eb8SGreg Roach     * @return void
60a53db70dSGreg Roach     */
61c1010edaSGreg Roach    public function testFeale()
62c1010edaSGreg Roach    {
63c314ecc9SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
64a53db70dSGreg Roach        $individual->shouldReceive('getSex')->andReturn('F');
65a53db70dSGreg Roach
66c314ecc9SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
67a53db70dSGreg Roach
68a53db70dSGreg Roach        $column = new CensusColumnSexMF($census, '', '');
69a53db70dSGreg Roach
70342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
71a53db70dSGreg Roach    }
72a53db70dSGreg Roach
73a53db70dSGreg Roach    /**
7415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSexMF
7515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
7652348eb8SGreg Roach     *
7752348eb8SGreg Roach     * @return void
78a53db70dSGreg Roach     */
79c1010edaSGreg Roach    public function testUnknownSex()
80c1010edaSGreg Roach    {
81c314ecc9SGreg Roach        $individual = Mockery::mock('Fisharebest\Webtrees\Individual');
82a53db70dSGreg Roach        $individual->shouldReceive('getSex')->andReturn('U');
83a53db70dSGreg Roach
84c314ecc9SGreg Roach        $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface');
85a53db70dSGreg Roach
86a53db70dSGreg Roach        $column = new CensusColumnSexMF($census, '', '');
87a53db70dSGreg Roach
88342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
89a53db70dSGreg Roach    }
90a53db70dSGreg Roach}
91