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