xref: /webtrees/tests/app/SurnameTradition/PolishSurnameTraditionTest.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\PolishSurnameTradition;
21use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
22
23/**
24 * Test harness for the class SpanishSurnameTradition
25 */
26class PolishSurnameTraditionTest 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 PolishSurnameTradition;
39    }
40
41    /**
42     * Test whether married surnames are used
43     *
44     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
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\PolishSurnameTradition
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\PolishSurnameTradition
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\PolishSurnameTradition
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\PolishSurnameTradition
109     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
110     *
111     * @return void
112     */
113    public function testNewDaughterNamesInflected()
114    {
115        $this->assertSame(
116            [
117                'NAME' => '/Whitecka/',
118                'SURN' => 'Whitecki',
119            ],
120            $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F')
121        );
122        $this->assertSame(
123            [
124                'NAME' => '/Whitedzka/',
125                'SURN' => 'Whitedzki',
126            ],
127            $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F')
128        );
129        $this->assertSame(
130            [
131                'NAME' => '/Whiteska/',
132                'SURN' => 'Whiteski',
133            ],
134            $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F')
135        );
136        $this->assertSame(
137            [
138                'NAME' => '/Whiteżka/',
139                'SURN' => 'Whiteżki',
140            ],
141            $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F')
142        );
143    }
144
145    /**
146     * Test new child names
147     *
148     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
149     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
150     *
151     * @return void
152     */
153    public function testNewChildNames()
154    {
155        $this->assertSame(
156            [
157                'NAME' => '/White/',
158                'SURN' => 'White',
159            ],
160            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
161        );
162    }
163
164    /**
165     * Test new child names
166     *
167     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
168     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
169     *
170     * @return void
171     */
172    public function testNewChildNamesWithNoParentsNames()
173    {
174        $this->assertSame(
175            ['NAME' => '//'],
176            $this->surname_tradition->newChildNames('', '', 'U')
177        );
178    }
179
180    /**
181     * Test new father names
182     *
183     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
184     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
185     *
186     * @return void
187     */
188    public function testNewFatherNames()
189    {
190        $this->assertSame(
191            [
192                'NAME' => '/White/',
193                'SURN' => 'White',
194            ],
195            $this->surname_tradition->newParentNames('John /White/', 'M')
196        );
197    }
198
199    /**
200     * Test new father names
201     *
202     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
203     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
204     *
205     * @return void
206     */
207    public function testNewFatherNamesInflected()
208    {
209        $this->assertSame(
210            [
211                'NAME' => '/Whitecki/',
212                'SURN' => 'Whitecki',
213            ],
214            $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M')
215        );
216        $this->assertSame(
217            [
218                'NAME' => '/Whitedzki/',
219                'SURN' => 'Whitedzki',
220            ],
221            $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M')
222        );
223        $this->assertSame(
224            [
225                'NAME' => '/Whiteski/',
226                'SURN' => 'Whiteski',
227            ],
228            $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M')
229        );
230        $this->assertSame(
231            [
232                'NAME' => '/Whiteżki/',
233                'SURN' => 'Whiteżki',
234            ],
235            $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M')
236        );
237    }
238
239    /**
240     * Test new mother names
241     *
242     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
243     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
244     *
245     * @return void
246     */
247    public function testNewMotherNames()
248    {
249        $this->assertSame(
250            ['NAME' => '//'],
251            $this->surname_tradition->newParentNames('John /White/', 'F')
252        );
253    }
254
255    /**
256     * Test new parent names
257     *
258     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
259     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
260     *
261     * @return void
262     */
263    public function testNewParentNames()
264    {
265        $this->assertSame(
266            ['NAME' => '//'],
267            $this->surname_tradition->newParentNames('John /White/', 'U')
268        );
269    }
270
271    /**
272     * Test new husband names
273     *
274     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
275     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
276     *
277     * @return void
278     */
279    public function testNewHusbandNames()
280    {
281        $this->assertSame(
282            ['NAME' => '//'],
283            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
284        );
285    }
286
287    /**
288     * Test new wife names
289     *
290     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
291     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
292     *
293     * @return void
294     */
295    public function testNewWifeNames()
296    {
297        $this->assertSame(
298            [
299                'NAME'   => '//',
300                '_MARNM' => '/White/',
301            ],
302            $this->surname_tradition->newSpouseNames('John /White/', 'F')
303        );
304    }
305
306    /**
307     * Test new spouse names
308     *
309     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
310     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
311     *
312     * @return void
313     */
314    public function testNewSpouseNames()
315    {
316        $this->assertSame(
317            ['NAME' => '//'],
318            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
319        );
320    }
321}
322