xref: /webtrees/tests/app/SurnameTradition/DefaultSurnameTraditionTest.php (revision 24f2a3af38709f9bf0a739b30264240d20ba34e8)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\SurnameTradition;
21
22use Fisharebest\Webtrees\TestCase;
23
24/**
25 * Test harness for the class DefaultSurnameTradition
26 */
27class DefaultSurnameTraditionTest extends TestCase
28{
29    /** @var SurnameTraditionInterface */
30    private $surname_tradition;
31
32    /**
33     * Prepare the environment for these tests
34     *
35     * @return void
36     */
37    protected function setUp(): void
38    {
39        parent::setUp();
40
41        $this->surname_tradition = new DefaultSurnameTradition();
42    }
43
44    /**
45     * Test whether married surnames are used
46     *
47     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
48     *
49     * @return void
50     */
51    public function testMarriedSurnames(): void
52    {
53        self::assertFalse($this->surname_tradition->hasMarriedNames());
54    }
55
56    /**
57     * Test whether surnames are used
58     *
59     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
60     *
61     * @return void
62     */
63    public function testSurnames(): void
64    {
65        self::assertTrue($this->surname_tradition->hasSurnames());
66    }
67
68    /**
69     * Test new son names
70     *
71     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
72     *
73     * @return void
74     */
75    public function testNewSonNames(): void
76    {
77        self::assertSame(
78            ['NAME' => '//'],
79            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
80        );
81    }
82
83    /**
84     * Test new daughter names
85     *
86     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
87     *
88     * @return void
89     */
90    public function testNewDaughterNames(): void
91    {
92        self::assertSame(
93            ['NAME' => '//'],
94            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
95        );
96    }
97
98    /**
99     * Test new child names
100     *
101     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
102     *
103     * @return void
104     */
105    public function testNewChildNames(): void
106    {
107        self::assertSame(
108            ['NAME' => '//'],
109            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
110        );
111    }
112
113    /**
114     * Test new father names
115     *
116     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
117     *
118     * @return void
119     */
120    public function testNewFatherNames(): void
121    {
122        self::assertSame(
123            ['NAME' => '//'],
124            $this->surname_tradition->newParentNames('John /White/', 'M')
125        );
126    }
127
128    /**
129     * Test new mother names
130     *
131     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
132     *
133     * @return void
134     */
135    public function testNewMotherNames(): void
136    {
137        self::assertSame(
138            ['NAME' => '//'],
139            $this->surname_tradition->newParentNames('John /White/', 'F')
140        );
141    }
142
143    /**
144     * Test new parent names
145     *
146     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
147     *
148     * @return void
149     */
150    public function testNewParentNames(): void
151    {
152        self::assertSame(
153            ['NAME' => '//'],
154            $this->surname_tradition->newParentNames('John /White/', 'U')
155        );
156    }
157
158    /**
159     * Test new husband names
160     *
161     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
162     *
163     * @return void
164     */
165    public function testNewHusbandNames(): void
166    {
167        self::assertSame(
168            ['NAME' => '//'],
169            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
170        );
171    }
172
173    /**
174     * Test new wife names
175     *
176     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
177     *
178     * @return void
179     */
180    public function testNewWifeNames(): void
181    {
182        self::assertSame(
183            ['NAME' => '//'],
184            $this->surname_tradition->newSpouseNames('John /White/', 'F')
185        );
186    }
187
188    /**
189     * Test new spouse names
190     *
191     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
192     *
193     * @return void
194     */
195    public function testNewSpouseNames(): void
196    {
197        self::assertSame(
198            ['NAME' => '//'],
199            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
200        );
201    }
202}
203