xref: /webtrees/tests/app/SurnameTradition/DefaultSurnameTraditionTest.php (revision 3cfcc809af53e831fa6cafac7b274a2cb407db6e)
1323788f4SGreg Roach<?php
23976b470SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9323788f4SGreg Roach * (at your option) any later version.
10323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13323788f4SGreg Roach * GNU General Public License for more details.
14323788f4SGreg Roach * You should have received a copy of the GNU General Public License
15323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16323788f4SGreg Roach */
17e7f56f2aSGreg Roachdeclare(strict_types=1);
18e7f56f2aSGreg Roach
1984e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
20c1010edaSGreg Roach
21*3cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
22*3cfcc809SGreg Roach
23323788f4SGreg Roach/**
2417d74f3aSGreg Roach * Test harness for the class DefaultSurnameTradition
25323788f4SGreg Roach */
26*3cfcc809SGreg Roachclass DefaultSurnameTraditionTest extends TestCase
27c1010edaSGreg Roach{
28323788f4SGreg Roach    /** @var SurnameTraditionInterface */
29323788f4SGreg Roach    private $surname_tradition;
30323788f4SGreg Roach
31323788f4SGreg Roach    /**
32323788f4SGreg Roach     * Prepare the environment for these tests
3352348eb8SGreg Roach     *
3452348eb8SGreg Roach     * @return void
35323788f4SGreg Roach     */
365c48bcd6SGreg Roach    protected function setUp(): void
37c1010edaSGreg Roach    {
380115bc16SGreg Roach        parent::setUp();
390115bc16SGreg Roach
4074d6dc0eSGreg Roach        $this->surname_tradition = new DefaultSurnameTradition();
41323788f4SGreg Roach    }
42323788f4SGreg Roach
43323788f4SGreg Roach    /**
44323788f4SGreg Roach     * Test whether married surnames are used
4517d74f3aSGreg Roach     *
4615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
4752348eb8SGreg Roach     *
4852348eb8SGreg Roach     * @return void
49323788f4SGreg Roach     */
509b802b22SGreg Roach    public function testMarriedSurnames(): void
51c1010edaSGreg Roach    {
52a32e6421SGreg Roach        $this->assertFalse($this->surname_tradition->hasMarriedNames());
53323788f4SGreg Roach    }
54323788f4SGreg Roach
55323788f4SGreg Roach    /**
56c1ec7145SGreg Roach     * Test whether surnames are used
5717d74f3aSGreg Roach     *
5815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
5952348eb8SGreg Roach     *
6052348eb8SGreg Roach     * @return void
61c1ec7145SGreg Roach     */
629b802b22SGreg Roach    public function testSurnames(): void
63c1010edaSGreg Roach    {
64a32e6421SGreg Roach        $this->assertTrue($this->surname_tradition->hasSurnames());
65c1ec7145SGreg Roach    }
66c1ec7145SGreg Roach
67c1ec7145SGreg Roach    /**
68323788f4SGreg Roach     * Test new son names
6917d74f3aSGreg Roach     *
7015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
7152348eb8SGreg Roach     *
7252348eb8SGreg Roach     * @return void
73323788f4SGreg Roach     */
749b802b22SGreg Roach    public function testNewSonNames(): void
75c1010edaSGreg Roach    {
76323788f4SGreg Roach        $this->assertSame(
7713abd6f3SGreg Roach            ['NAME' => '//'],
78323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
79323788f4SGreg Roach        );
80323788f4SGreg Roach    }
81323788f4SGreg Roach
82323788f4SGreg Roach    /**
83323788f4SGreg Roach     * Test new daughter names
8417d74f3aSGreg Roach     *
8515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
8652348eb8SGreg Roach     *
8752348eb8SGreg Roach     * @return void
88323788f4SGreg Roach     */
899b802b22SGreg Roach    public function testNewDaughterNames(): void
90c1010edaSGreg Roach    {
91323788f4SGreg Roach        $this->assertSame(
9213abd6f3SGreg Roach            ['NAME' => '//'],
93323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
94323788f4SGreg Roach        );
95323788f4SGreg Roach    }
96323788f4SGreg Roach
97323788f4SGreg Roach    /**
98323788f4SGreg Roach     * Test new child names
9917d74f3aSGreg Roach     *
10015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
10152348eb8SGreg Roach     *
10252348eb8SGreg Roach     * @return void
103323788f4SGreg Roach     */
1049b802b22SGreg Roach    public function testNewChildNames(): void
105c1010edaSGreg Roach    {
106323788f4SGreg Roach        $this->assertSame(
10713abd6f3SGreg Roach            ['NAME' => '//'],
108323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
109323788f4SGreg Roach        );
110323788f4SGreg Roach    }
111323788f4SGreg Roach
112323788f4SGreg Roach    /**
113323788f4SGreg Roach     * Test new father names
11417d74f3aSGreg Roach     *
11515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
11652348eb8SGreg Roach     *
11752348eb8SGreg Roach     * @return void
118323788f4SGreg Roach     */
1199b802b22SGreg Roach    public function testNewFatherNames(): void
120c1010edaSGreg Roach    {
121323788f4SGreg Roach        $this->assertSame(
12213abd6f3SGreg Roach            ['NAME' => '//'],
123323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
124323788f4SGreg Roach        );
125323788f4SGreg Roach    }
126323788f4SGreg Roach
127323788f4SGreg Roach    /**
128323788f4SGreg Roach     * Test new mother names
12917d74f3aSGreg Roach     *
13015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
13152348eb8SGreg Roach     *
13252348eb8SGreg Roach     * @return void
133323788f4SGreg Roach     */
1349b802b22SGreg Roach    public function testNewMotherNames(): void
135c1010edaSGreg Roach    {
136323788f4SGreg Roach        $this->assertSame(
13713abd6f3SGreg Roach            ['NAME' => '//'],
138323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
139323788f4SGreg Roach        );
140323788f4SGreg Roach    }
141323788f4SGreg Roach
142323788f4SGreg Roach    /**
143323788f4SGreg Roach     * Test new parent names
14417d74f3aSGreg Roach     *
14515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
14652348eb8SGreg Roach     *
14752348eb8SGreg Roach     * @return void
148323788f4SGreg Roach     */
1499b802b22SGreg Roach    public function testNewParentNames(): void
150c1010edaSGreg Roach    {
151323788f4SGreg Roach        $this->assertSame(
15213abd6f3SGreg Roach            ['NAME' => '//'],
153323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
154323788f4SGreg Roach        );
155323788f4SGreg Roach    }
156323788f4SGreg Roach
157323788f4SGreg Roach    /**
158323788f4SGreg Roach     * Test new husband names
15917d74f3aSGreg Roach     *
16015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
16152348eb8SGreg Roach     *
16252348eb8SGreg Roach     * @return void
163323788f4SGreg Roach     */
1649b802b22SGreg Roach    public function testNewHusbandNames(): void
165c1010edaSGreg Roach    {
166323788f4SGreg Roach        $this->assertSame(
16713abd6f3SGreg Roach            ['NAME' => '//'],
168323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
169323788f4SGreg Roach        );
170323788f4SGreg Roach    }
171323788f4SGreg Roach
172323788f4SGreg Roach    /**
173323788f4SGreg Roach     * Test new wife names
17417d74f3aSGreg Roach     *
17515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
17652348eb8SGreg Roach     *
17752348eb8SGreg Roach     * @return void
178323788f4SGreg Roach     */
1799b802b22SGreg Roach    public function testNewWifeNames(): void
180c1010edaSGreg Roach    {
181323788f4SGreg Roach        $this->assertSame(
18213abd6f3SGreg Roach            ['NAME' => '//'],
183323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
184323788f4SGreg Roach        );
185323788f4SGreg Roach    }
186323788f4SGreg Roach
187323788f4SGreg Roach    /**
188323788f4SGreg Roach     * Test new spouse names
18917d74f3aSGreg Roach     *
19015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
19152348eb8SGreg Roach     *
19252348eb8SGreg Roach     * @return void
193323788f4SGreg Roach     */
1949b802b22SGreg Roach    public function testNewSpouseNames(): void
195c1010edaSGreg Roach    {
196323788f4SGreg Roach        $this->assertSame(
19713abd6f3SGreg Roach            ['NAME' => '//'],
198323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
199323788f4SGreg Roach        );
200323788f4SGreg Roach    }
201323788f4SGreg Roach}
202