xref: /webtrees/tests/app/SurnameTradition/PaternalSurnameTraditionTest.php (revision e7f56f2af615447ab1a7646851f88b465ace9e04)
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 */
16*e7f56f2aSGreg Roachdeclare(strict_types=1);
17*e7f56f2aSGreg Roach
1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
19c1010edaSGreg Roach
20323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition;
21323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
22323788f4SGreg Roach
23323788f4SGreg Roach/**
24323788f4SGreg Roach * Test harness for the class PaternalSurnameTradition
25323788f4SGreg Roach */
2684e2cf4eSGreg Roachclass PaternalSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
27c1010edaSGreg Roach{
28323788f4SGreg Roach    /** @var SurnameTraditionInterface */
29323788f4SGreg Roach    private $surname_tradition;
30323788f4SGreg Roach
31323788f4SGreg Roach    /**
32323788f4SGreg Roach     * Prepare the environment for these tests
3352348eb8SGreg Roach     *
3452348eb8SGreg Roach     * @return void
35323788f4SGreg Roach     */
36c1010edaSGreg Roach    public function setUp()
37c1010edaSGreg Roach    {
38323788f4SGreg Roach        $this->surname_tradition = new PaternalSurnameTradition;
39323788f4SGreg Roach    }
40323788f4SGreg Roach
41323788f4SGreg Roach    /**
42323788f4SGreg Roach     * Test whether married surnames are used
4317d74f3aSGreg Roach     *
4415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
4552348eb8SGreg Roach     *
4652348eb8SGreg Roach     * @return void
47323788f4SGreg Roach     */
48c1010edaSGreg Roach    public function testMarriedSurnames()
49c1010edaSGreg Roach    {
50323788f4SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasMarriedNames());
51323788f4SGreg Roach    }
52323788f4SGreg Roach
53323788f4SGreg Roach    /**
54c1ec7145SGreg Roach     * Test whether surnames are used
5517d74f3aSGreg Roach     *
5615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
5752348eb8SGreg Roach     *
5852348eb8SGreg 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\PaternalSurnameTradition
6952348eb8SGreg Roach     *
7052348eb8SGreg Roach     * @return void
71323788f4SGreg Roach     */
72c1010edaSGreg Roach    public function testNewSonNames()
73c1010edaSGreg Roach    {
74323788f4SGreg Roach        $this->assertSame(
75c1010edaSGreg Roach            [
76c1010edaSGreg Roach                'NAME' => '/White/',
77c1010edaSGreg Roach                'SURN' => 'White',
78c1010edaSGreg Roach            ],
79323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
80323788f4SGreg Roach        );
81323788f4SGreg Roach    }
82323788f4SGreg Roach
83323788f4SGreg Roach    /**
84323788f4SGreg Roach     * Test new daughter names
8517d74f3aSGreg Roach     *
8615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
8752348eb8SGreg Roach     *
8852348eb8SGreg Roach     * @return void
89323788f4SGreg Roach     */
90c1010edaSGreg Roach    public function testNewDaughterNames()
91c1010edaSGreg Roach    {
92323788f4SGreg Roach        $this->assertSame(
93c1010edaSGreg Roach            [
94c1010edaSGreg Roach                'NAME' => '/White/',
95c1010edaSGreg Roach                'SURN' => 'White',
96c1010edaSGreg Roach            ],
97323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
98323788f4SGreg Roach        );
99323788f4SGreg Roach    }
100323788f4SGreg Roach
101323788f4SGreg Roach    /**
102323788f4SGreg Roach     * Test new child names
10317d74f3aSGreg Roach     *
10415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
10552348eb8SGreg Roach     *
10652348eb8SGreg Roach     * @return void
107323788f4SGreg Roach     */
108c1010edaSGreg Roach    public function testNewChildNames()
109c1010edaSGreg Roach    {
110323788f4SGreg Roach        $this->assertSame(
111c1010edaSGreg Roach            [
112c1010edaSGreg Roach                'NAME' => '/White/',
113c1010edaSGreg Roach                'SURN' => 'White',
114c1010edaSGreg Roach            ],
115323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
116323788f4SGreg Roach        );
117323788f4SGreg Roach    }
118323788f4SGreg Roach
119323788f4SGreg Roach    /**
120323788f4SGreg Roach     * Test new child names
12117d74f3aSGreg Roach     *
12215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
12352348eb8SGreg Roach     *
12452348eb8SGreg Roach     * @return void
125323788f4SGreg Roach     */
126c1010edaSGreg Roach    public function testNewChildNamesWithSpfx()
127c1010edaSGreg Roach    {
128323788f4SGreg Roach        $this->assertSame(
129c1010edaSGreg Roach            [
130c1010edaSGreg Roach                'NAME' => '/de White/',
131c1010edaSGreg Roach                'SPFX' => 'de',
132c1010edaSGreg Roach                'SURN' => 'White',
133c1010edaSGreg Roach            ],
134323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
135323788f4SGreg Roach        );
136323788f4SGreg Roach    }
137323788f4SGreg Roach
138323788f4SGreg Roach    /**
1398caf8226SGreg Roach     * Test new child names
1408caf8226SGreg Roach     *
14115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
14252348eb8SGreg Roach     *
14352348eb8SGreg Roach     * @return void
1448caf8226SGreg Roach     */
145c1010edaSGreg Roach    public function testNewChildNamesWithMultipleSpfx()
146c1010edaSGreg Roach    {
1478caf8226SGreg Roach        $this->assertSame(
148c1010edaSGreg Roach            [
149c1010edaSGreg Roach                'NAME' => '/van der White/',
150c1010edaSGreg Roach                'SPFX' => 'van der',
151c1010edaSGreg Roach                'SURN' => 'White',
152c1010edaSGreg Roach            ],
1538caf8226SGreg Roach            $this->surname_tradition->newChildNames('John /van der White/', 'Mary /van Black/', 'U')
1548caf8226SGreg Roach        );
1558caf8226SGreg Roach    }
1568caf8226SGreg Roach
1578caf8226SGreg Roach    /**
1589797fe2eSGreg Roach     * Test new child names
1599797fe2eSGreg Roach     *
16015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
16152348eb8SGreg Roach     *
16252348eb8SGreg Roach     * @return void
1639797fe2eSGreg Roach     */
164c1010edaSGreg Roach    public function testNewChildNamesWithDutchSpfx()
165c1010edaSGreg Roach    {
1669797fe2eSGreg Roach        $this->assertSame(
167c1010edaSGreg Roach            [
168c1010edaSGreg Roach                'NAME' => '/\'t White/',
169c1010edaSGreg Roach                'SPFX' => '\'t',
170c1010edaSGreg Roach                'SURN' => 'White',
171c1010edaSGreg Roach            ],
1729797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /\'t White/', 'Mary /van Black/', 'U')
1739797fe2eSGreg Roach        );
1749797fe2eSGreg Roach        $this->assertSame(
175c1010edaSGreg Roach            [
176c1010edaSGreg Roach                'NAME' => '/’t White/',
177c1010edaSGreg Roach                'SPFX' => '’t',
178c1010edaSGreg Roach                'SURN' => 'White',
179c1010edaSGreg Roach            ],
1809797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /’t White/', 'Mary /van Black/', 'U')
1819797fe2eSGreg Roach        );
1829797fe2eSGreg Roach    }
1839797fe2eSGreg Roach
1849797fe2eSGreg Roach    /**
1859797fe2eSGreg Roach     * Test new child names
1869797fe2eSGreg Roach     *
18715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
18852348eb8SGreg Roach     *
18952348eb8SGreg Roach     * @return void
1909797fe2eSGreg Roach     */
191c1010edaSGreg Roach    public function testNewChildNamesWithMultipleDutchSpfx()
192c1010edaSGreg Roach    {
1939797fe2eSGreg Roach        $this->assertSame(
194c1010edaSGreg Roach            [
195c1010edaSGreg Roach                'NAME' => '/van \'t White/',
196c1010edaSGreg Roach                'SPFX' => 'van \'t',
197c1010edaSGreg Roach                'SURN' => 'White',
198c1010edaSGreg Roach            ],
1999797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /van \'t White/', 'Mary /van Black/', 'U')
2009797fe2eSGreg Roach        );
2019797fe2eSGreg Roach        $this->assertSame(
202c1010edaSGreg Roach            [
203c1010edaSGreg Roach                'NAME' => '/van ’t White/',
204c1010edaSGreg Roach                'SPFX' => 'van ’t',
205c1010edaSGreg Roach                'SURN' => 'White',
206c1010edaSGreg Roach            ],
2079797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /van ’t White/', 'Mary /van Black/', 'U')
2089797fe2eSGreg Roach        );
2099797fe2eSGreg Roach    }
2109797fe2eSGreg Roach
2119797fe2eSGreg Roach    /**
212323788f4SGreg Roach     * Test new father names
21317d74f3aSGreg Roach     *
21415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
21552348eb8SGreg Roach     *
21652348eb8SGreg Roach     * @return void
217323788f4SGreg Roach     */
218c1010edaSGreg Roach    public function testNewFatherNames()
219c1010edaSGreg Roach    {
220323788f4SGreg Roach        $this->assertSame(
221c1010edaSGreg Roach            [
222c1010edaSGreg Roach                'NAME' => '/White/',
223c1010edaSGreg Roach                'SURN' => 'White',
224c1010edaSGreg Roach            ],
225323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
226323788f4SGreg Roach        );
227323788f4SGreg Roach    }
228323788f4SGreg Roach
229323788f4SGreg Roach    /**
230323788f4SGreg Roach     * Test new mother names
23117d74f3aSGreg Roach     *
23215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
23352348eb8SGreg Roach     *
23452348eb8SGreg Roach     * @return void
235323788f4SGreg Roach     */
236c1010edaSGreg Roach    public function testNewMotherNames()
237c1010edaSGreg Roach    {
238323788f4SGreg Roach        $this->assertSame(
239c1010edaSGreg Roach            [
240c1010edaSGreg Roach                'NAME'   => '//',
241c1010edaSGreg Roach                '_MARNM' => '/White/',
242c1010edaSGreg Roach            ],
243323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
244323788f4SGreg Roach        );
245323788f4SGreg Roach    }
246323788f4SGreg Roach
247323788f4SGreg Roach    /**
248323788f4SGreg Roach     * Test new parent names
24917d74f3aSGreg Roach     *
25015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
25152348eb8SGreg Roach     *
25252348eb8SGreg Roach     * @return void
253323788f4SGreg Roach     */
254c1010edaSGreg Roach    public function testNewParentNames()
255c1010edaSGreg Roach    {
256323788f4SGreg Roach        $this->assertSame(
25713abd6f3SGreg Roach            ['NAME' => '//'],
258323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
259323788f4SGreg Roach        );
260323788f4SGreg Roach    }
261323788f4SGreg Roach
262323788f4SGreg Roach    /**
263323788f4SGreg Roach     * Test new husband names
26417d74f3aSGreg Roach     *
26515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
26652348eb8SGreg Roach     *
26752348eb8SGreg Roach     * @return void
268323788f4SGreg Roach     */
269c1010edaSGreg Roach    public function testNewHusbandNames()
270c1010edaSGreg Roach    {
271323788f4SGreg Roach        $this->assertSame(
27213abd6f3SGreg Roach            ['NAME' => '//'],
273323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
274323788f4SGreg Roach        );
275323788f4SGreg Roach    }
276323788f4SGreg Roach
277323788f4SGreg Roach    /**
278323788f4SGreg Roach     * Test new wife names
27917d74f3aSGreg Roach     *
28015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
28152348eb8SGreg Roach     *
28252348eb8SGreg Roach     * @return void
283323788f4SGreg Roach     */
284c1010edaSGreg Roach    public function testNewWifeNames()
285c1010edaSGreg Roach    {
286323788f4SGreg Roach        $this->assertSame(
287c1010edaSGreg Roach            [
288c1010edaSGreg Roach                'NAME'   => '//',
289c1010edaSGreg Roach                '_MARNM' => '/White/',
290c1010edaSGreg Roach            ],
291323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
292323788f4SGreg Roach        );
293323788f4SGreg Roach    }
294323788f4SGreg Roach
295323788f4SGreg Roach    /**
2965b2de99fSGreg Roach     * Test new wife names
2975b2de99fSGreg Roach     *
29815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
29952348eb8SGreg Roach     *
30052348eb8SGreg Roach     * @return void
3015b2de99fSGreg Roach     */
302c1010edaSGreg Roach    public function testNewWifeNamesWithSpfx()
303c1010edaSGreg Roach    {
3045b2de99fSGreg Roach        $this->assertSame(
305c1010edaSGreg Roach            [
306c1010edaSGreg Roach                'NAME'   => '//',
307c1010edaSGreg Roach                '_MARNM' => '/van der White/',
308c1010edaSGreg Roach            ],
3095b2de99fSGreg Roach            $this->surname_tradition->newSpouseNames('John /van der White/', 'F')
3105b2de99fSGreg Roach        );
3115b2de99fSGreg Roach    }
3125b2de99fSGreg Roach
3135b2de99fSGreg Roach    /**
314323788f4SGreg Roach     * Test new spouse names
31517d74f3aSGreg Roach     *
31615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
31752348eb8SGreg Roach     *
31852348eb8SGreg Roach     * @return void
319323788f4SGreg Roach     */
320c1010edaSGreg Roach    public function testNewSpouseNames()
321c1010edaSGreg Roach    {
322323788f4SGreg Roach        $this->assertSame(
32313abd6f3SGreg Roach            ['NAME' => '//'],
324323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
325323788f4SGreg Roach        );
326323788f4SGreg Roach    }
327323788f4SGreg Roach}
328