xref: /webtrees/tests/app/SurnameTradition/PaternalSurnameTraditionTest.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\PaternalSurnameTradition;
19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
20323788f4SGreg Roach
21323788f4SGreg Roach/**
22323788f4SGreg Roach * Test harness for the class PaternalSurnameTradition
23323788f4SGreg Roach */
2484e2cf4eSGreg Roachclass PaternalSurnameTraditionTest 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 PaternalSurnameTradition;
37323788f4SGreg Roach    }
38323788f4SGreg Roach
39323788f4SGreg Roach    /**
40323788f4SGreg Roach     * Test whether married surnames are used
4117d74f3aSGreg Roach     *
4215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
43*52348eb8SGreg Roach     *
44*52348eb8SGreg Roach     * @return void
45323788f4SGreg Roach     */
46c1010edaSGreg Roach    public function testMarriedSurnames()
47c1010edaSGreg Roach    {
48323788f4SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasMarriedNames());
49323788f4SGreg Roach    }
50323788f4SGreg Roach
51323788f4SGreg Roach    /**
52c1ec7145SGreg Roach     * Test whether surnames are used
5317d74f3aSGreg Roach     *
5415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
55*52348eb8SGreg Roach     *
56*52348eb8SGreg Roach     * @return void
57c1ec7145SGreg Roach     */
58c1010edaSGreg Roach    public function testSurnames()
59c1010edaSGreg Roach    {
60c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
61c1ec7145SGreg Roach    }
62c1ec7145SGreg Roach
63c1ec7145SGreg Roach    /**
64323788f4SGreg Roach     * Test new son names
6517d74f3aSGreg Roach     *
6615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
67*52348eb8SGreg Roach     *
68*52348eb8SGreg Roach     * @return void
69323788f4SGreg Roach     */
70c1010edaSGreg Roach    public function testNewSonNames()
71c1010edaSGreg Roach    {
72323788f4SGreg Roach        $this->assertSame(
73c1010edaSGreg Roach            [
74c1010edaSGreg Roach                'NAME' => '/White/',
75c1010edaSGreg Roach                'SURN' => 'White',
76c1010edaSGreg Roach            ],
77323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
78323788f4SGreg Roach        );
79323788f4SGreg Roach    }
80323788f4SGreg Roach
81323788f4SGreg Roach    /**
82323788f4SGreg Roach     * Test new daughter names
8317d74f3aSGreg Roach     *
8415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
85*52348eb8SGreg Roach     *
86*52348eb8SGreg Roach     * @return void
87323788f4SGreg Roach     */
88c1010edaSGreg Roach    public function testNewDaughterNames()
89c1010edaSGreg Roach    {
90323788f4SGreg Roach        $this->assertSame(
91c1010edaSGreg Roach            [
92c1010edaSGreg Roach                'NAME' => '/White/',
93c1010edaSGreg Roach                'SURN' => 'White',
94c1010edaSGreg Roach            ],
95323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
96323788f4SGreg Roach        );
97323788f4SGreg Roach    }
98323788f4SGreg Roach
99323788f4SGreg Roach    /**
100323788f4SGreg Roach     * Test new child names
10117d74f3aSGreg Roach     *
10215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
103*52348eb8SGreg Roach     *
104*52348eb8SGreg Roach     * @return void
105323788f4SGreg Roach     */
106c1010edaSGreg Roach    public function testNewChildNames()
107c1010edaSGreg Roach    {
108323788f4SGreg Roach        $this->assertSame(
109c1010edaSGreg Roach            [
110c1010edaSGreg Roach                'NAME' => '/White/',
111c1010edaSGreg Roach                'SURN' => 'White',
112c1010edaSGreg Roach            ],
113323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
114323788f4SGreg Roach        );
115323788f4SGreg Roach    }
116323788f4SGreg Roach
117323788f4SGreg Roach    /**
118323788f4SGreg Roach     * Test new child names
11917d74f3aSGreg Roach     *
12015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
121*52348eb8SGreg Roach     *
122*52348eb8SGreg Roach     * @return void
123323788f4SGreg Roach     */
124c1010edaSGreg Roach    public function testNewChildNamesWithSpfx()
125c1010edaSGreg Roach    {
126323788f4SGreg Roach        $this->assertSame(
127c1010edaSGreg Roach            [
128c1010edaSGreg Roach                'NAME' => '/de White/',
129c1010edaSGreg Roach                'SPFX' => 'de',
130c1010edaSGreg Roach                'SURN' => 'White',
131c1010edaSGreg Roach            ],
132323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
133323788f4SGreg Roach        );
134323788f4SGreg Roach    }
135323788f4SGreg Roach
136323788f4SGreg Roach    /**
1378caf8226SGreg Roach     * Test new child names
1388caf8226SGreg Roach     *
13915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
140*52348eb8SGreg Roach     *
141*52348eb8SGreg Roach     * @return void
1428caf8226SGreg Roach     */
143c1010edaSGreg Roach    public function testNewChildNamesWithMultipleSpfx()
144c1010edaSGreg Roach    {
1458caf8226SGreg Roach        $this->assertSame(
146c1010edaSGreg Roach            [
147c1010edaSGreg Roach                'NAME' => '/van der White/',
148c1010edaSGreg Roach                'SPFX' => 'van der',
149c1010edaSGreg Roach                'SURN' => 'White',
150c1010edaSGreg Roach            ],
1518caf8226SGreg Roach            $this->surname_tradition->newChildNames('John /van der White/', 'Mary /van Black/', 'U')
1528caf8226SGreg Roach        );
1538caf8226SGreg Roach    }
1548caf8226SGreg Roach
1558caf8226SGreg Roach    /**
1569797fe2eSGreg Roach     * Test new child names
1579797fe2eSGreg Roach     *
15815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
159*52348eb8SGreg Roach     *
160*52348eb8SGreg Roach     * @return void
1619797fe2eSGreg Roach     */
162c1010edaSGreg Roach    public function testNewChildNamesWithDutchSpfx()
163c1010edaSGreg Roach    {
1649797fe2eSGreg Roach        $this->assertSame(
165c1010edaSGreg Roach            [
166c1010edaSGreg Roach                'NAME' => '/\'t White/',
167c1010edaSGreg Roach                'SPFX' => '\'t',
168c1010edaSGreg Roach                'SURN' => 'White',
169c1010edaSGreg Roach            ],
1709797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /\'t White/', 'Mary /van Black/', 'U')
1719797fe2eSGreg Roach        );
1729797fe2eSGreg Roach        $this->assertSame(
173c1010edaSGreg Roach            [
174c1010edaSGreg Roach                'NAME' => '/’t White/',
175c1010edaSGreg Roach                'SPFX' => '’t',
176c1010edaSGreg Roach                'SURN' => 'White',
177c1010edaSGreg Roach            ],
1789797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /’t White/', 'Mary /van Black/', 'U')
1799797fe2eSGreg Roach        );
1809797fe2eSGreg Roach    }
1819797fe2eSGreg Roach
1829797fe2eSGreg Roach    /**
1839797fe2eSGreg Roach     * Test new child names
1849797fe2eSGreg Roach     *
18515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
186*52348eb8SGreg Roach     *
187*52348eb8SGreg Roach     * @return void
1889797fe2eSGreg Roach     */
189c1010edaSGreg Roach    public function testNewChildNamesWithMultipleDutchSpfx()
190c1010edaSGreg Roach    {
1919797fe2eSGreg Roach        $this->assertSame(
192c1010edaSGreg Roach            [
193c1010edaSGreg Roach                'NAME' => '/van \'t White/',
194c1010edaSGreg Roach                'SPFX' => 'van \'t',
195c1010edaSGreg Roach                'SURN' => 'White',
196c1010edaSGreg Roach            ],
1979797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /van \'t White/', 'Mary /van Black/', 'U')
1989797fe2eSGreg Roach        );
1999797fe2eSGreg Roach        $this->assertSame(
200c1010edaSGreg Roach            [
201c1010edaSGreg Roach                'NAME' => '/van ’t White/',
202c1010edaSGreg Roach                'SPFX' => 'van ’t',
203c1010edaSGreg Roach                'SURN' => 'White',
204c1010edaSGreg Roach            ],
2059797fe2eSGreg Roach            $this->surname_tradition->newChildNames('John /van ’t White/', 'Mary /van Black/', 'U')
2069797fe2eSGreg Roach        );
2079797fe2eSGreg Roach    }
2089797fe2eSGreg Roach
2099797fe2eSGreg Roach    /**
210323788f4SGreg Roach     * Test new father names
21117d74f3aSGreg Roach     *
21215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
213*52348eb8SGreg Roach     *
214*52348eb8SGreg Roach     * @return void
215323788f4SGreg Roach     */
216c1010edaSGreg Roach    public function testNewFatherNames()
217c1010edaSGreg Roach    {
218323788f4SGreg Roach        $this->assertSame(
219c1010edaSGreg Roach            [
220c1010edaSGreg Roach                'NAME' => '/White/',
221c1010edaSGreg Roach                'SURN' => 'White',
222c1010edaSGreg Roach            ],
223323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
224323788f4SGreg Roach        );
225323788f4SGreg Roach    }
226323788f4SGreg Roach
227323788f4SGreg Roach    /**
228323788f4SGreg Roach     * Test new mother names
22917d74f3aSGreg Roach     *
23015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
231*52348eb8SGreg Roach     *
232*52348eb8SGreg Roach     * @return void
233323788f4SGreg Roach     */
234c1010edaSGreg Roach    public function testNewMotherNames()
235c1010edaSGreg Roach    {
236323788f4SGreg Roach        $this->assertSame(
237c1010edaSGreg Roach            [
238c1010edaSGreg Roach                'NAME'   => '//',
239c1010edaSGreg Roach                '_MARNM' => '/White/',
240c1010edaSGreg Roach            ],
241323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
242323788f4SGreg Roach        );
243323788f4SGreg Roach    }
244323788f4SGreg Roach
245323788f4SGreg Roach    /**
246323788f4SGreg Roach     * Test new parent names
24717d74f3aSGreg Roach     *
24815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
249*52348eb8SGreg Roach     *
250*52348eb8SGreg Roach     * @return void
251323788f4SGreg Roach     */
252c1010edaSGreg Roach    public function testNewParentNames()
253c1010edaSGreg Roach    {
254323788f4SGreg Roach        $this->assertSame(
25513abd6f3SGreg Roach            ['NAME' => '//'],
256323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
257323788f4SGreg Roach        );
258323788f4SGreg Roach    }
259323788f4SGreg Roach
260323788f4SGreg Roach    /**
261323788f4SGreg Roach     * Test new husband names
26217d74f3aSGreg Roach     *
26315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
264*52348eb8SGreg Roach     *
265*52348eb8SGreg Roach     * @return void
266323788f4SGreg Roach     */
267c1010edaSGreg Roach    public function testNewHusbandNames()
268c1010edaSGreg Roach    {
269323788f4SGreg Roach        $this->assertSame(
27013abd6f3SGreg Roach            ['NAME' => '//'],
271323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
272323788f4SGreg Roach        );
273323788f4SGreg Roach    }
274323788f4SGreg Roach
275323788f4SGreg Roach    /**
276323788f4SGreg Roach     * Test new wife names
27717d74f3aSGreg Roach     *
27815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
279*52348eb8SGreg Roach     *
280*52348eb8SGreg Roach     * @return void
281323788f4SGreg Roach     */
282c1010edaSGreg Roach    public function testNewWifeNames()
283c1010edaSGreg Roach    {
284323788f4SGreg Roach        $this->assertSame(
285c1010edaSGreg Roach            [
286c1010edaSGreg Roach                'NAME'   => '//',
287c1010edaSGreg Roach                '_MARNM' => '/White/',
288c1010edaSGreg Roach            ],
289323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
290323788f4SGreg Roach        );
291323788f4SGreg Roach    }
292323788f4SGreg Roach
293323788f4SGreg Roach    /**
2945b2de99fSGreg Roach     * Test new wife names
2955b2de99fSGreg Roach     *
29615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
297*52348eb8SGreg Roach     *
298*52348eb8SGreg Roach     * @return void
2995b2de99fSGreg Roach     */
300c1010edaSGreg Roach    public function testNewWifeNamesWithSpfx()
301c1010edaSGreg Roach    {
3025b2de99fSGreg Roach        $this->assertSame(
303c1010edaSGreg Roach            [
304c1010edaSGreg Roach                'NAME'   => '//',
305c1010edaSGreg Roach                '_MARNM' => '/van der White/',
306c1010edaSGreg Roach            ],
3075b2de99fSGreg Roach            $this->surname_tradition->newSpouseNames('John /van der White/', 'F')
3085b2de99fSGreg Roach        );
3095b2de99fSGreg Roach    }
3105b2de99fSGreg Roach
3115b2de99fSGreg Roach    /**
312323788f4SGreg Roach     * Test new spouse names
31317d74f3aSGreg Roach     *
31415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition
315*52348eb8SGreg Roach     *
316*52348eb8SGreg Roach     * @return void
317323788f4SGreg Roach     */
318c1010edaSGreg Roach    public function testNewSpouseNames()
319c1010edaSGreg Roach    {
320323788f4SGreg Roach        $this->assertSame(
32113abd6f3SGreg Roach            ['NAME' => '//'],
322323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
323323788f4SGreg Roach        );
324323788f4SGreg Roach    }
325323788f4SGreg Roach}
326