xref: /webtrees/tests/app/Census/CensusColumnSurnameTest.php (revision 0ecdbde6aab590acff4665ec491a8427f5b7c90e)
1a53db70dSGreg Roach<?php
2a53db70dSGreg Roach/**
3a53db70dSGreg Roach * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 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 */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
18a53db70dSGreg Roachnamespace Fisharebest\Webtrees\Census;
19a53db70dSGreg Roach
20ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
21a53db70dSGreg Roach
22a53db70dSGreg Roach/**
23a53db70dSGreg Roach * Test harness for the class CensusColumnSurname
24a53db70dSGreg Roach */
2584e2cf4eSGreg Roachclass CensusColumnSurnameTest extends \Fisharebest\Webtrees\TestCase
26c1010edaSGreg Roach{
27a53db70dSGreg Roach    /**
2815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSurname
2915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
3052348eb8SGreg Roach     *
3152348eb8SGreg Roach     * @return void
32a53db70dSGreg Roach     */
339b802b22SGreg Roach    public function testSurname(): void
34c1010edaSGreg Roach    {
35*0ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
36*0ecdbde6SGreg Roach        $individual->method('getAllNames')->willReturn([['surname' => 'Bloggs']]);
37a53db70dSGreg Roach
38*0ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
39a53db70dSGreg Roach
40a53db70dSGreg Roach        $column = new CensusColumnSurname($census, '', '');
41a53db70dSGreg Roach
42342dcecdSGreg Roach        $this->assertSame('Bloggs', $column->generate($individual, $individual));
43a53db70dSGreg Roach    }
44a53db70dSGreg Roach
45a53db70dSGreg Roach    /**
4615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnSurname
4715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
4852348eb8SGreg Roach     *
4952348eb8SGreg Roach     * @return void
50a53db70dSGreg Roach     */
519b802b22SGreg Roach    public function testNoName(): void
52c1010edaSGreg Roach    {
53*0ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
54*0ecdbde6SGreg Roach        $individual->method('getAllNames')->willReturn([]);
55a53db70dSGreg Roach
56*0ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
57a53db70dSGreg Roach
58a53db70dSGreg Roach        $column = new CensusColumnSurname($census, '', '');
59a53db70dSGreg Roach
60342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
61a53db70dSGreg Roach    }
62a53db70dSGreg Roach}
63