xref: /webtrees/tests/app/SurnameTradition/PolishSurnameTraditionTest.php (revision 52348eb8c11b06a8488e13475e6561273832716a)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach/**
3323788f4SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
5323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
6323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
7323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8323788f4SGreg Roach * (at your option) any later version.
9323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
10323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12323788f4SGreg Roach * GNU General Public License for more details.
13323788f4SGreg Roach * You should have received a copy of the GNU General Public License
14323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15323788f4SGreg Roach */
1684e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
17c1010edaSGreg Roach
18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition;
19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
20323788f4SGreg Roach
21323788f4SGreg Roach/**
22323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition
23323788f4SGreg Roach */
2484e2cf4eSGreg Roachclass PolishSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
25c1010edaSGreg Roach{
26323788f4SGreg Roach    /** @var SurnameTraditionInterface */
27323788f4SGreg Roach    private $surname_tradition;
28323788f4SGreg Roach
29323788f4SGreg Roach    /**
30323788f4SGreg Roach     * Prepare the environment for these tests
31*52348eb8SGreg Roach     *
32*52348eb8SGreg Roach     * @return void
33323788f4SGreg Roach     */
34c1010edaSGreg Roach    public function setUp()
35c1010edaSGreg Roach    {
36323788f4SGreg Roach        $this->surname_tradition = new PolishSurnameTradition;
37323788f4SGreg Roach    }
38323788f4SGreg Roach
39323788f4SGreg Roach    /**
40323788f4SGreg Roach     * Test whether married surnames are used
4117d74f3aSGreg Roach     *
4215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
4315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
44*52348eb8SGreg Roach     *
45*52348eb8SGreg Roach     * @return void
46323788f4SGreg Roach     */
47c1010edaSGreg Roach    public function testMarriedSurnames()
48c1010edaSGreg Roach    {
49323788f4SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasMarriedNames());
50323788f4SGreg Roach    }
51323788f4SGreg Roach
52323788f4SGreg Roach    /**
53c1ec7145SGreg Roach     * Test whether surnames are used
5417d74f3aSGreg Roach     *
5515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
5615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
57*52348eb8SGreg Roach     *
58*52348eb8SGreg Roach     * @return void
59c1ec7145SGreg Roach     */
60c1010edaSGreg Roach    public function testSurnames()
61c1010edaSGreg Roach    {
62c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
63c1ec7145SGreg Roach    }
64c1ec7145SGreg Roach
65c1ec7145SGreg Roach    /**
66323788f4SGreg Roach     * Test new son names
6717d74f3aSGreg Roach     *
6815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
6915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
70*52348eb8SGreg Roach     *
71*52348eb8SGreg Roach     * @return void
72323788f4SGreg Roach     */
73c1010edaSGreg Roach    public function testNewSonNames()
74c1010edaSGreg Roach    {
75323788f4SGreg Roach        $this->assertSame(
76c1010edaSGreg Roach            [
77c1010edaSGreg Roach                'NAME' => '/White/',
78c1010edaSGreg Roach                'SURN' => 'White',
79c1010edaSGreg Roach            ],
80323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
81323788f4SGreg Roach        );
82323788f4SGreg Roach    }
83323788f4SGreg Roach
84323788f4SGreg Roach    /**
85323788f4SGreg Roach     * Test new daughter names
8617d74f3aSGreg Roach     *
8715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
8815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
89*52348eb8SGreg Roach     *
90*52348eb8SGreg Roach     * @return void
91323788f4SGreg Roach     */
92c1010edaSGreg Roach    public function testNewDaughterNames()
93c1010edaSGreg Roach    {
94323788f4SGreg Roach        $this->assertSame(
95c1010edaSGreg Roach            [
96c1010edaSGreg Roach                'NAME' => '/White/',
97c1010edaSGreg Roach                'SURN' => 'White',
98c1010edaSGreg Roach            ],
99323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
100323788f4SGreg Roach        );
101323788f4SGreg Roach    }
102323788f4SGreg Roach
103323788f4SGreg Roach    /**
104323788f4SGreg Roach     * Test new daughter names
10517d74f3aSGreg Roach     *
10615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
10715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
108*52348eb8SGreg Roach     *
109*52348eb8SGreg Roach     * @return void
110323788f4SGreg Roach     */
111c1010edaSGreg Roach    public function testNewDaughterNamesInflected()
112c1010edaSGreg Roach    {
113323788f4SGreg Roach        $this->assertSame(
114c1010edaSGreg Roach            [
115c1010edaSGreg Roach                'NAME' => '/Whitecka/',
116c1010edaSGreg Roach                'SURN' => 'Whitecki',
117c1010edaSGreg Roach            ],
118323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F')
119323788f4SGreg Roach        );
120323788f4SGreg Roach        $this->assertSame(
121c1010edaSGreg Roach            [
122c1010edaSGreg Roach                'NAME' => '/Whitedzka/',
123c1010edaSGreg Roach                'SURN' => 'Whitedzki',
124c1010edaSGreg Roach            ],
125323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F')
126323788f4SGreg Roach        );
127323788f4SGreg Roach        $this->assertSame(
128c1010edaSGreg Roach            [
129c1010edaSGreg Roach                'NAME' => '/Whiteska/',
130c1010edaSGreg Roach                'SURN' => 'Whiteski',
131c1010edaSGreg Roach            ],
132323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F')
133323788f4SGreg Roach        );
134323788f4SGreg Roach        $this->assertSame(
135c1010edaSGreg Roach            [
136c1010edaSGreg Roach                'NAME' => '/Whiteżka/',
137c1010edaSGreg Roach                'SURN' => 'Whiteżki',
138c1010edaSGreg Roach            ],
139323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F')
140323788f4SGreg Roach        );
141323788f4SGreg Roach    }
142323788f4SGreg Roach
143323788f4SGreg Roach    /**
144323788f4SGreg Roach     * Test new child names
14517d74f3aSGreg Roach     *
14615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
14715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
148*52348eb8SGreg Roach     *
149*52348eb8SGreg Roach     * @return void
150323788f4SGreg Roach     */
151c1010edaSGreg Roach    public function testNewChildNames()
152c1010edaSGreg Roach    {
153323788f4SGreg Roach        $this->assertSame(
154c1010edaSGreg Roach            [
155c1010edaSGreg Roach                'NAME' => '/White/',
156c1010edaSGreg Roach                'SURN' => 'White',
157c1010edaSGreg Roach            ],
158323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
159323788f4SGreg Roach        );
160323788f4SGreg Roach    }
161323788f4SGreg Roach
162323788f4SGreg Roach    /**
1631677a03aSGreg Roach     * Test new child names
16417d74f3aSGreg Roach     *
16515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
16615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
167*52348eb8SGreg Roach     *
168*52348eb8SGreg Roach     * @return void
1691677a03aSGreg Roach     */
170c1010edaSGreg Roach    public function testNewChildNamesWithNoParentsNames()
171c1010edaSGreg Roach    {
1721677a03aSGreg Roach        $this->assertSame(
17313abd6f3SGreg Roach            ['NAME' => '//'],
1741677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1751677a03aSGreg Roach        );
1761677a03aSGreg Roach    }
1771677a03aSGreg Roach
1781677a03aSGreg Roach    /**
179323788f4SGreg Roach     * Test new father names
18017d74f3aSGreg Roach     *
18115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
18215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
183*52348eb8SGreg Roach     *
184*52348eb8SGreg Roach     * @return void
185323788f4SGreg Roach     */
186c1010edaSGreg Roach    public function testNewFatherNames()
187c1010edaSGreg Roach    {
188323788f4SGreg Roach        $this->assertSame(
189c1010edaSGreg Roach            [
190c1010edaSGreg Roach                'NAME' => '/White/',
191c1010edaSGreg Roach                'SURN' => 'White',
192c1010edaSGreg Roach            ],
193323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
194323788f4SGreg Roach        );
195323788f4SGreg Roach    }
196323788f4SGreg Roach
197323788f4SGreg Roach    /**
198323788f4SGreg Roach     * Test new father names
19917d74f3aSGreg Roach     *
20015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
20115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
202*52348eb8SGreg Roach     *
203*52348eb8SGreg Roach     * @return void
204323788f4SGreg Roach     */
205c1010edaSGreg Roach    public function testNewFatherNamesInflected()
206c1010edaSGreg Roach    {
207323788f4SGreg Roach        $this->assertSame(
208c1010edaSGreg Roach            [
209c1010edaSGreg Roach                'NAME' => '/Whitecki/',
210c1010edaSGreg Roach                'SURN' => 'Whitecki',
211c1010edaSGreg Roach            ],
212323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M')
213323788f4SGreg Roach        );
214323788f4SGreg Roach        $this->assertSame(
215c1010edaSGreg Roach            [
216c1010edaSGreg Roach                'NAME' => '/Whitedzki/',
217c1010edaSGreg Roach                'SURN' => 'Whitedzki',
218c1010edaSGreg Roach            ],
219323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M')
220323788f4SGreg Roach        );
221323788f4SGreg Roach        $this->assertSame(
222c1010edaSGreg Roach            [
223c1010edaSGreg Roach                'NAME' => '/Whiteski/',
224c1010edaSGreg Roach                'SURN' => 'Whiteski',
225c1010edaSGreg Roach            ],
226323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M')
227323788f4SGreg Roach        );
228323788f4SGreg Roach        $this->assertSame(
229c1010edaSGreg Roach            [
230c1010edaSGreg Roach                'NAME' => '/Whiteżki/',
231c1010edaSGreg Roach                'SURN' => 'Whiteżki',
232c1010edaSGreg Roach            ],
233323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M')
234323788f4SGreg Roach        );
235323788f4SGreg Roach    }
236323788f4SGreg Roach
237323788f4SGreg Roach    /**
238323788f4SGreg Roach     * Test new mother names
23917d74f3aSGreg Roach     *
24015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
24115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
242*52348eb8SGreg Roach     *
243*52348eb8SGreg Roach     * @return void
244323788f4SGreg Roach     */
245c1010edaSGreg Roach    public function testNewMotherNames()
246c1010edaSGreg Roach    {
247323788f4SGreg Roach        $this->assertSame(
24813abd6f3SGreg Roach            ['NAME' => '//'],
249323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
250323788f4SGreg Roach        );
251323788f4SGreg Roach    }
252323788f4SGreg Roach
253323788f4SGreg Roach    /**
254323788f4SGreg Roach     * Test new parent names
25517d74f3aSGreg Roach     *
25615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
25715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
258*52348eb8SGreg Roach     *
259*52348eb8SGreg Roach     * @return void
260323788f4SGreg Roach     */
261c1010edaSGreg Roach    public function testNewParentNames()
262c1010edaSGreg Roach    {
263323788f4SGreg Roach        $this->assertSame(
26413abd6f3SGreg Roach            ['NAME' => '//'],
265323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
266323788f4SGreg Roach        );
267323788f4SGreg Roach    }
268323788f4SGreg Roach
269323788f4SGreg Roach    /**
270323788f4SGreg Roach     * Test new husband names
27117d74f3aSGreg Roach     *
27215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
27315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
274*52348eb8SGreg Roach     *
275*52348eb8SGreg Roach     * @return void
276323788f4SGreg Roach     */
277c1010edaSGreg Roach    public function testNewHusbandNames()
278c1010edaSGreg Roach    {
279323788f4SGreg Roach        $this->assertSame(
28013abd6f3SGreg Roach            ['NAME' => '//'],
281323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
282323788f4SGreg Roach        );
283323788f4SGreg Roach    }
284323788f4SGreg Roach
285323788f4SGreg Roach    /**
286323788f4SGreg Roach     * Test new wife names
28717d74f3aSGreg Roach     *
28815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
28915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
290*52348eb8SGreg Roach     *
291*52348eb8SGreg Roach     * @return void
292323788f4SGreg Roach     */
293c1010edaSGreg Roach    public function testNewWifeNames()
294c1010edaSGreg Roach    {
295323788f4SGreg Roach        $this->assertSame(
296c1010edaSGreg Roach            [
297c1010edaSGreg Roach                'NAME'   => '//',
298c1010edaSGreg Roach                '_MARNM' => '/White/',
299c1010edaSGreg Roach            ],
300323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
301323788f4SGreg Roach        );
302323788f4SGreg Roach    }
303323788f4SGreg Roach
304323788f4SGreg Roach    /**
305323788f4SGreg Roach     * Test new spouse names
30617d74f3aSGreg Roach     *
30715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
30815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
309*52348eb8SGreg Roach     *
310*52348eb8SGreg Roach     * @return void
311323788f4SGreg Roach     */
312c1010edaSGreg Roach    public function testNewSpouseNames()
313c1010edaSGreg Roach    {
314323788f4SGreg Roach        $this->assertSame(
31513abd6f3SGreg Roach            ['NAME' => '//'],
316323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
317323788f4SGreg Roach        );
318323788f4SGreg Roach    }
319323788f4SGreg Roach}
320