xref: /webtrees/tests/app/SurnameTradition/LithuanianSurnameTraditionTest.php (revision c4943cff72f95a28fbb9404e3c20b169ff098e5c)
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 LithuanianSurnameTraditionTest
26 */
27class LithuanianSurnameTraditionTest extends TestCase
28{
29    private SurnameTraditionInterface $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 LithuanianSurnameTradition();
41    }
42
43    /**
44     * Test whether married surnames are used
45     *
46     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
47     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
48     *
49     * @return void
50     */
51    public function testMarriedSurnames(): void
52    {
53        self::assertTrue($this->surname_tradition->hasMarriedNames());
54    }
55
56    /**
57     * Test whether surnames are used
58     *
59     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
60     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
61     *
62     * @return void
63     */
64    public function testSurnames(): void
65    {
66        self::assertTrue($this->surname_tradition->hasSurnames());
67    }
68
69    /**
70     * Test new son names
71     *
72     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
73     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
74     *
75     * @return void
76     */
77    public function testNewSonNames(): void
78    {
79        self::assertSame(
80            [
81                'NAME' => '/White/',
82                'SURN' => 'White',
83            ],
84            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
85        );
86    }
87
88    /**
89     * Test new daughter names
90     *
91     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
92     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
93     *
94     * @return void
95     */
96    public function testNewDaughterNames(): void
97    {
98        self::assertSame(
99            [
100                'NAME' => '/White/',
101                'SURN' => 'White',
102            ],
103            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
104        );
105    }
106
107    /**
108     * Test new daughter names
109     *
110     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
111     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
112     *
113     * @return void
114     */
115    public function testNewDaughterNamesInflected(): void
116    {
117        self::assertSame(
118            [
119                'NAME' => '/Whitaitė/',
120                'SURN' => 'Whita',
121            ],
122            $this->surname_tradition->newChildNames('John /Whita/', 'Mary /Black/', 'F')
123        );
124        self::assertSame(
125            [
126                'NAME' => '/Whitaitė/',
127                'SURN' => 'Whitas',
128            ],
129            $this->surname_tradition->newChildNames('John /Whitas/', 'Mary /Black/', 'F')
130        );
131        self::assertSame(
132            [
133                'NAME' => '/Whitytė/',
134                'SURN' => 'Whitis',
135            ],
136            $this->surname_tradition->newChildNames('John /Whitis/', 'Mary /Black/', 'F')
137        );
138        self::assertSame(
139            [
140                'NAME' => '/Whitytė/',
141                'SURN' => 'Whitys',
142            ],
143            $this->surname_tradition->newChildNames('John /Whitys/', 'Mary /Black/', 'F')
144        );
145        self::assertSame(
146            [
147                'NAME' => '/Whitiūtė/',
148                'SURN' => 'Whitius',
149            ],
150            $this->surname_tradition->newChildNames('John /Whitius/', 'Mary /Black/', 'F')
151        );
152        self::assertSame(
153            [
154                'NAME' => '/Whitutė/',
155                'SURN' => 'Whitus',
156            ],
157            $this->surname_tradition->newChildNames('John /Whitus/', 'Mary /Black/', 'F')
158        );
159    }
160
161    /**
162     * Test new child names
163     *
164     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
165     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
166     *
167     * @return void
168     */
169    public function testNewChildNames(): void
170    {
171        self::assertSame(
172            [
173                'NAME' => '/White/',
174                'SURN' => 'White',
175            ],
176            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
177        );
178    }
179
180    /**
181     * Test new child names
182     *
183     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
184     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
185     *
186     * @return void
187     */
188    public function testNewChildNamesWithNoParentsNames(): void
189    {
190        self::assertSame(
191            ['NAME' => '//'],
192            $this->surname_tradition->newChildNames('', '', 'U')
193        );
194    }
195
196    /**
197     * Test new father names
198     *
199     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
200     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
201     *
202     * @return void
203     */
204    public function testNewFatherNames(): void
205    {
206        self::assertSame(
207            [
208                'NAME' => '/White/',
209                'SURN' => 'White',
210            ],
211            $this->surname_tradition->newParentNames('John /White/', 'M')
212        );
213    }
214
215    /**
216     * Test new father names
217     *
218     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
219     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
220     *
221     * @return void
222     */
223    public function testNewFatherNamesInflected(): void
224    {
225        self::assertSame(
226            [
227                'NAME' => '/Whitas/',
228                'SURN' => 'Whitas',
229            ],
230            $this->surname_tradition->newParentNames('Mary /Whitaitė/', 'M')
231        );
232        self::assertSame(
233            [
234                'NAME' => '/Whitis/',
235                'SURN' => 'Whitis',
236            ],
237            $this->surname_tradition->newParentNames('Mary /Whitytė/', 'M')
238        );
239        self::assertSame(
240            [
241                'NAME' => '/Whitius/',
242                'SURN' => 'Whitius',
243            ],
244            $this->surname_tradition->newParentNames('Mary /Whitiūtė/', 'M')
245        );
246        self::assertSame(
247            [
248                'NAME' => '/Whitus/',
249                'SURN' => 'Whitus',
250            ],
251            $this->surname_tradition->newParentNames('Mary /Whitutė/', 'M')
252        );
253    }
254
255    /**
256     * Test new mother names
257     *
258     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
259     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
260     *
261     * @return void
262     */
263    public function testNewMotherNames(): void
264    {
265        self::assertSame(
266            ['NAME' => '//'],
267            $this->surname_tradition->newParentNames('John /White/', 'F')
268        );
269    }
270
271    /**
272     * Test new parent names
273     *
274     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
275     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
276     *
277     * @return void
278     */
279    public function testNewParentNames(): void
280    {
281        self::assertSame(
282            ['NAME' => '//'],
283            $this->surname_tradition->newParentNames('John /White/', 'U')
284        );
285    }
286
287    /**
288     * Test new husband names
289     *
290     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
291     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
292     *
293     * @return void
294     */
295    public function testNewHusbandNames(): void
296    {
297        self::assertSame(
298            ['NAME' => '//'],
299            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
300        );
301    }
302
303    /**
304     * Test new wife names
305     *
306     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
307     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
308     *
309     * @return void
310     */
311    public function testNewWifeNames(): void
312    {
313        self::assertSame(
314            [
315                'NAME'   => '//',
316                '_MARNM' => '/White/',
317            ],
318            $this->surname_tradition->newSpouseNames('John /White/', 'F')
319        );
320    }
321
322    /**
323     * Test new spouse names
324     *
325     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
326     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
327     *
328     * @return void
329     */
330    public function testNewSpouseNames(): void
331    {
332        self::assertSame(
333            ['NAME' => '//'],
334            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
335        );
336    }
337}
338