xref: /webtrees/tests/app/SurnameTradition/PolishSurnameTraditionTest.php (revision c1010eda29c0909ed4d5d463f32d32bfefdd4dfe)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
51062a142SGreg Roach * Copyright (C) 2018 webtrees development team
6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9323788f4SGreg Roach * (at your option) any later version.
10323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13323788f4SGreg Roach * GNU General Public License for more details.
14323788f4SGreg Roach * You should have received a copy of the GNU General Public License
15323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16323788f4SGreg Roach */
17*c1010edaSGreg 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 */
24*c1010edaSGreg Roachclass PolishSurnameTraditionTest extends \PHPUnit\Framework\TestCase
25*c1010edaSGreg Roach{
26323788f4SGreg Roach    /** @var SurnameTraditionInterface */
27323788f4SGreg Roach    private $surname_tradition;
28323788f4SGreg Roach
29323788f4SGreg Roach    /**
30323788f4SGreg Roach     * Prepare the environment for these tests
31323788f4SGreg Roach     */
32*c1010edaSGreg Roach    public function setUp()
33*c1010edaSGreg Roach    {
34323788f4SGreg Roach        $this->surname_tradition = new PolishSurnameTradition;
35323788f4SGreg Roach    }
36323788f4SGreg Roach
37323788f4SGreg Roach    /**
38323788f4SGreg Roach     * Test whether married surnames are used
3917d74f3aSGreg Roach     *
4015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
4115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
42323788f4SGreg Roach     */
43*c1010edaSGreg Roach    public function testMarriedSurnames()
44*c1010edaSGreg Roach    {
45323788f4SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasMarriedNames());
46323788f4SGreg Roach    }
47323788f4SGreg Roach
48323788f4SGreg Roach    /**
49c1ec7145SGreg Roach     * Test whether surnames are used
5017d74f3aSGreg Roach     *
5115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
5215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
53c1ec7145SGreg Roach     */
54*c1010edaSGreg Roach    public function testSurnames()
55*c1010edaSGreg Roach    {
56c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
57c1ec7145SGreg Roach    }
58c1ec7145SGreg Roach
59c1ec7145SGreg Roach    /**
60323788f4SGreg Roach     * Test new son names
6117d74f3aSGreg Roach     *
6215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
6315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
64323788f4SGreg Roach     */
65*c1010edaSGreg Roach    public function testNewSonNames()
66*c1010edaSGreg Roach    {
67323788f4SGreg Roach        $this->assertSame(
68*c1010edaSGreg Roach            [
69*c1010edaSGreg Roach                'NAME' => '/White/',
70*c1010edaSGreg Roach                'SURN' => 'White',
71*c1010edaSGreg Roach            ],
72323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
73323788f4SGreg Roach        );
74323788f4SGreg Roach    }
75323788f4SGreg Roach
76323788f4SGreg Roach    /**
77323788f4SGreg Roach     * Test new daughter names
7817d74f3aSGreg Roach     *
7915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
8015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
81323788f4SGreg Roach     */
82*c1010edaSGreg Roach    public function testNewDaughterNames()
83*c1010edaSGreg Roach    {
84323788f4SGreg Roach        $this->assertSame(
85*c1010edaSGreg Roach            [
86*c1010edaSGreg Roach                'NAME' => '/White/',
87*c1010edaSGreg Roach                'SURN' => 'White',
88*c1010edaSGreg Roach            ],
89323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
90323788f4SGreg Roach        );
91323788f4SGreg Roach    }
92323788f4SGreg Roach
93323788f4SGreg Roach    /**
94323788f4SGreg Roach     * Test new daughter names
9517d74f3aSGreg Roach     *
9615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
9715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
98323788f4SGreg Roach     */
99*c1010edaSGreg Roach    public function testNewDaughterNamesInflected()
100*c1010edaSGreg Roach    {
101323788f4SGreg Roach        $this->assertSame(
102*c1010edaSGreg Roach            [
103*c1010edaSGreg Roach                'NAME' => '/Whitecka/',
104*c1010edaSGreg Roach                'SURN' => 'Whitecki',
105*c1010edaSGreg Roach            ],
106323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F')
107323788f4SGreg Roach        );
108323788f4SGreg Roach        $this->assertSame(
109*c1010edaSGreg Roach            [
110*c1010edaSGreg Roach                'NAME' => '/Whitedzka/',
111*c1010edaSGreg Roach                'SURN' => 'Whitedzki',
112*c1010edaSGreg Roach            ],
113323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F')
114323788f4SGreg Roach        );
115323788f4SGreg Roach        $this->assertSame(
116*c1010edaSGreg Roach            [
117*c1010edaSGreg Roach                'NAME' => '/Whiteska/',
118*c1010edaSGreg Roach                'SURN' => 'Whiteski',
119*c1010edaSGreg Roach            ],
120323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F')
121323788f4SGreg Roach        );
122323788f4SGreg Roach        $this->assertSame(
123*c1010edaSGreg Roach            [
124*c1010edaSGreg Roach                'NAME' => '/Whiteżka/',
125*c1010edaSGreg Roach                'SURN' => 'Whiteżki',
126*c1010edaSGreg Roach            ],
127323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F')
128323788f4SGreg Roach        );
129323788f4SGreg Roach    }
130323788f4SGreg Roach
131323788f4SGreg Roach    /**
132323788f4SGreg Roach     * Test new child names
13317d74f3aSGreg Roach     *
13415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
13515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
136323788f4SGreg Roach     */
137*c1010edaSGreg Roach    public function testNewChildNames()
138*c1010edaSGreg Roach    {
139323788f4SGreg Roach        $this->assertSame(
140*c1010edaSGreg Roach            [
141*c1010edaSGreg Roach                'NAME' => '/White/',
142*c1010edaSGreg Roach                'SURN' => 'White',
143*c1010edaSGreg Roach            ],
144323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
145323788f4SGreg Roach        );
146323788f4SGreg Roach    }
147323788f4SGreg Roach
148323788f4SGreg Roach    /**
1491677a03aSGreg Roach     * Test new child names
15017d74f3aSGreg Roach     *
15115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
15215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
1531677a03aSGreg Roach     */
154*c1010edaSGreg Roach    public function testNewChildNamesWithNoParentsNames()
155*c1010edaSGreg Roach    {
1561677a03aSGreg Roach        $this->assertSame(
15713abd6f3SGreg Roach            ['NAME' => '//'],
1581677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1591677a03aSGreg Roach        );
1601677a03aSGreg Roach    }
1611677a03aSGreg Roach
1621677a03aSGreg Roach    /**
163323788f4SGreg Roach     * Test new father names
16417d74f3aSGreg Roach     *
16515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
16615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
167323788f4SGreg Roach     */
168*c1010edaSGreg Roach    public function testNewFatherNames()
169*c1010edaSGreg Roach    {
170323788f4SGreg Roach        $this->assertSame(
171*c1010edaSGreg Roach            [
172*c1010edaSGreg Roach                'NAME' => '/White/',
173*c1010edaSGreg Roach                'SURN' => 'White',
174*c1010edaSGreg Roach            ],
175323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
176323788f4SGreg Roach        );
177323788f4SGreg Roach    }
178323788f4SGreg Roach
179323788f4SGreg Roach    /**
180323788f4SGreg Roach     * Test new father names
18117d74f3aSGreg Roach     *
18215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
18315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
184323788f4SGreg Roach     */
185*c1010edaSGreg Roach    public function testNewFatherNamesInflected()
186*c1010edaSGreg Roach    {
187323788f4SGreg Roach        $this->assertSame(
188*c1010edaSGreg Roach            [
189*c1010edaSGreg Roach                'NAME' => '/Whitecki/',
190*c1010edaSGreg Roach                'SURN' => 'Whitecki',
191*c1010edaSGreg Roach            ],
192323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M')
193323788f4SGreg Roach        );
194323788f4SGreg Roach        $this->assertSame(
195*c1010edaSGreg Roach            [
196*c1010edaSGreg Roach                'NAME' => '/Whitedzki/',
197*c1010edaSGreg Roach                'SURN' => 'Whitedzki',
198*c1010edaSGreg Roach            ],
199323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M')
200323788f4SGreg Roach        );
201323788f4SGreg Roach        $this->assertSame(
202*c1010edaSGreg Roach            [
203*c1010edaSGreg Roach                'NAME' => '/Whiteski/',
204*c1010edaSGreg Roach                'SURN' => 'Whiteski',
205*c1010edaSGreg Roach            ],
206323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M')
207323788f4SGreg Roach        );
208323788f4SGreg Roach        $this->assertSame(
209*c1010edaSGreg Roach            [
210*c1010edaSGreg Roach                'NAME' => '/Whiteżki/',
211*c1010edaSGreg Roach                'SURN' => 'Whiteżki',
212*c1010edaSGreg Roach            ],
213323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M')
214323788f4SGreg Roach        );
215323788f4SGreg Roach    }
216323788f4SGreg Roach
217323788f4SGreg Roach    /**
218323788f4SGreg Roach     * Test new mother names
21917d74f3aSGreg Roach     *
22015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
22115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
222323788f4SGreg Roach     */
223*c1010edaSGreg Roach    public function testNewMotherNames()
224*c1010edaSGreg Roach    {
225323788f4SGreg Roach        $this->assertSame(
22613abd6f3SGreg Roach            ['NAME' => '//'],
227323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
228323788f4SGreg Roach        );
229323788f4SGreg Roach    }
230323788f4SGreg Roach
231323788f4SGreg Roach    /**
232323788f4SGreg Roach     * Test new parent names
23317d74f3aSGreg Roach     *
23415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
23515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
236323788f4SGreg Roach     */
237*c1010edaSGreg Roach    public function testNewParentNames()
238*c1010edaSGreg Roach    {
239323788f4SGreg Roach        $this->assertSame(
24013abd6f3SGreg Roach            ['NAME' => '//'],
241323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
242323788f4SGreg Roach        );
243323788f4SGreg Roach    }
244323788f4SGreg Roach
245323788f4SGreg Roach    /**
246323788f4SGreg Roach     * Test new husband names
24717d74f3aSGreg Roach     *
24815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
24915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
250323788f4SGreg Roach     */
251*c1010edaSGreg Roach    public function testNewHusbandNames()
252*c1010edaSGreg Roach    {
253323788f4SGreg Roach        $this->assertSame(
25413abd6f3SGreg Roach            ['NAME' => '//'],
255323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
256323788f4SGreg Roach        );
257323788f4SGreg Roach    }
258323788f4SGreg Roach
259323788f4SGreg Roach    /**
260323788f4SGreg Roach     * Test new wife names
26117d74f3aSGreg Roach     *
26215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
26315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
264323788f4SGreg Roach     */
265*c1010edaSGreg Roach    public function testNewWifeNames()
266*c1010edaSGreg Roach    {
267323788f4SGreg Roach        $this->assertSame(
268*c1010edaSGreg Roach            [
269*c1010edaSGreg Roach                'NAME'   => '//',
270*c1010edaSGreg Roach                '_MARNM' => '/White/',
271*c1010edaSGreg Roach            ],
272323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
273323788f4SGreg Roach        );
274323788f4SGreg Roach    }
275323788f4SGreg Roach
276323788f4SGreg Roach    /**
277323788f4SGreg Roach     * Test new spouse names
27817d74f3aSGreg Roach     *
27915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
28015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
281323788f4SGreg Roach     */
282*c1010edaSGreg Roach    public function testNewSpouseNames()
283*c1010edaSGreg Roach    {
284323788f4SGreg Roach        $this->assertSame(
28513abd6f3SGreg Roach            ['NAME' => '//'],
286323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
287323788f4SGreg Roach        );
288323788f4SGreg Roach    }
289323788f4SGreg Roach}
290