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