xref: /webtrees/tests/app/SurnameTradition/PortugueseSurnameTraditionTest.php (revision c1010eda29c0909ed4d5d463f32d32bfefdd4dfe)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
51062a142SGreg Roach * Copyright (C) 2018 webtrees development team
6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9323788f4SGreg Roach * (at your option) any later version.
10323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13323788f4SGreg Roach * GNU General Public License for more details.
14323788f4SGreg Roach * You should have received a copy of the GNU General Public License
15323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16323788f4SGreg Roach */
17*c1010edaSGreg Roach
18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition;
19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
20323788f4SGreg Roach
21323788f4SGreg Roach/**
22323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition
23323788f4SGreg Roach */
24*c1010edaSGreg Roachclass PortugueseSurnameTraditionTest extends \PHPUnit\Framework\TestCase
25*c1010edaSGreg Roach{
26323788f4SGreg Roach    /** @var SurnameTraditionInterface */
27323788f4SGreg Roach    private $surname_tradition;
28323788f4SGreg Roach
29323788f4SGreg Roach    /**
30323788f4SGreg Roach     * Prepare the environment for these tests
31323788f4SGreg Roach     */
32*c1010edaSGreg Roach    public function setUp()
33*c1010edaSGreg Roach    {
34323788f4SGreg Roach        $this->surname_tradition = new PortugueseSurnameTradition;
35323788f4SGreg Roach    }
36323788f4SGreg Roach
37323788f4SGreg Roach    /**
38323788f4SGreg Roach     * Test whether married surnames are used
3917d74f3aSGreg Roach     *
4015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
41323788f4SGreg Roach     */
42*c1010edaSGreg Roach    public function testMarriedSurnames()
43*c1010edaSGreg Roach    {
44323788f4SGreg Roach        $this->assertSame(false, $this->surname_tradition->hasMarriedNames());
45323788f4SGreg Roach    }
46323788f4SGreg Roach
47323788f4SGreg Roach    /**
48c1ec7145SGreg Roach     * Test whether surnames are used
4917d74f3aSGreg Roach     *
5015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
51c1ec7145SGreg Roach     */
52*c1010edaSGreg Roach    public function testSurnames()
53*c1010edaSGreg Roach    {
54c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
55c1ec7145SGreg Roach    }
56c1ec7145SGreg Roach
57c1ec7145SGreg Roach    /**
58323788f4SGreg Roach     * Test new son names
5917d74f3aSGreg Roach     *
6015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
61323788f4SGreg Roach     */
62*c1010edaSGreg Roach    public function testNewSonNames()
63*c1010edaSGreg Roach    {
64323788f4SGreg Roach        $this->assertSame(
65*c1010edaSGreg Roach            [
66*c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
67*c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
68*c1010edaSGreg Roach            ],
69323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
70323788f4SGreg Roach        );
71323788f4SGreg Roach    }
72323788f4SGreg Roach
73323788f4SGreg Roach    /**
74323788f4SGreg Roach     * Test new daughter names
7517d74f3aSGreg Roach     *
7615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
77323788f4SGreg Roach     */
78*c1010edaSGreg Roach    public function testNewDaughterNames()
79*c1010edaSGreg Roach    {
80323788f4SGreg Roach        $this->assertSame(
81*c1010edaSGreg Roach            [
82*c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
83*c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
84*c1010edaSGreg Roach            ],
85323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
86323788f4SGreg Roach        );
87323788f4SGreg Roach    }
88323788f4SGreg Roach
89323788f4SGreg Roach    /**
90323788f4SGreg Roach     * Test new child names
9117d74f3aSGreg Roach     *
9215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
93323788f4SGreg Roach     */
94*c1010edaSGreg Roach    public function testNewChildNames()
95*c1010edaSGreg Roach    {
96323788f4SGreg Roach        $this->assertSame(
97*c1010edaSGreg Roach            [
98*c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
99*c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
100*c1010edaSGreg Roach            ],
101323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
102323788f4SGreg Roach        );
103323788f4SGreg Roach    }
104323788f4SGreg Roach
105323788f4SGreg Roach    /**
106323788f4SGreg Roach     * Test new child names
10717d74f3aSGreg Roach     *
10815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
109323788f4SGreg Roach     */
110*c1010edaSGreg Roach    public function testNewChildNamesWithNoParentsNames()
111*c1010edaSGreg Roach    {
1121677a03aSGreg Roach        $this->assertSame(
113*c1010edaSGreg Roach            [
114*c1010edaSGreg Roach                'NAME' => '// //',
115*c1010edaSGreg Roach                'SURN' => '',
116*c1010edaSGreg Roach            ],
1171677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1181677a03aSGreg Roach        );
1191677a03aSGreg Roach    }
1201677a03aSGreg Roach
1211677a03aSGreg Roach    /**
1221677a03aSGreg Roach     * Test new child names
12317d74f3aSGreg Roach     *
12415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
1251677a03aSGreg Roach     */
126*c1010edaSGreg Roach    public function testNewChildNamesCompunds()
127*c1010edaSGreg Roach    {
128323788f4SGreg Roach        $this->assertSame(
129*c1010edaSGreg Roach            [
130*c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
131*c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
132*c1010edaSGreg Roach            ],
133323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M')
134323788f4SGreg Roach        );
135323788f4SGreg Roach        $this->assertSame(
136*c1010edaSGreg Roach            [
137*c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
138*c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
139*c1010edaSGreg Roach            ],
140323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M')
141323788f4SGreg Roach        );
142323788f4SGreg Roach    }
143323788f4SGreg Roach
144323788f4SGreg Roach    /**
145323788f4SGreg Roach     * Test new father names
14617d74f3aSGreg Roach     *
14715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
148323788f4SGreg Roach     */
149*c1010edaSGreg Roach    public function testNewFatherNames()
150*c1010edaSGreg Roach    {
151323788f4SGreg Roach        $this->assertSame(
152*c1010edaSGreg Roach            [
153*c1010edaSGreg Roach                'NAME' => '// /Garcia/',
154*c1010edaSGreg Roach                'SURN' => 'Garcia',
155*c1010edaSGreg Roach            ],
156323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M')
157323788f4SGreg Roach        );
158323788f4SGreg Roach    }
159323788f4SGreg Roach
160323788f4SGreg Roach    /**
161323788f4SGreg Roach     * Test new mother names
16217d74f3aSGreg Roach     *
16315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
164323788f4SGreg Roach     */
165*c1010edaSGreg Roach    public function testNewMotherNames()
166*c1010edaSGreg Roach    {
167323788f4SGreg Roach        $this->assertSame(
168*c1010edaSGreg Roach            [
169*c1010edaSGreg Roach                'NAME' => '// /Iglesias/',
170*c1010edaSGreg Roach                'SURN' => 'Iglesias',
171*c1010edaSGreg Roach            ],
172323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F')
173323788f4SGreg Roach        );
174323788f4SGreg Roach    }
175323788f4SGreg Roach
176323788f4SGreg Roach    /**
177323788f4SGreg Roach     * Test new parent names
17817d74f3aSGreg Roach     *
17915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
180323788f4SGreg Roach     */
181*c1010edaSGreg Roach    public function testNewParentNames()
182*c1010edaSGreg Roach    {
183323788f4SGreg Roach        $this->assertSame(
18413abd6f3SGreg Roach            ['NAME' => '// //'],
185323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U')
186323788f4SGreg Roach        );
187323788f4SGreg Roach    }
188323788f4SGreg Roach
189323788f4SGreg Roach    /**
190323788f4SGreg Roach     * Test new husband names
19117d74f3aSGreg Roach     *
19215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
193323788f4SGreg Roach     */
194*c1010edaSGreg Roach    public function testNewHusbandNames()
195*c1010edaSGreg Roach    {
196323788f4SGreg Roach        $this->assertSame(
19713abd6f3SGreg Roach            ['NAME' => '// //'],
198323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M')
199323788f4SGreg Roach        );
200323788f4SGreg Roach    }
201323788f4SGreg Roach
202323788f4SGreg Roach    /**
203323788f4SGreg Roach     * Test new wife names
20417d74f3aSGreg Roach     *
20515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
206323788f4SGreg Roach     */
207*c1010edaSGreg Roach    public function testNewWifeNames()
208*c1010edaSGreg Roach    {
209323788f4SGreg Roach        $this->assertSame(
21013abd6f3SGreg Roach            ['NAME' => '// //'],
211323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F')
212323788f4SGreg Roach        );
213323788f4SGreg Roach    }
214323788f4SGreg Roach
215323788f4SGreg Roach    /**
216323788f4SGreg Roach     * Test new spouse names
21717d74f3aSGreg Roach     *
21815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
219323788f4SGreg Roach     */
220*c1010edaSGreg Roach    public function testNewSpouseNames()
221*c1010edaSGreg Roach    {
222323788f4SGreg Roach        $this->assertSame(
22313abd6f3SGreg Roach            ['NAME' => '// //'],
224323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U')
225323788f4SGreg Roach        );
226323788f4SGreg Roach    }
227323788f4SGreg Roach}
228