xref: /webtrees/tests/app/SurnameTradition/DefaultSurnameTraditionTest.php (revision 9b802b22a7b94d1d30e0433dd46fe641f3757505)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach/**
3323788f4SGreg Roach * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
5323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
6323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
7323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8323788f4SGreg Roach * (at your option) any later version.
9323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
10323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12323788f4SGreg Roach * GNU General Public License for more details.
13323788f4SGreg Roach * You should have received a copy of the GNU General Public License
14323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15323788f4SGreg Roach */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
19c1010edaSGreg Roach
20323788f4SGreg Roach/**
2117d74f3aSGreg Roach * Test harness for the class DefaultSurnameTradition
22323788f4SGreg Roach */
2384e2cf4eSGreg Roachclass DefaultSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
24c1010edaSGreg Roach{
25323788f4SGreg Roach    /** @var SurnameTraditionInterface */
26323788f4SGreg Roach    private $surname_tradition;
27323788f4SGreg Roach
28323788f4SGreg Roach    /**
29323788f4SGreg Roach     * Prepare the environment for these tests
3052348eb8SGreg Roach     *
3152348eb8SGreg Roach     * @return void
32323788f4SGreg Roach     */
330115bc16SGreg Roach    protected function setUp()
34c1010edaSGreg Roach    {
350115bc16SGreg Roach        parent::setUp();
360115bc16SGreg Roach
37323788f4SGreg Roach        $this->surname_tradition = new DefaultSurnameTradition;
38323788f4SGreg Roach    }
39323788f4SGreg Roach
40323788f4SGreg Roach    /**
41323788f4SGreg Roach     * Test whether married surnames are used
4217d74f3aSGreg Roach     *
4315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
4452348eb8SGreg Roach     *
4552348eb8SGreg Roach     * @return void
46323788f4SGreg Roach     */
47*9b802b22SGreg Roach    public function testMarriedSurnames(): void
48c1010edaSGreg Roach    {
49323788f4SGreg Roach        $this->assertSame(false, $this->surname_tradition->hasMarriedNames());
50323788f4SGreg Roach    }
51323788f4SGreg Roach
52323788f4SGreg Roach    /**
53c1ec7145SGreg Roach     * Test whether surnames are used
5417d74f3aSGreg Roach     *
5515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
5652348eb8SGreg Roach     *
5752348eb8SGreg Roach     * @return void
58c1ec7145SGreg Roach     */
59*9b802b22SGreg Roach    public function testSurnames(): void
60c1010edaSGreg Roach    {
61c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
62c1ec7145SGreg Roach    }
63c1ec7145SGreg Roach
64c1ec7145SGreg Roach    /**
65323788f4SGreg Roach     * Test new son names
6617d74f3aSGreg Roach     *
6715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
6852348eb8SGreg Roach     *
6952348eb8SGreg Roach     * @return void
70323788f4SGreg Roach     */
71*9b802b22SGreg Roach    public function testNewSonNames(): void
72c1010edaSGreg Roach    {
73323788f4SGreg Roach        $this->assertSame(
7413abd6f3SGreg Roach            ['NAME' => '//'],
75323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
76323788f4SGreg Roach        );
77323788f4SGreg Roach    }
78323788f4SGreg Roach
79323788f4SGreg Roach    /**
80323788f4SGreg Roach     * Test new daughter names
8117d74f3aSGreg Roach     *
8215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
8352348eb8SGreg Roach     *
8452348eb8SGreg Roach     * @return void
85323788f4SGreg Roach     */
86*9b802b22SGreg Roach    public function testNewDaughterNames(): void
87c1010edaSGreg Roach    {
88323788f4SGreg Roach        $this->assertSame(
8913abd6f3SGreg Roach            ['NAME' => '//'],
90323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
91323788f4SGreg Roach        );
92323788f4SGreg Roach    }
93323788f4SGreg Roach
94323788f4SGreg Roach    /**
95323788f4SGreg Roach     * Test new child names
9617d74f3aSGreg Roach     *
9715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
9852348eb8SGreg Roach     *
9952348eb8SGreg Roach     * @return void
100323788f4SGreg Roach     */
101*9b802b22SGreg Roach    public function testNewChildNames(): void
102c1010edaSGreg Roach    {
103323788f4SGreg Roach        $this->assertSame(
10413abd6f3SGreg Roach            ['NAME' => '//'],
105323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
106323788f4SGreg Roach        );
107323788f4SGreg Roach    }
108323788f4SGreg Roach
109323788f4SGreg Roach    /**
110323788f4SGreg Roach     * Test new father names
11117d74f3aSGreg Roach     *
11215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
11352348eb8SGreg Roach     *
11452348eb8SGreg Roach     * @return void
115323788f4SGreg Roach     */
116*9b802b22SGreg Roach    public function testNewFatherNames(): void
117c1010edaSGreg Roach    {
118323788f4SGreg Roach        $this->assertSame(
11913abd6f3SGreg Roach            ['NAME' => '//'],
120323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
121323788f4SGreg Roach        );
122323788f4SGreg Roach    }
123323788f4SGreg Roach
124323788f4SGreg Roach    /**
125323788f4SGreg Roach     * Test new mother names
12617d74f3aSGreg Roach     *
12715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
12852348eb8SGreg Roach     *
12952348eb8SGreg Roach     * @return void
130323788f4SGreg Roach     */
131*9b802b22SGreg Roach    public function testNewMotherNames(): void
132c1010edaSGreg Roach    {
133323788f4SGreg Roach        $this->assertSame(
13413abd6f3SGreg Roach            ['NAME' => '//'],
135323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
136323788f4SGreg Roach        );
137323788f4SGreg Roach    }
138323788f4SGreg Roach
139323788f4SGreg Roach    /**
140323788f4SGreg Roach     * Test new parent names
14117d74f3aSGreg Roach     *
14215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
14352348eb8SGreg Roach     *
14452348eb8SGreg Roach     * @return void
145323788f4SGreg Roach     */
146*9b802b22SGreg Roach    public function testNewParentNames(): void
147c1010edaSGreg Roach    {
148323788f4SGreg Roach        $this->assertSame(
14913abd6f3SGreg Roach            ['NAME' => '//'],
150323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
151323788f4SGreg Roach        );
152323788f4SGreg Roach    }
153323788f4SGreg Roach
154323788f4SGreg Roach    /**
155323788f4SGreg Roach     * Test new husband names
15617d74f3aSGreg Roach     *
15715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
15852348eb8SGreg Roach     *
15952348eb8SGreg Roach     * @return void
160323788f4SGreg Roach     */
161*9b802b22SGreg Roach    public function testNewHusbandNames(): void
162c1010edaSGreg Roach    {
163323788f4SGreg Roach        $this->assertSame(
16413abd6f3SGreg Roach            ['NAME' => '//'],
165323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
166323788f4SGreg Roach        );
167323788f4SGreg Roach    }
168323788f4SGreg Roach
169323788f4SGreg Roach    /**
170323788f4SGreg Roach     * Test new wife names
17117d74f3aSGreg Roach     *
17215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
17352348eb8SGreg Roach     *
17452348eb8SGreg Roach     * @return void
175323788f4SGreg Roach     */
176*9b802b22SGreg Roach    public function testNewWifeNames(): void
177c1010edaSGreg Roach    {
178323788f4SGreg Roach        $this->assertSame(
17913abd6f3SGreg Roach            ['NAME' => '//'],
180323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
181323788f4SGreg Roach        );
182323788f4SGreg Roach    }
183323788f4SGreg Roach
184323788f4SGreg Roach    /**
185323788f4SGreg Roach     * Test new spouse names
18617d74f3aSGreg Roach     *
18715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
18852348eb8SGreg Roach     *
18952348eb8SGreg Roach     * @return void
190323788f4SGreg Roach     */
191*9b802b22SGreg Roach    public function testNewSpouseNames(): void
192c1010edaSGreg Roach    {
193323788f4SGreg Roach        $this->assertSame(
19413abd6f3SGreg Roach            ['NAME' => '//'],
195323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
196323788f4SGreg Roach        );
197323788f4SGreg Roach    }
198323788f4SGreg Roach}
199