xref: /webtrees/tests/app/SurnameTradition/PortugueseSurnameTraditionTest.php (revision fcfa147e10aaa6c7ff580c29bd6e5b88666befc1)
1323788f4SGreg Roach<?php
23976b470SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 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*fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2084e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
21c1010edaSGreg Roach
223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
233cfcc809SGreg Roach
24323788f4SGreg Roach/**
25323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition
26323788f4SGreg Roach */
273cfcc809SGreg Roachclass PortugueseSurnameTraditionTest extends TestCase
28c1010edaSGreg Roach{
29323788f4SGreg Roach    /** @var SurnameTraditionInterface */
30323788f4SGreg Roach    private $surname_tradition;
31323788f4SGreg Roach
32323788f4SGreg Roach    /**
33323788f4SGreg Roach     * Prepare the environment for these tests
3452348eb8SGreg Roach     *
3552348eb8SGreg Roach     * @return void
36323788f4SGreg Roach     */
375c48bcd6SGreg Roach    protected function setUp(): void
38c1010edaSGreg Roach    {
390115bc16SGreg Roach        parent::setUp();
400115bc16SGreg Roach
4174d6dc0eSGreg Roach        $this->surname_tradition = new PortugueseSurnameTradition();
42323788f4SGreg Roach    }
43323788f4SGreg Roach
44323788f4SGreg Roach    /**
45323788f4SGreg Roach     * Test whether married surnames are used
4617d74f3aSGreg Roach     *
4715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
4852348eb8SGreg Roach     *
4952348eb8SGreg Roach     * @return void
50323788f4SGreg Roach     */
519b802b22SGreg Roach    public function testMarriedSurnames(): void
52c1010edaSGreg Roach    {
53a32e6421SGreg Roach        $this->assertFalse($this->surname_tradition->hasMarriedNames());
54323788f4SGreg Roach    }
55323788f4SGreg Roach
56323788f4SGreg Roach    /**
57c1ec7145SGreg Roach     * Test whether surnames are used
5817d74f3aSGreg Roach     *
5915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
6052348eb8SGreg Roach     *
6152348eb8SGreg Roach     * @return void
62c1ec7145SGreg Roach     */
639b802b22SGreg Roach    public function testSurnames(): void
64c1010edaSGreg Roach    {
65a32e6421SGreg Roach        $this->assertTrue($this->surname_tradition->hasSurnames());
66c1ec7145SGreg Roach    }
67c1ec7145SGreg Roach
68c1ec7145SGreg Roach    /**
69323788f4SGreg Roach     * Test new son names
7017d74f3aSGreg Roach     *
7115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
7252348eb8SGreg Roach     *
7352348eb8SGreg Roach     * @return void
74323788f4SGreg Roach     */
759b802b22SGreg Roach    public function testNewSonNames(): void
76c1010edaSGreg Roach    {
77323788f4SGreg Roach        $this->assertSame(
78c1010edaSGreg Roach            [
79c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
80c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
81c1010edaSGreg Roach            ],
82323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
83323788f4SGreg Roach        );
84323788f4SGreg Roach    }
85323788f4SGreg Roach
86323788f4SGreg Roach    /**
87323788f4SGreg Roach     * Test new daughter names
8817d74f3aSGreg Roach     *
8915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
9052348eb8SGreg Roach     *
9152348eb8SGreg Roach     * @return void
92323788f4SGreg Roach     */
939b802b22SGreg Roach    public function testNewDaughterNames(): void
94c1010edaSGreg Roach    {
95323788f4SGreg Roach        $this->assertSame(
96c1010edaSGreg Roach            [
97c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
98c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
99c1010edaSGreg Roach            ],
100323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
101323788f4SGreg Roach        );
102323788f4SGreg Roach    }
103323788f4SGreg Roach
104323788f4SGreg Roach    /**
105323788f4SGreg Roach     * Test new child names
10617d74f3aSGreg Roach     *
10715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
10852348eb8SGreg Roach     *
10952348eb8SGreg Roach     * @return void
110323788f4SGreg Roach     */
1119b802b22SGreg Roach    public function testNewChildNames(): void
112c1010edaSGreg Roach    {
113323788f4SGreg Roach        $this->assertSame(
114c1010edaSGreg Roach            [
115c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
116c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
117c1010edaSGreg Roach            ],
118323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
119323788f4SGreg Roach        );
120323788f4SGreg Roach    }
121323788f4SGreg Roach
122323788f4SGreg Roach    /**
123323788f4SGreg Roach     * Test new child names
12417d74f3aSGreg Roach     *
12515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
12652348eb8SGreg Roach     *
12752348eb8SGreg Roach     * @return void
128323788f4SGreg Roach     */
1299b802b22SGreg Roach    public function testNewChildNamesWithNoParentsNames(): void
130c1010edaSGreg Roach    {
1311677a03aSGreg Roach        $this->assertSame(
132c1010edaSGreg Roach            [
133c1010edaSGreg Roach                'NAME' => '// //',
134c1010edaSGreg Roach                'SURN' => '',
135c1010edaSGreg Roach            ],
1361677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1371677a03aSGreg Roach        );
1381677a03aSGreg Roach    }
1391677a03aSGreg Roach
1401677a03aSGreg Roach    /**
1411677a03aSGreg Roach     * Test new child names
14217d74f3aSGreg Roach     *
14315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
14452348eb8SGreg Roach     *
14552348eb8SGreg Roach     * @return void
1461677a03aSGreg Roach     */
1479b802b22SGreg Roach    public function testNewChildNamesCompunds(): void
148c1010edaSGreg Roach    {
149323788f4SGreg Roach        $this->assertSame(
150c1010edaSGreg Roach            [
151c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
152c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
153c1010edaSGreg Roach            ],
154323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M')
155323788f4SGreg Roach        );
156323788f4SGreg Roach        $this->assertSame(
157c1010edaSGreg Roach            [
158c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
159c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
160c1010edaSGreg Roach            ],
161323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M')
162323788f4SGreg Roach        );
163323788f4SGreg Roach    }
164323788f4SGreg Roach
165323788f4SGreg Roach    /**
166323788f4SGreg Roach     * Test new father names
16717d74f3aSGreg Roach     *
16815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
16952348eb8SGreg Roach     *
17052348eb8SGreg Roach     * @return void
171323788f4SGreg Roach     */
1729b802b22SGreg Roach    public function testNewFatherNames(): void
173c1010edaSGreg Roach    {
174323788f4SGreg Roach        $this->assertSame(
175c1010edaSGreg Roach            [
176c1010edaSGreg Roach                'NAME' => '// /Garcia/',
177c1010edaSGreg Roach                'SURN' => 'Garcia',
178c1010edaSGreg Roach            ],
179323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M')
180323788f4SGreg Roach        );
181323788f4SGreg Roach    }
182323788f4SGreg Roach
183323788f4SGreg Roach    /**
184323788f4SGreg Roach     * Test new mother names
18517d74f3aSGreg Roach     *
18615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
18752348eb8SGreg Roach     *
18852348eb8SGreg Roach     * @return void
189323788f4SGreg Roach     */
1909b802b22SGreg Roach    public function testNewMotherNames(): void
191c1010edaSGreg Roach    {
192323788f4SGreg Roach        $this->assertSame(
193c1010edaSGreg Roach            [
194c1010edaSGreg Roach                'NAME' => '// /Iglesias/',
195c1010edaSGreg Roach                'SURN' => 'Iglesias',
196c1010edaSGreg Roach            ],
197323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F')
198323788f4SGreg Roach        );
199323788f4SGreg Roach    }
200323788f4SGreg Roach
201323788f4SGreg Roach    /**
202323788f4SGreg Roach     * Test new parent names
20317d74f3aSGreg Roach     *
20415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
20552348eb8SGreg Roach     *
20652348eb8SGreg Roach     * @return void
207323788f4SGreg Roach     */
2089b802b22SGreg Roach    public function testNewParentNames(): void
209c1010edaSGreg Roach    {
210323788f4SGreg Roach        $this->assertSame(
21113abd6f3SGreg Roach            ['NAME' => '// //'],
212323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U')
213323788f4SGreg Roach        );
214323788f4SGreg Roach    }
215323788f4SGreg Roach
216323788f4SGreg Roach    /**
217323788f4SGreg Roach     * Test new husband names
21817d74f3aSGreg Roach     *
21915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
22052348eb8SGreg Roach     *
22152348eb8SGreg Roach     * @return void
222323788f4SGreg Roach     */
2239b802b22SGreg Roach    public function testNewHusbandNames(): void
224c1010edaSGreg Roach    {
225323788f4SGreg Roach        $this->assertSame(
22613abd6f3SGreg Roach            ['NAME' => '// //'],
227323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M')
228323788f4SGreg Roach        );
229323788f4SGreg Roach    }
230323788f4SGreg Roach
231323788f4SGreg Roach    /**
232323788f4SGreg Roach     * Test new wife names
23317d74f3aSGreg Roach     *
23415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
23552348eb8SGreg Roach     *
23652348eb8SGreg Roach     * @return void
237323788f4SGreg Roach     */
2389b802b22SGreg Roach    public function testNewWifeNames(): void
239c1010edaSGreg Roach    {
240323788f4SGreg Roach        $this->assertSame(
24113abd6f3SGreg Roach            ['NAME' => '// //'],
242323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F')
243323788f4SGreg Roach        );
244323788f4SGreg Roach    }
245323788f4SGreg Roach
246323788f4SGreg Roach    /**
247323788f4SGreg Roach     * Test new spouse names
24817d74f3aSGreg Roach     *
24915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
25052348eb8SGreg Roach     *
25152348eb8SGreg Roach     * @return void
252323788f4SGreg Roach     */
2539b802b22SGreg Roach    public function testNewSpouseNames(): void
254c1010edaSGreg Roach    {
255323788f4SGreg Roach        $this->assertSame(
25613abd6f3SGreg Roach            ['NAME' => '// //'],
257323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U')
258323788f4SGreg Roach        );
259323788f4SGreg Roach    }
260323788f4SGreg Roach}
261