xref: /webtrees/tests/app/SurnameTradition/PolishSurnameTraditionTest.php (revision c4943cff72f95a28fbb9404e3c20b169ff098e5c)
1323788f4SGreg Roach<?php
23976b470SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
589f7189bSGreg Roach * Copyright (C) 2021 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
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16323788f4SGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2084e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
21c1010edaSGreg Roach
223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
233cfcc809SGreg Roach
24323788f4SGreg Roach/**
25*c4943cffSGreg Roach * Test harness for the class PolishSurnameTradition
26323788f4SGreg Roach */
273cfcc809SGreg Roachclass PolishSurnameTraditionTest extends TestCase
28c1010edaSGreg Roach{
29*c4943cffSGreg Roach    private SurnameTraditionInterface $surname_tradition;
30323788f4SGreg Roach
31323788f4SGreg Roach    /**
32323788f4SGreg Roach     * Prepare the environment for these tests
3352348eb8SGreg Roach     *
3452348eb8SGreg Roach     * @return void
35323788f4SGreg Roach     */
365c48bcd6SGreg Roach    protected function setUp(): void
37c1010edaSGreg Roach    {
380115bc16SGreg Roach        parent::setUp();
390115bc16SGreg Roach
4074d6dc0eSGreg Roach        $this->surname_tradition = new PolishSurnameTradition();
41323788f4SGreg Roach    }
42323788f4SGreg Roach
43323788f4SGreg Roach    /**
44323788f4SGreg Roach     * Test whether married surnames are used
4517d74f3aSGreg Roach     *
4615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
4715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
4852348eb8SGreg Roach     *
4952348eb8SGreg Roach     * @return void
50323788f4SGreg Roach     */
519b802b22SGreg Roach    public function testMarriedSurnames(): void
52c1010edaSGreg Roach    {
535e933c21SGreg Roach        self::assertTrue($this->surname_tradition->hasMarriedNames());
54323788f4SGreg Roach    }
55323788f4SGreg Roach
56323788f4SGreg Roach    /**
57c1ec7145SGreg Roach     * Test whether surnames are used
5817d74f3aSGreg Roach     *
5915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
6015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
6152348eb8SGreg Roach     *
6252348eb8SGreg Roach     * @return void
63c1ec7145SGreg Roach     */
649b802b22SGreg Roach    public function testSurnames(): void
65c1010edaSGreg Roach    {
665e933c21SGreg Roach        self::assertTrue($this->surname_tradition->hasSurnames());
67c1ec7145SGreg Roach    }
68c1ec7145SGreg Roach
69c1ec7145SGreg Roach    /**
70323788f4SGreg Roach     * Test new son names
7117d74f3aSGreg Roach     *
7215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
7315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
7452348eb8SGreg Roach     *
7552348eb8SGreg Roach     * @return void
76323788f4SGreg Roach     */
779b802b22SGreg Roach    public function testNewSonNames(): void
78c1010edaSGreg Roach    {
795e933c21SGreg Roach        self::assertSame(
80c1010edaSGreg Roach            [
81c1010edaSGreg Roach                'NAME' => '/White/',
82c1010edaSGreg Roach                'SURN' => 'White',
83c1010edaSGreg Roach            ],
84323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
85323788f4SGreg Roach        );
86323788f4SGreg Roach    }
87323788f4SGreg Roach
88323788f4SGreg Roach    /**
89323788f4SGreg Roach     * Test new daughter names
9017d74f3aSGreg Roach     *
9115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
9215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
9352348eb8SGreg Roach     *
9452348eb8SGreg Roach     * @return void
95323788f4SGreg Roach     */
969b802b22SGreg Roach    public function testNewDaughterNames(): void
97c1010edaSGreg Roach    {
985e933c21SGreg Roach        self::assertSame(
99c1010edaSGreg Roach            [
100c1010edaSGreg Roach                'NAME' => '/White/',
101c1010edaSGreg Roach                'SURN' => 'White',
102c1010edaSGreg Roach            ],
103323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
104323788f4SGreg Roach        );
105323788f4SGreg Roach    }
106323788f4SGreg Roach
107323788f4SGreg Roach    /**
108323788f4SGreg Roach     * Test new daughter names
10917d74f3aSGreg Roach     *
11015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
11115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
11252348eb8SGreg Roach     *
11352348eb8SGreg Roach     * @return void
114323788f4SGreg Roach     */
1159b802b22SGreg Roach    public function testNewDaughterNamesInflected(): void
116c1010edaSGreg Roach    {
1175e933c21SGreg Roach        self::assertSame(
118c1010edaSGreg Roach            [
119c1010edaSGreg Roach                'NAME' => '/Whitecka/',
120c1010edaSGreg Roach                'SURN' => 'Whitecki',
121c1010edaSGreg Roach            ],
122323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F')
123323788f4SGreg Roach        );
1245e933c21SGreg Roach        self::assertSame(
125c1010edaSGreg Roach            [
126c1010edaSGreg Roach                'NAME' => '/Whitedzka/',
127c1010edaSGreg Roach                'SURN' => 'Whitedzki',
128c1010edaSGreg Roach            ],
129323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F')
130323788f4SGreg Roach        );
1315e933c21SGreg Roach        self::assertSame(
132c1010edaSGreg Roach            [
133c1010edaSGreg Roach                'NAME' => '/Whiteska/',
134c1010edaSGreg Roach                'SURN' => 'Whiteski',
135c1010edaSGreg Roach            ],
136323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F')
137323788f4SGreg Roach        );
1385e933c21SGreg Roach        self::assertSame(
139c1010edaSGreg Roach            [
140c1010edaSGreg Roach                'NAME' => '/Whiteżka/',
141c1010edaSGreg Roach                'SURN' => 'Whiteżki',
142c1010edaSGreg Roach            ],
143323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F')
144323788f4SGreg Roach        );
145323788f4SGreg Roach    }
146323788f4SGreg Roach
147323788f4SGreg Roach    /**
148323788f4SGreg Roach     * Test new child names
14917d74f3aSGreg Roach     *
15015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
15115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
15252348eb8SGreg Roach     *
15352348eb8SGreg Roach     * @return void
154323788f4SGreg Roach     */
1559b802b22SGreg Roach    public function testNewChildNames(): void
156c1010edaSGreg Roach    {
1575e933c21SGreg Roach        self::assertSame(
158c1010edaSGreg Roach            [
159c1010edaSGreg Roach                'NAME' => '/White/',
160c1010edaSGreg Roach                'SURN' => 'White',
161c1010edaSGreg Roach            ],
162323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
163323788f4SGreg Roach        );
164323788f4SGreg Roach    }
165323788f4SGreg Roach
166323788f4SGreg Roach    /**
1671677a03aSGreg Roach     * Test new child names
16817d74f3aSGreg Roach     *
16915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
17015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
17152348eb8SGreg Roach     *
17252348eb8SGreg Roach     * @return void
1731677a03aSGreg Roach     */
1749b802b22SGreg Roach    public function testNewChildNamesWithNoParentsNames(): void
175c1010edaSGreg Roach    {
1765e933c21SGreg Roach        self::assertSame(
17713abd6f3SGreg Roach            ['NAME' => '//'],
1781677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1791677a03aSGreg Roach        );
1801677a03aSGreg Roach    }
1811677a03aSGreg Roach
1821677a03aSGreg Roach    /**
183323788f4SGreg Roach     * Test new father names
18417d74f3aSGreg Roach     *
18515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
18615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
18752348eb8SGreg Roach     *
18852348eb8SGreg Roach     * @return void
189323788f4SGreg Roach     */
1909b802b22SGreg Roach    public function testNewFatherNames(): void
191c1010edaSGreg Roach    {
1925e933c21SGreg Roach        self::assertSame(
193c1010edaSGreg Roach            [
194c1010edaSGreg Roach                'NAME' => '/White/',
195c1010edaSGreg Roach                'SURN' => 'White',
196c1010edaSGreg Roach            ],
197323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
198323788f4SGreg Roach        );
199323788f4SGreg Roach    }
200323788f4SGreg Roach
201323788f4SGreg Roach    /**
202323788f4SGreg Roach     * Test new father names
20317d74f3aSGreg Roach     *
20415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
20515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
20652348eb8SGreg Roach     *
20752348eb8SGreg Roach     * @return void
208323788f4SGreg Roach     */
2099b802b22SGreg Roach    public function testNewFatherNamesInflected(): void
210c1010edaSGreg Roach    {
2115e933c21SGreg Roach        self::assertSame(
212c1010edaSGreg Roach            [
213c1010edaSGreg Roach                'NAME' => '/Whitecki/',
214c1010edaSGreg Roach                'SURN' => 'Whitecki',
215c1010edaSGreg Roach            ],
216323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M')
217323788f4SGreg Roach        );
2185e933c21SGreg Roach        self::assertSame(
219c1010edaSGreg Roach            [
220c1010edaSGreg Roach                'NAME' => '/Whitedzki/',
221c1010edaSGreg Roach                'SURN' => 'Whitedzki',
222c1010edaSGreg Roach            ],
223323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M')
224323788f4SGreg Roach        );
2255e933c21SGreg Roach        self::assertSame(
226c1010edaSGreg Roach            [
227c1010edaSGreg Roach                'NAME' => '/Whiteski/',
228c1010edaSGreg Roach                'SURN' => 'Whiteski',
229c1010edaSGreg Roach            ],
230323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M')
231323788f4SGreg Roach        );
2325e933c21SGreg Roach        self::assertSame(
233c1010edaSGreg Roach            [
234c1010edaSGreg Roach                'NAME' => '/Whiteżki/',
235c1010edaSGreg Roach                'SURN' => 'Whiteżki',
236c1010edaSGreg Roach            ],
237323788f4SGreg Roach            $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M')
238323788f4SGreg Roach        );
239323788f4SGreg Roach    }
240323788f4SGreg Roach
241323788f4SGreg Roach    /**
242323788f4SGreg Roach     * Test new mother names
24317d74f3aSGreg Roach     *
24415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
24515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
24652348eb8SGreg Roach     *
24752348eb8SGreg Roach     * @return void
248323788f4SGreg Roach     */
2499b802b22SGreg Roach    public function testNewMotherNames(): void
250c1010edaSGreg Roach    {
2515e933c21SGreg Roach        self::assertSame(
25213abd6f3SGreg Roach            ['NAME' => '//'],
253323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
254323788f4SGreg Roach        );
255323788f4SGreg Roach    }
256323788f4SGreg Roach
257323788f4SGreg Roach    /**
258323788f4SGreg Roach     * Test new parent names
25917d74f3aSGreg Roach     *
26015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
26115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
26252348eb8SGreg Roach     *
26352348eb8SGreg Roach     * @return void
264323788f4SGreg Roach     */
2659b802b22SGreg Roach    public function testNewParentNames(): void
266c1010edaSGreg Roach    {
2675e933c21SGreg Roach        self::assertSame(
26813abd6f3SGreg Roach            ['NAME' => '//'],
269323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
270323788f4SGreg Roach        );
271323788f4SGreg Roach    }
272323788f4SGreg Roach
273323788f4SGreg Roach    /**
274323788f4SGreg Roach     * Test new husband names
27517d74f3aSGreg Roach     *
27615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
27715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
27852348eb8SGreg Roach     *
27952348eb8SGreg Roach     * @return void
280323788f4SGreg Roach     */
2819b802b22SGreg Roach    public function testNewHusbandNames(): void
282c1010edaSGreg Roach    {
2835e933c21SGreg Roach        self::assertSame(
28413abd6f3SGreg Roach            ['NAME' => '//'],
285323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
286323788f4SGreg Roach        );
287323788f4SGreg Roach    }
288323788f4SGreg Roach
289323788f4SGreg Roach    /**
290323788f4SGreg Roach     * Test new wife names
29117d74f3aSGreg Roach     *
29215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
29315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
29452348eb8SGreg Roach     *
29552348eb8SGreg Roach     * @return void
296323788f4SGreg Roach     */
2979b802b22SGreg Roach    public function testNewWifeNames(): void
298c1010edaSGreg Roach    {
2995e933c21SGreg Roach        self::assertSame(
300c1010edaSGreg Roach            [
301c1010edaSGreg Roach                'NAME'   => '//',
302c1010edaSGreg Roach                '_MARNM' => '/White/',
303c1010edaSGreg Roach            ],
304323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
305323788f4SGreg Roach        );
306323788f4SGreg Roach    }
307323788f4SGreg Roach
308323788f4SGreg Roach    /**
309323788f4SGreg Roach     * Test new spouse names
31017d74f3aSGreg Roach     *
31115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
31215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
31352348eb8SGreg Roach     *
31452348eb8SGreg Roach     * @return void
315323788f4SGreg Roach     */
3169b802b22SGreg Roach    public function testNewSpouseNames(): void
317c1010edaSGreg Roach    {
3185e933c21SGreg Roach        self::assertSame(
31913abd6f3SGreg Roach            ['NAME' => '//'],
320323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
321323788f4SGreg Roach        );
322323788f4SGreg Roach    }
323323788f4SGreg Roach}
324