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