xref: /webtrees/tests/app/SurnameTradition/MatrilinealSurnameTraditionTest.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\MatrilinealSurnameTradition;
19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
20323788f4SGreg Roach
21323788f4SGreg Roach/**
22323788f4SGreg Roach * Test harness for the class PatrilinenalSurnameTradition
23323788f4SGreg Roach */
2484e2cf4eSGreg Roachclass MatrilinealSurnameTraditionTest 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 MatrilinealSurnameTradition;
37323788f4SGreg Roach    }
38323788f4SGreg Roach
39323788f4SGreg Roach    /**
40323788f4SGreg Roach     * Test whether married surnames are used
4117d74f3aSGreg Roach     *
4215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
43*52348eb8SGreg Roach     *
44*52348eb8SGreg Roach     * @return void
45323788f4SGreg Roach     */
46c1010edaSGreg Roach    public function testMarriedSurnames()
47c1010edaSGreg Roach    {
48323788f4SGreg Roach        $this->assertSame(false, $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\MatrilinealSurnameTradition
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\MatrilinealSurnameTradition
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' => '/Black/',
75c1010edaSGreg Roach                'SURN' => 'Black',
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\MatrilinealSurnameTradition
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' => '/Black/',
93c1010edaSGreg Roach                'SURN' => 'Black',
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\MatrilinealSurnameTradition
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' => '/Black/',
111c1010edaSGreg Roach                'SURN' => 'Black',
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\MatrilinealSurnameTradition
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' => '/van Black/',
129c1010edaSGreg Roach                'SPFX' => 'van',
130c1010edaSGreg Roach                'SURN' => 'Black',
131c1010edaSGreg Roach            ],
132323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
133323788f4SGreg Roach        );
134323788f4SGreg Roach    }
135323788f4SGreg Roach
136323788f4SGreg Roach    /**
1371677a03aSGreg Roach     * Test new child names
13817d74f3aSGreg Roach     *
13915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
140*52348eb8SGreg Roach     *
141*52348eb8SGreg Roach     * @return void
1421677a03aSGreg Roach     */
143c1010edaSGreg Roach    public function testNewChildNamesWithNoParentsNames()
144c1010edaSGreg Roach    {
1451677a03aSGreg Roach        $this->assertSame(
14613abd6f3SGreg Roach            ['NAME' => '//'],
1471677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1481677a03aSGreg Roach        );
1491677a03aSGreg Roach    }
1501677a03aSGreg Roach
1511677a03aSGreg Roach    /**
152323788f4SGreg Roach     * Test new father names
15317d74f3aSGreg Roach     *
15415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
155*52348eb8SGreg Roach     *
156*52348eb8SGreg Roach     * @return void
157323788f4SGreg Roach     */
158c1010edaSGreg Roach    public function testNewFatherNames()
159c1010edaSGreg Roach    {
160323788f4SGreg Roach        $this->assertSame(
16113abd6f3SGreg Roach            ['NAME' => '//'],
162323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
163323788f4SGreg Roach        );
164323788f4SGreg Roach    }
165323788f4SGreg Roach
166323788f4SGreg Roach    /**
167323788f4SGreg Roach     * Test new mother names
16817d74f3aSGreg Roach     *
16915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
170*52348eb8SGreg Roach     *
171*52348eb8SGreg Roach     * @return void
172323788f4SGreg Roach     */
173c1010edaSGreg Roach    public function testNewMotherNames()
174c1010edaSGreg Roach    {
175323788f4SGreg Roach        $this->assertSame(
176c1010edaSGreg Roach            [
177c1010edaSGreg Roach                'NAME' => '/White/',
178c1010edaSGreg Roach                'SURN' => 'White',
179c1010edaSGreg Roach            ],
180323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
181323788f4SGreg Roach        );
182323788f4SGreg Roach    }
183323788f4SGreg Roach
184323788f4SGreg Roach    /**
185323788f4SGreg Roach     * Test new parent names
18617d74f3aSGreg Roach     *
18715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
188*52348eb8SGreg Roach     *
189*52348eb8SGreg Roach     * @return void
190323788f4SGreg Roach     */
191c1010edaSGreg Roach    public function testNewParentNames()
192c1010edaSGreg Roach    {
193323788f4SGreg Roach        $this->assertSame(
19413abd6f3SGreg Roach            ['NAME' => '//'],
195323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
196323788f4SGreg Roach        );
197323788f4SGreg Roach    }
198323788f4SGreg Roach
199323788f4SGreg Roach    /**
200323788f4SGreg Roach     * Test new husband names
20117d74f3aSGreg Roach     *
20215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
203*52348eb8SGreg Roach     *
204*52348eb8SGreg Roach     * @return void
205323788f4SGreg Roach     */
206c1010edaSGreg Roach    public function testNewHusbandNames()
207c1010edaSGreg Roach    {
208323788f4SGreg Roach        $this->assertSame(
20913abd6f3SGreg Roach            ['NAME' => '//'],
210323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
211323788f4SGreg Roach        );
212323788f4SGreg Roach    }
213323788f4SGreg Roach
214323788f4SGreg Roach    /**
215323788f4SGreg Roach     * Test new wife names
21617d74f3aSGreg Roach     *
21715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
218*52348eb8SGreg Roach     *
219*52348eb8SGreg Roach     * @return void
220323788f4SGreg Roach     */
221c1010edaSGreg Roach    public function testNewWifeNames()
222c1010edaSGreg Roach    {
223323788f4SGreg Roach        $this->assertSame(
22413abd6f3SGreg Roach            ['NAME' => '//'],
225323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
226323788f4SGreg Roach        );
227323788f4SGreg Roach    }
228323788f4SGreg Roach
229323788f4SGreg Roach    /**
230323788f4SGreg Roach     * Test new spouse names
23117d74f3aSGreg Roach     *
23215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
233*52348eb8SGreg Roach     *
234*52348eb8SGreg Roach     * @return void
235323788f4SGreg Roach     */
236c1010edaSGreg Roach    public function testNewSpouseNames()
237c1010edaSGreg Roach    {
238323788f4SGreg Roach        $this->assertSame(
23913abd6f3SGreg Roach            ['NAME' => '//'],
240323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
241323788f4SGreg Roach        );
242323788f4SGreg Roach    }
243323788f4SGreg Roach}
244