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