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