xref: /webtrees/tests/app/SurnameTradition/PaternalSurnameTraditionTest.php (revision 8fcd0d32e56ee262912bbdb593202cfd1cbc1615)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach/**
3323788f4SGreg Roach * webtrees: online genealogy
4*8fcd0d32SGreg Roach * Copyright (C) 2019 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 */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
19c1010edaSGreg Roach
20323788f4SGreg Roach/**
21323788f4SGreg Roach * Test harness for the class PaternalSurnameTradition
22323788f4SGreg Roach */
2384e2cf4eSGreg Roachclass PaternalSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
24c1010edaSGreg Roach{
25323788f4SGreg Roach    /** @var SurnameTraditionInterface */
26323788f4SGreg Roach    private $surname_tradition;
27323788f4SGreg Roach
28323788f4SGreg Roach    /**
29323788f4SGreg Roach     * Prepare the environment for these tests
3052348eb8SGreg Roach     *
3152348eb8SGreg Roach     * @return void
32323788f4SGreg Roach     */
330115bc16SGreg Roach    protected function setUp()
34c1010edaSGreg Roach    {
350115bc16SGreg Roach        parent::setUp();
360115bc16SGreg Roach
37323788f4SGreg Roach        $this->surname_tradition = new PaternalSurnameTradition;
38323788f4SGreg Roach    }
39323788f4SGreg Roach
40323788f4SGreg Roach    /**
41323788f4SGreg Roach     * Test whether married surnames are used
4217d74f3aSGreg Roach     *
4315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
4452348eb8SGreg Roach     *
4552348eb8SGreg 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\PaternalSurnameTradition
5652348eb8SGreg Roach     *
5752348eb8SGreg Roach     * @return void
58c1ec7145SGreg Roach     */
59c1010edaSGreg Roach    public function testSurnames()
60c1010edaSGreg Roach    {
61c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
62c1ec7145SGreg Roach    }
63c1ec7145SGreg Roach
64c1ec7145SGreg Roach    /**
65323788f4SGreg Roach     * Test new son names
6617d74f3aSGreg Roach     *
6715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
6852348eb8SGreg Roach     *
6952348eb8SGreg Roach     * @return void
70323788f4SGreg Roach     */
71c1010edaSGreg Roach    public function testNewSonNames()
72c1010edaSGreg Roach    {
73323788f4SGreg Roach        $this->assertSame(
74c1010edaSGreg Roach            [
75c1010edaSGreg Roach                'NAME' => '/White/',
76c1010edaSGreg Roach                'SURN' => 'White',
77c1010edaSGreg Roach            ],
78323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
79323788f4SGreg Roach        );
80323788f4SGreg Roach    }
81323788f4SGreg Roach
82323788f4SGreg Roach    /**
83323788f4SGreg Roach     * Test new daughter names
8417d74f3aSGreg Roach     *
8515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
8652348eb8SGreg Roach     *
8752348eb8SGreg Roach     * @return void
88323788f4SGreg Roach     */
89c1010edaSGreg Roach    public function testNewDaughterNames()
90c1010edaSGreg Roach    {
91323788f4SGreg Roach        $this->assertSame(
92c1010edaSGreg Roach            [
93c1010edaSGreg Roach                'NAME' => '/White/',
94c1010edaSGreg Roach                'SURN' => 'White',
95c1010edaSGreg Roach            ],
96323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
97323788f4SGreg Roach        );
98323788f4SGreg Roach    }
99323788f4SGreg Roach
100323788f4SGreg Roach    /**
101323788f4SGreg Roach     * Test new child names
10217d74f3aSGreg Roach     *
10315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
10452348eb8SGreg Roach     *
10552348eb8SGreg Roach     * @return void
106323788f4SGreg Roach     */
107c1010edaSGreg Roach    public function testNewChildNames()
108c1010edaSGreg Roach    {
109323788f4SGreg Roach        $this->assertSame(
110c1010edaSGreg Roach            [
111c1010edaSGreg Roach                'NAME' => '/White/',
112c1010edaSGreg Roach                'SURN' => 'White',
113c1010edaSGreg Roach            ],
114323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
115323788f4SGreg Roach        );
116323788f4SGreg Roach    }
117323788f4SGreg Roach
118323788f4SGreg Roach    /**
119323788f4SGreg Roach     * Test new child names
12017d74f3aSGreg Roach     *
12115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
12252348eb8SGreg Roach     *
12352348eb8SGreg Roach     * @return void
124323788f4SGreg Roach     */
125c1010edaSGreg Roach    public function testNewChildNamesWithSpfx()
126c1010edaSGreg Roach    {
127323788f4SGreg Roach        $this->assertSame(
128c1010edaSGreg Roach            [
129c1010edaSGreg Roach                'NAME' => '/de White/',
130c1010edaSGreg Roach                'SPFX' => 'de',
131c1010edaSGreg Roach                'SURN' => 'White',
132c1010edaSGreg Roach            ],
133323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
134323788f4SGreg Roach        );
135323788f4SGreg Roach    }
136323788f4SGreg Roach
137323788f4SGreg Roach    /**
1388caf8226SGreg Roach     * Test new child names
1398caf8226SGreg Roach     *
14015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
14152348eb8SGreg Roach     *
14252348eb8SGreg Roach     * @return void
1438caf8226SGreg Roach     */
144c1010edaSGreg Roach    public function testNewChildNamesWithMultipleSpfx()
145c1010edaSGreg Roach    {
1468caf8226SGreg Roach        $this->assertSame(
147c1010edaSGreg Roach            [
148c1010edaSGreg Roach                'NAME' => '/van der White/',
149c1010edaSGreg Roach                'SPFX' => 'van der',
150c1010edaSGreg Roach                'SURN' => 'White',
151c1010edaSGreg Roach            ],
1528caf8226SGreg Roach            $this->surname_tradition->newChildNames('John /van der White/', 'Mary /van Black/', 'U')
1538caf8226SGreg Roach        );
1548caf8226SGreg Roach    }
1558caf8226SGreg Roach
1568caf8226SGreg Roach    /**
1579797fe2eSGreg Roach     * Test new child names
1589797fe2eSGreg Roach     *
15915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
16052348eb8SGreg Roach     *
16152348eb8SGreg Roach     * @return void
1629797fe2eSGreg Roach     */
163c1010edaSGreg Roach    public function testNewChildNamesWithDutchSpfx()
164c1010edaSGreg Roach    {
1659797fe2eSGreg Roach        $this->assertSame(
166c1010edaSGreg Roach            [
167c1010edaSGreg Roach                'NAME' => '/\'t White/',
168c1010edaSGreg Roach                'SPFX' => '\'t',
169c1010edaSGreg Roach                'SURN' => 'White',
170c1010edaSGreg Roach            ],
1719797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /\'t White/', 'Mary /van Black/', 'U')
1729797fe2eSGreg Roach        );
1739797fe2eSGreg Roach        $this->assertSame(
174c1010edaSGreg Roach            [
175c1010edaSGreg Roach                'NAME' => '/’t White/',
176c1010edaSGreg Roach                'SPFX' => '’t',
177c1010edaSGreg Roach                'SURN' => 'White',
178c1010edaSGreg Roach            ],
1799797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /’t White/', 'Mary /van Black/', 'U')
1809797fe2eSGreg Roach        );
1819797fe2eSGreg Roach    }
1829797fe2eSGreg Roach
1839797fe2eSGreg Roach    /**
1849797fe2eSGreg Roach     * Test new child names
1859797fe2eSGreg Roach     *
18615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
18752348eb8SGreg Roach     *
18852348eb8SGreg Roach     * @return void
1899797fe2eSGreg Roach     */
190c1010edaSGreg Roach    public function testNewChildNamesWithMultipleDutchSpfx()
191c1010edaSGreg Roach    {
1929797fe2eSGreg Roach        $this->assertSame(
193c1010edaSGreg Roach            [
194c1010edaSGreg Roach                'NAME' => '/van \'t White/',
195c1010edaSGreg Roach                'SPFX' => 'van \'t',
196c1010edaSGreg Roach                'SURN' => 'White',
197c1010edaSGreg Roach            ],
1989797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /van \'t White/', 'Mary /van Black/', 'U')
1999797fe2eSGreg Roach        );
2009797fe2eSGreg Roach        $this->assertSame(
201c1010edaSGreg Roach            [
202c1010edaSGreg Roach                'NAME' => '/van ’t White/',
203c1010edaSGreg Roach                'SPFX' => 'van ’t',
204c1010edaSGreg Roach                'SURN' => 'White',
205c1010edaSGreg Roach            ],
2069797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /van ’t White/', 'Mary /van Black/', 'U')
2079797fe2eSGreg Roach        );
2089797fe2eSGreg Roach    }
2099797fe2eSGreg Roach
2109797fe2eSGreg Roach    /**
211323788f4SGreg Roach     * Test new father names
21217d74f3aSGreg Roach     *
21315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
21452348eb8SGreg Roach     *
21552348eb8SGreg Roach     * @return void
216323788f4SGreg Roach     */
217c1010edaSGreg Roach    public function testNewFatherNames()
218c1010edaSGreg Roach    {
219323788f4SGreg Roach        $this->assertSame(
220c1010edaSGreg Roach            [
221c1010edaSGreg Roach                'NAME' => '/White/',
222c1010edaSGreg Roach                'SURN' => 'White',
223c1010edaSGreg Roach            ],
224323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
225323788f4SGreg Roach        );
226323788f4SGreg Roach    }
227323788f4SGreg Roach
228323788f4SGreg Roach    /**
229323788f4SGreg Roach     * Test new mother names
23017d74f3aSGreg Roach     *
23115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
23252348eb8SGreg Roach     *
23352348eb8SGreg Roach     * @return void
234323788f4SGreg Roach     */
235c1010edaSGreg Roach    public function testNewMotherNames()
236c1010edaSGreg Roach    {
237323788f4SGreg Roach        $this->assertSame(
238c1010edaSGreg Roach            [
239c1010edaSGreg Roach                'NAME'   => '//',
240c1010edaSGreg Roach                '_MARNM' => '/White/',
241c1010edaSGreg Roach            ],
242323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
243323788f4SGreg Roach        );
244323788f4SGreg Roach    }
245323788f4SGreg Roach
246323788f4SGreg Roach    /**
247323788f4SGreg Roach     * Test new parent names
24817d74f3aSGreg Roach     *
24915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
25052348eb8SGreg Roach     *
25152348eb8SGreg Roach     * @return void
252323788f4SGreg Roach     */
253c1010edaSGreg Roach    public function testNewParentNames()
254c1010edaSGreg Roach    {
255323788f4SGreg Roach        $this->assertSame(
25613abd6f3SGreg Roach            ['NAME' => '//'],
257323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
258323788f4SGreg Roach        );
259323788f4SGreg Roach    }
260323788f4SGreg Roach
261323788f4SGreg Roach    /**
262323788f4SGreg Roach     * Test new husband names
26317d74f3aSGreg Roach     *
26415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
26552348eb8SGreg Roach     *
26652348eb8SGreg Roach     * @return void
267323788f4SGreg Roach     */
268c1010edaSGreg Roach    public function testNewHusbandNames()
269c1010edaSGreg Roach    {
270323788f4SGreg Roach        $this->assertSame(
27113abd6f3SGreg Roach            ['NAME' => '//'],
272323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
273323788f4SGreg Roach        );
274323788f4SGreg Roach    }
275323788f4SGreg Roach
276323788f4SGreg Roach    /**
277323788f4SGreg Roach     * Test new wife names
27817d74f3aSGreg Roach     *
27915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
28052348eb8SGreg Roach     *
28152348eb8SGreg Roach     * @return void
282323788f4SGreg Roach     */
283c1010edaSGreg Roach    public function testNewWifeNames()
284c1010edaSGreg Roach    {
285323788f4SGreg Roach        $this->assertSame(
286c1010edaSGreg Roach            [
287c1010edaSGreg Roach                'NAME'   => '//',
288c1010edaSGreg Roach                '_MARNM' => '/White/',
289c1010edaSGreg Roach            ],
290323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
291323788f4SGreg Roach        );
292323788f4SGreg Roach    }
293323788f4SGreg Roach
294323788f4SGreg Roach    /**
2955b2de99fSGreg Roach     * Test new wife names
2965b2de99fSGreg Roach     *
29715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
29852348eb8SGreg Roach     *
29952348eb8SGreg Roach     * @return void
3005b2de99fSGreg Roach     */
301c1010edaSGreg Roach    public function testNewWifeNamesWithSpfx()
302c1010edaSGreg Roach    {
3035b2de99fSGreg Roach        $this->assertSame(
304c1010edaSGreg Roach            [
305c1010edaSGreg Roach                'NAME'   => '//',
306c1010edaSGreg Roach                '_MARNM' => '/van der White/',
307c1010edaSGreg Roach            ],
3085b2de99fSGreg Roach            $this->surname_tradition->newSpouseNames('John /van der White/', 'F')
3095b2de99fSGreg Roach        );
3105b2de99fSGreg Roach    }
3115b2de99fSGreg Roach
3125b2de99fSGreg Roach    /**
313323788f4SGreg Roach     * Test new spouse names
31417d74f3aSGreg Roach     *
31515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
31652348eb8SGreg Roach     *
31752348eb8SGreg Roach     * @return void
318323788f4SGreg Roach     */
319c1010edaSGreg Roach    public function testNewSpouseNames()
320c1010edaSGreg Roach    {
321323788f4SGreg Roach        $this->assertSame(
32213abd6f3SGreg Roach            ['NAME' => '//'],
323323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
324323788f4SGreg Roach        );
325323788f4SGreg Roach    }
326323788f4SGreg Roach}
327