xref: /webtrees/tests/app/SurnameTradition/MatrilinealSurnameTraditionTest.php (revision e7f56f2af615447ab1a7646851f88b465ace9e04)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2018 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16declare(strict_types=1);
17
18namespace Fisharebest\Webtrees\SurnameTradition;
19
20use Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition;
21use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
22
23/**
24 * Test harness for the class PatrilinenalSurnameTradition
25 */
26class MatrilinealSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
27{
28    /** @var SurnameTraditionInterface */
29    private $surname_tradition;
30
31    /**
32     * Prepare the environment for these tests
33     *
34     * @return void
35     */
36    public function setUp()
37    {
38        $this->surname_tradition = new MatrilinealSurnameTradition;
39    }
40
41    /**
42     * Test whether married surnames are used
43     *
44     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
45     *
46     * @return void
47     */
48    public function testMarriedSurnames()
49    {
50        $this->assertSame(false, $this->surname_tradition->hasMarriedNames());
51    }
52
53    /**
54     * Test whether surnames are used
55     *
56     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
57     *
58     * @return void
59     */
60    public function testSurnames()
61    {
62        $this->assertSame(true, $this->surname_tradition->hasSurnames());
63    }
64
65    /**
66     * Test new son names
67     *
68     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
69     *
70     * @return void
71     */
72    public function testNewSonNames()
73    {
74        $this->assertSame(
75            [
76                'NAME' => '/Black/',
77                'SURN' => 'Black',
78            ],
79            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
80        );
81    }
82
83    /**
84     * Test new daughter names
85     *
86     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
87     *
88     * @return void
89     */
90    public function testNewDaughterNames()
91    {
92        $this->assertSame(
93            [
94                'NAME' => '/Black/',
95                'SURN' => 'Black',
96            ],
97            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
98        );
99    }
100
101    /**
102     * Test new child names
103     *
104     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
105     *
106     * @return void
107     */
108    public function testNewChildNames()
109    {
110        $this->assertSame(
111            [
112                'NAME' => '/Black/',
113                'SURN' => 'Black',
114            ],
115            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
116        );
117    }
118
119    /**
120     * Test new child names
121     *
122     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
123     *
124     * @return void
125     */
126    public function testNewChildNamesWithSpfx()
127    {
128        $this->assertSame(
129            [
130                'NAME' => '/van Black/',
131                'SPFX' => 'van',
132                'SURN' => 'Black',
133            ],
134            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
135        );
136    }
137
138    /**
139     * Test new child names
140     *
141     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
142     *
143     * @return void
144     */
145    public function testNewChildNamesWithNoParentsNames()
146    {
147        $this->assertSame(
148            ['NAME' => '//'],
149            $this->surname_tradition->newChildNames('', '', 'U')
150        );
151    }
152
153    /**
154     * Test new father names
155     *
156     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
157     *
158     * @return void
159     */
160    public function testNewFatherNames()
161    {
162        $this->assertSame(
163            ['NAME' => '//'],
164            $this->surname_tradition->newParentNames('John /White/', 'M')
165        );
166    }
167
168    /**
169     * Test new mother names
170     *
171     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
172     *
173     * @return void
174     */
175    public function testNewMotherNames()
176    {
177        $this->assertSame(
178            [
179                'NAME' => '/White/',
180                'SURN' => 'White',
181            ],
182            $this->surname_tradition->newParentNames('John /White/', 'F')
183        );
184    }
185
186    /**
187     * Test new parent names
188     *
189     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
190     *
191     * @return void
192     */
193    public function testNewParentNames()
194    {
195        $this->assertSame(
196            ['NAME' => '//'],
197            $this->surname_tradition->newParentNames('John /White/', 'U')
198        );
199    }
200
201    /**
202     * Test new husband names
203     *
204     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
205     *
206     * @return void
207     */
208    public function testNewHusbandNames()
209    {
210        $this->assertSame(
211            ['NAME' => '//'],
212            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
213        );
214    }
215
216    /**
217     * Test new wife names
218     *
219     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
220     *
221     * @return void
222     */
223    public function testNewWifeNames()
224    {
225        $this->assertSame(
226            ['NAME' => '//'],
227            $this->surname_tradition->newSpouseNames('John /White/', 'F')
228        );
229    }
230
231    /**
232     * Test new spouse names
233     *
234     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
235     *
236     * @return void
237     */
238    public function testNewSpouseNames()
239    {
240        $this->assertSame(
241            ['NAME' => '//'],
242            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
243        );
244    }
245}
246