xref: /webtrees/tests/app/SurnameTradition/DefaultSurnameTraditionTest.php (revision 4874f72da8279544d9c0a459e2920a9986acfaa0)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2019 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17declare(strict_types=1);
18
19namespace Fisharebest\Webtrees\SurnameTradition;
20
21use Fisharebest\Webtrees\TestCase;
22
23/**
24 * Test harness for the class DefaultSurnameTradition
25 */
26class DefaultSurnameTraditionTest extends TestCase
27{
28    /** @var SurnameTraditionInterface */
29    private $surname_tradition;
30
31    /**
32     * Prepare the environment for these tests
33     *
34     * @return void
35     */
36    protected function setUp(): void
37    {
38        parent::setUp();
39
40        $this->surname_tradition = new DefaultSurnameTradition();
41    }
42
43    /**
44     * Test whether married surnames are used
45     *
46     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
47     *
48     * @return void
49     */
50    public function testMarriedSurnames(): void
51    {
52        $this->assertFalse($this->surname_tradition->hasMarriedNames());
53    }
54
55    /**
56     * Test whether surnames are used
57     *
58     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
59     *
60     * @return void
61     */
62    public function testSurnames(): void
63    {
64        $this->assertTrue($this->surname_tradition->hasSurnames());
65    }
66
67    /**
68     * Test new son names
69     *
70     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
71     *
72     * @return void
73     */
74    public function testNewSonNames(): void
75    {
76        $this->assertSame(
77            ['NAME' => '//'],
78            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
79        );
80    }
81
82    /**
83     * Test new daughter names
84     *
85     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
86     *
87     * @return void
88     */
89    public function testNewDaughterNames(): void
90    {
91        $this->assertSame(
92            ['NAME' => '//'],
93            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
94        );
95    }
96
97    /**
98     * Test new child names
99     *
100     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
101     *
102     * @return void
103     */
104    public function testNewChildNames(): void
105    {
106        $this->assertSame(
107            ['NAME' => '//'],
108            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
109        );
110    }
111
112    /**
113     * Test new father names
114     *
115     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
116     *
117     * @return void
118     */
119    public function testNewFatherNames(): void
120    {
121        $this->assertSame(
122            ['NAME' => '//'],
123            $this->surname_tradition->newParentNames('John /White/', 'M')
124        );
125    }
126
127    /**
128     * Test new mother names
129     *
130     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
131     *
132     * @return void
133     */
134    public function testNewMotherNames(): void
135    {
136        $this->assertSame(
137            ['NAME' => '//'],
138            $this->surname_tradition->newParentNames('John /White/', 'F')
139        );
140    }
141
142    /**
143     * Test new parent names
144     *
145     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
146     *
147     * @return void
148     */
149    public function testNewParentNames(): void
150    {
151        $this->assertSame(
152            ['NAME' => '//'],
153            $this->surname_tradition->newParentNames('John /White/', 'U')
154        );
155    }
156
157    /**
158     * Test new husband names
159     *
160     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
161     *
162     * @return void
163     */
164    public function testNewHusbandNames(): void
165    {
166        $this->assertSame(
167            ['NAME' => '//'],
168            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
169        );
170    }
171
172    /**
173     * Test new wife names
174     *
175     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
176     *
177     * @return void
178     */
179    public function testNewWifeNames(): void
180    {
181        $this->assertSame(
182            ['NAME' => '//'],
183            $this->surname_tradition->newSpouseNames('John /White/', 'F')
184        );
185    }
186
187    /**
188     * Test new spouse names
189     *
190     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
191     *
192     * @return void
193     */
194    public function testNewSpouseNames(): void
195    {
196        $this->assertSame(
197            ['NAME' => '//'],
198            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
199        );
200    }
201}
202