xref: /webtrees/tests/app/SurnameTradition/PortugueseSurnameTraditionTest.php (revision c4943cff72f95a28fbb9404e3c20b169ff098e5c)
1323788f4SGreg Roach<?php
23976b470SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
589f7189bSGreg Roach * Copyright (C) 2021 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
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16323788f4SGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2084e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
21c1010edaSGreg Roach
223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
233cfcc809SGreg Roach
24323788f4SGreg Roach/**
25*c4943cffSGreg Roach * Test harness for the class PortugueseSurnameTradition
26323788f4SGreg Roach */
273cfcc809SGreg Roachclass PortugueseSurnameTraditionTest extends TestCase
28c1010edaSGreg Roach{
29*c4943cffSGreg Roach    private SurnameTraditionInterface $surname_tradition;
30323788f4SGreg Roach
31323788f4SGreg Roach    /**
32323788f4SGreg Roach     * Prepare the environment for these tests
3352348eb8SGreg Roach     *
3452348eb8SGreg Roach     * @return void
35323788f4SGreg Roach     */
365c48bcd6SGreg Roach    protected function setUp(): void
37c1010edaSGreg Roach    {
380115bc16SGreg Roach        parent::setUp();
390115bc16SGreg Roach
4074d6dc0eSGreg Roach        $this->surname_tradition = new PortugueseSurnameTradition();
41323788f4SGreg Roach    }
42323788f4SGreg Roach
43323788f4SGreg Roach    /**
44323788f4SGreg Roach     * Test whether married surnames are used
4517d74f3aSGreg Roach     *
4615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
4752348eb8SGreg Roach     *
4852348eb8SGreg Roach     * @return void
49323788f4SGreg Roach     */
509b802b22SGreg Roach    public function testMarriedSurnames(): void
51c1010edaSGreg Roach    {
525e933c21SGreg Roach        self::assertFalse($this->surname_tradition->hasMarriedNames());
53323788f4SGreg Roach    }
54323788f4SGreg Roach
55323788f4SGreg Roach    /**
56c1ec7145SGreg Roach     * Test whether surnames are used
5717d74f3aSGreg Roach     *
5815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
5952348eb8SGreg Roach     *
6052348eb8SGreg Roach     * @return void
61c1ec7145SGreg Roach     */
629b802b22SGreg Roach    public function testSurnames(): void
63c1010edaSGreg Roach    {
645e933c21SGreg Roach        self::assertTrue($this->surname_tradition->hasSurnames());
65c1ec7145SGreg Roach    }
66c1ec7145SGreg Roach
67c1ec7145SGreg Roach    /**
68323788f4SGreg Roach     * Test new son names
6917d74f3aSGreg Roach     *
7015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
7152348eb8SGreg Roach     *
7252348eb8SGreg Roach     * @return void
73323788f4SGreg Roach     */
749b802b22SGreg Roach    public function testNewSonNames(): void
75c1010edaSGreg Roach    {
765e933c21SGreg Roach        self::assertSame(
77c1010edaSGreg Roach            [
78c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
79c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
80c1010edaSGreg Roach            ],
81323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
82323788f4SGreg Roach        );
83323788f4SGreg Roach    }
84323788f4SGreg Roach
85323788f4SGreg Roach    /**
86323788f4SGreg Roach     * Test new daughter names
8717d74f3aSGreg Roach     *
8815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
8952348eb8SGreg Roach     *
9052348eb8SGreg Roach     * @return void
91323788f4SGreg Roach     */
929b802b22SGreg Roach    public function testNewDaughterNames(): void
93c1010edaSGreg Roach    {
945e933c21SGreg Roach        self::assertSame(
95c1010edaSGreg Roach            [
96c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
97c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
98c1010edaSGreg Roach            ],
99323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
100323788f4SGreg Roach        );
101323788f4SGreg Roach    }
102323788f4SGreg Roach
103323788f4SGreg Roach    /**
104323788f4SGreg Roach     * Test new child names
10517d74f3aSGreg Roach     *
10615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
10752348eb8SGreg Roach     *
10852348eb8SGreg Roach     * @return void
109323788f4SGreg Roach     */
1109b802b22SGreg Roach    public function testNewChildNames(): void
111c1010edaSGreg Roach    {
1125e933c21SGreg Roach        self::assertSame(
113c1010edaSGreg Roach            [
114c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
115c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
116c1010edaSGreg Roach            ],
117323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
118323788f4SGreg Roach        );
119323788f4SGreg Roach    }
120323788f4SGreg Roach
121323788f4SGreg Roach    /**
122323788f4SGreg Roach     * Test new child names
12317d74f3aSGreg Roach     *
12415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
12552348eb8SGreg Roach     *
12652348eb8SGreg Roach     * @return void
127323788f4SGreg Roach     */
1289b802b22SGreg Roach    public function testNewChildNamesWithNoParentsNames(): void
129c1010edaSGreg Roach    {
1305e933c21SGreg Roach        self::assertSame(
131c1010edaSGreg Roach            [
132c1010edaSGreg Roach                'NAME' => '// //',
133c1010edaSGreg Roach                'SURN' => '',
134c1010edaSGreg Roach            ],
1351677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1361677a03aSGreg Roach        );
1371677a03aSGreg Roach    }
1381677a03aSGreg Roach
1391677a03aSGreg Roach    /**
1401677a03aSGreg Roach     * Test new child names
14117d74f3aSGreg Roach     *
14215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
14352348eb8SGreg Roach     *
14452348eb8SGreg Roach     * @return void
1451677a03aSGreg Roach     */
1469b802b22SGreg Roach    public function testNewChildNamesCompunds(): void
147c1010edaSGreg Roach    {
1485e933c21SGreg Roach        self::assertSame(
149c1010edaSGreg Roach            [
150c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
151c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
152c1010edaSGreg Roach            ],
153323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M')
154323788f4SGreg Roach        );
1555e933c21SGreg Roach        self::assertSame(
156c1010edaSGreg Roach            [
157c1010edaSGreg Roach                'NAME' => '/Iglesias/ /Lorca/',
158c1010edaSGreg Roach                'SURN' => 'Iglesias,Lorca',
159c1010edaSGreg Roach            ],
160323788f4SGreg Roach            $this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M')
161323788f4SGreg Roach        );
162323788f4SGreg Roach    }
163323788f4SGreg Roach
164323788f4SGreg Roach    /**
165323788f4SGreg Roach     * Test new father names
16617d74f3aSGreg Roach     *
16715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
16852348eb8SGreg Roach     *
16952348eb8SGreg Roach     * @return void
170323788f4SGreg Roach     */
1719b802b22SGreg Roach    public function testNewFatherNames(): void
172c1010edaSGreg Roach    {
1735e933c21SGreg Roach        self::assertSame(
174c1010edaSGreg Roach            [
175c1010edaSGreg Roach                'NAME' => '// /Garcia/',
176c1010edaSGreg Roach                'SURN' => 'Garcia',
177c1010edaSGreg Roach            ],
178323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M')
179323788f4SGreg Roach        );
180323788f4SGreg Roach    }
181323788f4SGreg Roach
182323788f4SGreg Roach    /**
183323788f4SGreg Roach     * Test new mother names
18417d74f3aSGreg Roach     *
18515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
18652348eb8SGreg Roach     *
18752348eb8SGreg Roach     * @return void
188323788f4SGreg Roach     */
1899b802b22SGreg Roach    public function testNewMotherNames(): void
190c1010edaSGreg Roach    {
1915e933c21SGreg Roach        self::assertSame(
192c1010edaSGreg Roach            [
193c1010edaSGreg Roach                'NAME' => '// /Iglesias/',
194c1010edaSGreg Roach                'SURN' => 'Iglesias',
195c1010edaSGreg Roach            ],
196323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F')
197323788f4SGreg Roach        );
198323788f4SGreg Roach    }
199323788f4SGreg Roach
200323788f4SGreg Roach    /**
201323788f4SGreg Roach     * Test new parent names
20217d74f3aSGreg Roach     *
20315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
20452348eb8SGreg Roach     *
20552348eb8SGreg Roach     * @return void
206323788f4SGreg Roach     */
2079b802b22SGreg Roach    public function testNewParentNames(): void
208c1010edaSGreg Roach    {
2095e933c21SGreg Roach        self::assertSame(
21013abd6f3SGreg Roach            ['NAME' => '// //'],
211323788f4SGreg Roach            $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U')
212323788f4SGreg Roach        );
213323788f4SGreg Roach    }
214323788f4SGreg Roach
215323788f4SGreg Roach    /**
216323788f4SGreg Roach     * Test new husband names
21717d74f3aSGreg Roach     *
21815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
21952348eb8SGreg Roach     *
22052348eb8SGreg Roach     * @return void
221323788f4SGreg Roach     */
2229b802b22SGreg Roach    public function testNewHusbandNames(): void
223c1010edaSGreg Roach    {
2245e933c21SGreg Roach        self::assertSame(
22513abd6f3SGreg Roach            ['NAME' => '// //'],
226323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M')
227323788f4SGreg Roach        );
228323788f4SGreg Roach    }
229323788f4SGreg Roach
230323788f4SGreg Roach    /**
231323788f4SGreg Roach     * Test new wife names
23217d74f3aSGreg Roach     *
23315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
23452348eb8SGreg Roach     *
23552348eb8SGreg Roach     * @return void
236323788f4SGreg Roach     */
2379b802b22SGreg Roach    public function testNewWifeNames(): void
238c1010edaSGreg Roach    {
2395e933c21SGreg Roach        self::assertSame(
24013abd6f3SGreg Roach            ['NAME' => '// //'],
241323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F')
242323788f4SGreg Roach        );
243323788f4SGreg Roach    }
244323788f4SGreg Roach
245323788f4SGreg Roach    /**
246323788f4SGreg Roach     * Test new spouse names
24717d74f3aSGreg Roach     *
24815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition
24952348eb8SGreg Roach     *
25052348eb8SGreg Roach     * @return void
251323788f4SGreg Roach     */
2529b802b22SGreg Roach    public function testNewSpouseNames(): void
253c1010edaSGreg Roach    {
2545e933c21SGreg Roach        self::assertSame(
25513abd6f3SGreg Roach            ['NAME' => '// //'],
256323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U')
257323788f4SGreg Roach        );
258323788f4SGreg Roach    }
259323788f4SGreg Roach}
260