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