xref: /webtrees/tests/app/SurnameTradition/MatrilinealSurnameTraditionTest.php (revision 3976b4703df669696105ed6b024b96d433c8fbdb)
1323788f4SGreg Roach<?php
2*3976b470SGreg 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 */
17e7f56f2aSGreg Roachdeclare(strict_types=1);
18e7f56f2aSGreg Roach
1984e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
20c1010edaSGreg Roach
21323788f4SGreg Roach/**
22323788f4SGreg Roach * Test harness for the class PatrilinenalSurnameTradition
23323788f4SGreg Roach */
2484e2cf4eSGreg Roachclass MatrilinealSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
25c1010edaSGreg Roach{
26323788f4SGreg Roach    /** @var SurnameTraditionInterface */
27323788f4SGreg Roach    private $surname_tradition;
28323788f4SGreg Roach
29323788f4SGreg Roach    /**
30323788f4SGreg Roach     * Prepare the environment for these tests
3152348eb8SGreg Roach     *
3252348eb8SGreg Roach     * @return void
33323788f4SGreg Roach     */
345c48bcd6SGreg Roach    protected function setUp(): void
35c1010edaSGreg Roach    {
360115bc16SGreg Roach        parent::setUp();
370115bc16SGreg Roach
3874d6dc0eSGreg Roach        $this->surname_tradition = new MatrilinealSurnameTradition();
39323788f4SGreg Roach    }
40323788f4SGreg Roach
41323788f4SGreg Roach    /**
42323788f4SGreg Roach     * Test whether married surnames are used
4317d74f3aSGreg Roach     *
4415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
4552348eb8SGreg Roach     *
4652348eb8SGreg Roach     * @return void
47323788f4SGreg Roach     */
489b802b22SGreg Roach    public function testMarriedSurnames(): void
49c1010edaSGreg Roach    {
50a32e6421SGreg Roach        $this->assertFalse($this->surname_tradition->hasMarriedNames());
51323788f4SGreg Roach    }
52323788f4SGreg Roach
53323788f4SGreg Roach    /**
54c1ec7145SGreg Roach     * Test whether surnames are used
5517d74f3aSGreg Roach     *
5615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
5752348eb8SGreg Roach     *
5852348eb8SGreg Roach     * @return void
59c1ec7145SGreg Roach     */
609b802b22SGreg Roach    public function testSurnames(): void
61c1010edaSGreg Roach    {
62a32e6421SGreg Roach        $this->assertTrue($this->surname_tradition->hasSurnames());
63c1ec7145SGreg Roach    }
64c1ec7145SGreg Roach
65c1ec7145SGreg Roach    /**
66323788f4SGreg Roach     * Test new son names
6717d74f3aSGreg Roach     *
6815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
6952348eb8SGreg Roach     *
7052348eb8SGreg Roach     * @return void
71323788f4SGreg Roach     */
729b802b22SGreg Roach    public function testNewSonNames(): void
73c1010edaSGreg Roach    {
74323788f4SGreg Roach        $this->assertSame(
75c1010edaSGreg Roach            [
76c1010edaSGreg Roach                'NAME' => '/Black/',
77c1010edaSGreg Roach                'SURN' => 'Black',
78c1010edaSGreg Roach            ],
79323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
80323788f4SGreg Roach        );
81323788f4SGreg Roach    }
82323788f4SGreg Roach
83323788f4SGreg Roach    /**
84323788f4SGreg Roach     * Test new daughter names
8517d74f3aSGreg Roach     *
8615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
8752348eb8SGreg Roach     *
8852348eb8SGreg Roach     * @return void
89323788f4SGreg Roach     */
909b802b22SGreg Roach    public function testNewDaughterNames(): void
91c1010edaSGreg Roach    {
92323788f4SGreg Roach        $this->assertSame(
93c1010edaSGreg Roach            [
94c1010edaSGreg Roach                'NAME' => '/Black/',
95c1010edaSGreg Roach                'SURN' => 'Black',
96c1010edaSGreg Roach            ],
97323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
98323788f4SGreg Roach        );
99323788f4SGreg Roach    }
100323788f4SGreg Roach
101323788f4SGreg Roach    /**
102323788f4SGreg Roach     * Test new child names
10317d74f3aSGreg Roach     *
10415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
10552348eb8SGreg Roach     *
10652348eb8SGreg Roach     * @return void
107323788f4SGreg Roach     */
1089b802b22SGreg Roach    public function testNewChildNames(): void
109c1010edaSGreg Roach    {
110323788f4SGreg Roach        $this->assertSame(
111c1010edaSGreg Roach            [
112c1010edaSGreg Roach                'NAME' => '/Black/',
113c1010edaSGreg Roach                'SURN' => 'Black',
114c1010edaSGreg Roach            ],
115323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
116323788f4SGreg Roach        );
117323788f4SGreg Roach    }
118323788f4SGreg Roach
119323788f4SGreg Roach    /**
120323788f4SGreg Roach     * Test new child names
12117d74f3aSGreg Roach     *
12215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
12352348eb8SGreg Roach     *
12452348eb8SGreg Roach     * @return void
125323788f4SGreg Roach     */
1269b802b22SGreg Roach    public function testNewChildNamesWithSpfx(): void
127c1010edaSGreg Roach    {
128323788f4SGreg Roach        $this->assertSame(
129c1010edaSGreg Roach            [
130c1010edaSGreg Roach                'NAME' => '/van Black/',
131c1010edaSGreg Roach                'SPFX' => 'van',
132c1010edaSGreg Roach                'SURN' => 'Black',
133c1010edaSGreg Roach            ],
134323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
135323788f4SGreg Roach        );
136323788f4SGreg Roach    }
137323788f4SGreg Roach
138323788f4SGreg Roach    /**
1391677a03aSGreg Roach     * Test new child names
14017d74f3aSGreg Roach     *
14115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
14252348eb8SGreg Roach     *
14352348eb8SGreg Roach     * @return void
1441677a03aSGreg Roach     */
1459b802b22SGreg Roach    public function testNewChildNamesWithNoParentsNames(): void
146c1010edaSGreg Roach    {
1471677a03aSGreg Roach        $this->assertSame(
14813abd6f3SGreg Roach            ['NAME' => '//'],
1491677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1501677a03aSGreg Roach        );
1511677a03aSGreg Roach    }
1521677a03aSGreg Roach
1531677a03aSGreg Roach    /**
154323788f4SGreg Roach     * Test new father names
15517d74f3aSGreg Roach     *
15615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
15752348eb8SGreg Roach     *
15852348eb8SGreg Roach     * @return void
159323788f4SGreg Roach     */
1609b802b22SGreg Roach    public function testNewFatherNames(): void
161c1010edaSGreg Roach    {
162323788f4SGreg Roach        $this->assertSame(
16313abd6f3SGreg Roach            ['NAME' => '//'],
164323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
165323788f4SGreg Roach        );
166323788f4SGreg Roach    }
167323788f4SGreg Roach
168323788f4SGreg Roach    /**
169323788f4SGreg Roach     * Test new mother names
17017d74f3aSGreg Roach     *
17115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
17252348eb8SGreg Roach     *
17352348eb8SGreg Roach     * @return void
174323788f4SGreg Roach     */
1759b802b22SGreg Roach    public function testNewMotherNames(): void
176c1010edaSGreg Roach    {
177323788f4SGreg Roach        $this->assertSame(
178c1010edaSGreg Roach            [
179c1010edaSGreg Roach                'NAME' => '/White/',
180c1010edaSGreg Roach                'SURN' => 'White',
181c1010edaSGreg Roach            ],
182323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
183323788f4SGreg Roach        );
184323788f4SGreg Roach    }
185323788f4SGreg Roach
186323788f4SGreg Roach    /**
187323788f4SGreg Roach     * Test new parent names
18817d74f3aSGreg Roach     *
18915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
19052348eb8SGreg Roach     *
19152348eb8SGreg Roach     * @return void
192323788f4SGreg Roach     */
1939b802b22SGreg Roach    public function testNewParentNames(): void
194c1010edaSGreg Roach    {
195323788f4SGreg Roach        $this->assertSame(
19613abd6f3SGreg Roach            ['NAME' => '//'],
197323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
198323788f4SGreg Roach        );
199323788f4SGreg Roach    }
200323788f4SGreg Roach
201323788f4SGreg Roach    /**
202323788f4SGreg Roach     * Test new husband names
20317d74f3aSGreg Roach     *
20415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
20552348eb8SGreg Roach     *
20652348eb8SGreg Roach     * @return void
207323788f4SGreg Roach     */
2089b802b22SGreg Roach    public function testNewHusbandNames(): void
209c1010edaSGreg Roach    {
210323788f4SGreg Roach        $this->assertSame(
21113abd6f3SGreg Roach            ['NAME' => '//'],
212323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
213323788f4SGreg Roach        );
214323788f4SGreg Roach    }
215323788f4SGreg Roach
216323788f4SGreg Roach    /**
217323788f4SGreg Roach     * Test new wife names
21817d74f3aSGreg Roach     *
21915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
22052348eb8SGreg Roach     *
22152348eb8SGreg Roach     * @return void
222323788f4SGreg Roach     */
2239b802b22SGreg Roach    public function testNewWifeNames(): void
224c1010edaSGreg Roach    {
225323788f4SGreg Roach        $this->assertSame(
22613abd6f3SGreg Roach            ['NAME' => '//'],
227323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
228323788f4SGreg Roach        );
229323788f4SGreg Roach    }
230323788f4SGreg Roach
231323788f4SGreg Roach    /**
232323788f4SGreg Roach     * Test new spouse names
23317d74f3aSGreg Roach     *
23415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
23552348eb8SGreg Roach     *
23652348eb8SGreg Roach     * @return void
237323788f4SGreg Roach     */
2389b802b22SGreg Roach    public function testNewSpouseNames(): void
239c1010edaSGreg Roach    {
240323788f4SGreg Roach        $this->assertSame(
24113abd6f3SGreg Roach            ['NAME' => '//'],
242323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
243323788f4SGreg Roach        );
244323788f4SGreg Roach    }
245323788f4SGreg Roach}
246