xref: /webtrees/tests/app/SurnameTradition/MatrilinealSurnameTraditionTest.php (revision 5254a68afb63ebac346daaa82fe6970d5b34961b)
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 */
16namespace Fisharebest\Webtrees\SurnameTradition;
17
18use Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition;
19use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
20
21/**
22 * Test harness for the class PatrilinenalSurnameTradition
23 */
24class MatrilinealSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
25{
26    /** @var SurnameTraditionInterface */
27    private $surname_tradition;
28
29    /**
30     * Prepare the environment for these tests
31     */
32    public function setUp()
33    {
34        $this->surname_tradition = new MatrilinealSurnameTradition;
35    }
36
37    /**
38     * Test whether married surnames are used
39     *
40     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
41     */
42    public function testMarriedSurnames()
43    {
44        $this->assertSame(false, $this->surname_tradition->hasMarriedNames());
45    }
46
47    /**
48     * Test whether surnames are used
49     *
50     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
51     */
52    public function testSurnames()
53    {
54        $this->assertSame(true, $this->surname_tradition->hasSurnames());
55    }
56
57    /**
58     * Test new son names
59     *
60     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
61     */
62    public function testNewSonNames()
63    {
64        $this->assertSame(
65            [
66                'NAME' => '/Black/',
67                'SURN' => 'Black',
68            ],
69            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
70        );
71    }
72
73    /**
74     * Test new daughter names
75     *
76     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
77     */
78    public function testNewDaughterNames()
79    {
80        $this->assertSame(
81            [
82                'NAME' => '/Black/',
83                'SURN' => 'Black',
84            ],
85            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
86        );
87    }
88
89    /**
90     * Test new child names
91     *
92     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
93     */
94    public function testNewChildNames()
95    {
96        $this->assertSame(
97            [
98                'NAME' => '/Black/',
99                'SURN' => 'Black',
100            ],
101            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
102        );
103    }
104
105    /**
106     * Test new child names
107     *
108     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
109     */
110    public function testNewChildNamesWithSpfx()
111    {
112        $this->assertSame(
113            [
114                'NAME' => '/van Black/',
115                'SPFX' => 'van',
116                'SURN' => 'Black',
117            ],
118            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
119        );
120    }
121
122    /**
123     * Test new child names
124     *
125     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
126     */
127    public function testNewChildNamesWithNoParentsNames()
128    {
129        $this->assertSame(
130            ['NAME' => '//'],
131            $this->surname_tradition->newChildNames('', '', 'U')
132        );
133    }
134
135    /**
136     * Test new father names
137     *
138     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
139     */
140    public function testNewFatherNames()
141    {
142        $this->assertSame(
143            ['NAME' => '//'],
144            $this->surname_tradition->newParentNames('John /White/', 'M')
145        );
146    }
147
148    /**
149     * Test new mother names
150     *
151     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
152     */
153    public function testNewMotherNames()
154    {
155        $this->assertSame(
156            [
157                'NAME' => '/White/',
158                'SURN' => 'White',
159            ],
160            $this->surname_tradition->newParentNames('John /White/', 'F')
161        );
162    }
163
164    /**
165     * Test new parent names
166     *
167     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
168     */
169    public function testNewParentNames()
170    {
171        $this->assertSame(
172            ['NAME' => '//'],
173            $this->surname_tradition->newParentNames('John /White/', 'U')
174        );
175    }
176
177    /**
178     * Test new husband names
179     *
180     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
181     */
182    public function testNewHusbandNames()
183    {
184        $this->assertSame(
185            ['NAME' => '//'],
186            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
187        );
188    }
189
190    /**
191     * Test new wife names
192     *
193     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
194     */
195    public function testNewWifeNames()
196    {
197        $this->assertSame(
198            ['NAME' => '//'],
199            $this->surname_tradition->newSpouseNames('John /White/', 'F')
200        );
201    }
202
203    /**
204     * Test new spouse names
205     *
206     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
207     */
208    public function testNewSpouseNames()
209    {
210        $this->assertSame(
211            ['NAME' => '//'],
212            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
213        );
214    }
215}
216