xref: /webtrees/tests/app/SurnameTradition/LithuanianSurnameTraditionTest.php (revision 957683265503f0cb47ea6202ffe11bab606ac962)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2018 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16declare(strict_types=1);
17
18namespace Fisharebest\Webtrees\SurnameTradition;
19
20/**
21 * Test harness for the class SpanishSurnameTradition
22 */
23class LithuanianSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
24{
25    /** @var SurnameTraditionInterface */
26    private $surname_tradition;
27
28    /**
29     * Prepare the environment for these tests
30     *
31     * @return void
32     */
33    public function setUp()
34    {
35        $this->surname_tradition = new LithuanianSurnameTradition;
36    }
37
38    /**
39     * Test whether married surnames are used
40     *
41     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
42     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
43     *
44     * @return void
45     */
46    public function testMarriedSurnames()
47    {
48        $this->assertSame(true, $this->surname_tradition->hasMarriedNames());
49    }
50
51    /**
52     * Test whether surnames are used
53     *
54     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
55     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
56     *
57     * @return void
58     */
59    public function testSurnames()
60    {
61        $this->assertSame(true, $this->surname_tradition->hasSurnames());
62    }
63
64    /**
65     * Test new son names
66     *
67     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
68     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
69     *
70     * @return void
71     */
72    public function testNewSonNames()
73    {
74        $this->assertSame(
75            [
76                'NAME' => '/White/',
77                'SURN' => 'White',
78            ],
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\LithuanianSurnameTradition
87     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
88     *
89     * @return void
90     */
91    public function testNewDaughterNames()
92    {
93        $this->assertSame(
94            [
95                'NAME' => '/White/',
96                'SURN' => 'White',
97            ],
98            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
99        );
100    }
101
102    /**
103     * Test new daughter names
104     *
105     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
106     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
107     *
108     * @return void
109     */
110    public function testNewDaughterNamesInflected()
111    {
112        $this->assertSame(
113            [
114                'NAME' => '/Whitaitė/',
115                'SURN' => 'Whita',
116            ],
117            $this->surname_tradition->newChildNames('John /Whita/', 'Mary /Black/', 'F')
118        );
119        $this->assertSame(
120            [
121                'NAME' => '/Whitaitė/',
122                'SURN' => 'Whitas',
123            ],
124            $this->surname_tradition->newChildNames('John /Whitas/', 'Mary /Black/', 'F')
125        );
126        $this->assertSame(
127            [
128                'NAME' => '/Whitytė/',
129                'SURN' => 'Whitis',
130            ],
131            $this->surname_tradition->newChildNames('John /Whitis/', 'Mary /Black/', 'F')
132        );
133        $this->assertSame(
134            [
135                'NAME' => '/Whitytė/',
136                'SURN' => 'Whitys',
137            ],
138            $this->surname_tradition->newChildNames('John /Whitys/', 'Mary /Black/', 'F')
139        );
140        $this->assertSame(
141            [
142                'NAME' => '/Whitiūtė/',
143                'SURN' => 'Whitius',
144            ],
145            $this->surname_tradition->newChildNames('John /Whitius/', 'Mary /Black/', 'F')
146        );
147        $this->assertSame(
148            [
149                'NAME' => '/Whitutė/',
150                'SURN' => 'Whitus',
151            ],
152            $this->surname_tradition->newChildNames('John /Whitus/', 'Mary /Black/', 'F')
153        );
154    }
155
156    /**
157     * Test new child names
158     *
159     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
160     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
161     *
162     * @return void
163     */
164    public function testNewChildNames()
165    {
166        $this->assertSame(
167            [
168                'NAME' => '/White/',
169                'SURN' => 'White',
170            ],
171            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
172        );
173    }
174
175    /**
176     * Test new child names
177     *
178     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
179     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
180     *
181     * @return void
182     */
183    public function testNewChildNamesWithNoParentsNames()
184    {
185        $this->assertSame(
186            ['NAME' => '//'],
187            $this->surname_tradition->newChildNames('', '', 'U')
188        );
189    }
190
191    /**
192     * Test new father names
193     *
194     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
195     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
196     *
197     * @return void
198     */
199    public function testNewFatherNames()
200    {
201        $this->assertSame(
202            [
203                'NAME' => '/White/',
204                'SURN' => 'White',
205            ],
206            $this->surname_tradition->newParentNames('John /White/', 'M')
207        );
208    }
209
210    /**
211     * Test new father names
212     *
213     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
214     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
215     *
216     * @return void
217     */
218    public function testNewFatherNamesInflected()
219    {
220        $this->assertSame(
221            [
222                'NAME' => '/Whitas/',
223                'SURN' => 'Whitas',
224            ],
225            $this->surname_tradition->newParentNames('Mary /Whitaitė/', 'M')
226        );
227        $this->assertSame(
228            [
229                'NAME' => '/Whitis/',
230                'SURN' => 'Whitis',
231            ],
232            $this->surname_tradition->newParentNames('Mary /Whitytė/', 'M')
233        );
234        $this->assertSame(
235            [
236                'NAME' => '/Whitius/',
237                'SURN' => 'Whitius',
238            ],
239            $this->surname_tradition->newParentNames('Mary /Whitiūtė/', 'M')
240        );
241        $this->assertSame(
242            [
243                'NAME' => '/Whitus/',
244                'SURN' => 'Whitus',
245            ],
246            $this->surname_tradition->newParentNames('Mary /Whitutė/', 'M')
247        );
248    }
249
250    /**
251     * Test new mother names
252     *
253     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
254     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
255     *
256     * @return void
257     */
258    public function testNewMotherNames()
259    {
260        $this->assertSame(
261            ['NAME' => '//'],
262            $this->surname_tradition->newParentNames('John /White/', 'F')
263        );
264    }
265
266    /**
267     * Test new parent names
268     *
269     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
270     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
271     *
272     * @return void
273     */
274    public function testNewParentNames()
275    {
276        $this->assertSame(
277            ['NAME' => '//'],
278            $this->surname_tradition->newParentNames('John /White/', 'U')
279        );
280    }
281
282    /**
283     * Test new husband names
284     *
285     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
286     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
287     *
288     * @return void
289     */
290    public function testNewHusbandNames()
291    {
292        $this->assertSame(
293            ['NAME' => '//'],
294            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
295        );
296    }
297
298    /**
299     * Test new wife names
300     *
301     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
302     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
303     *
304     * @return void
305     */
306    public function testNewWifeNames()
307    {
308        $this->assertSame(
309            [
310                'NAME'   => '//',
311                '_MARNM' => '/White/',
312            ],
313            $this->surname_tradition->newSpouseNames('John /White/', 'F')
314        );
315    }
316
317    /**
318     * Test new spouse names
319     *
320     * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition
321     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
322     *
323     * @return void
324     */
325    public function testNewSpouseNames()
326    {
327        $this->assertSame(
328            ['NAME' => '//'],
329            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
330        );
331    }
332}
333