xref: /webtrees/tests/app/SurnameTradition/MatrilinealSurnameTraditionTest.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\MatrilinealSurnameTradition;
19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
20323788f4SGreg Roach
21323788f4SGreg Roach/**
22323788f4SGreg Roach * Test harness for the class PatrilinenalSurnameTradition
23323788f4SGreg Roach */
24*c1010edaSGreg Roachclass MatrilinealSurnameTraditionTest 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 MatrilinealSurnameTradition;
35323788f4SGreg Roach    }
36323788f4SGreg Roach
37323788f4SGreg Roach    /**
38323788f4SGreg Roach     * Test whether married surnames are used
3917d74f3aSGreg Roach     *
4015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
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\MatrilinealSurnameTradition
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\MatrilinealSurnameTradition
61323788f4SGreg Roach     */
62*c1010edaSGreg Roach    public function testNewSonNames()
63*c1010edaSGreg Roach    {
64323788f4SGreg Roach        $this->assertSame(
65*c1010edaSGreg Roach            [
66*c1010edaSGreg Roach                'NAME' => '/Black/',
67*c1010edaSGreg Roach                'SURN' => 'Black',
68*c1010edaSGreg Roach            ],
69323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
70323788f4SGreg Roach        );
71323788f4SGreg Roach    }
72323788f4SGreg Roach
73323788f4SGreg Roach    /**
74323788f4SGreg Roach     * Test new daughter names
7517d74f3aSGreg Roach     *
7615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
77323788f4SGreg Roach     */
78*c1010edaSGreg Roach    public function testNewDaughterNames()
79*c1010edaSGreg Roach    {
80323788f4SGreg Roach        $this->assertSame(
81*c1010edaSGreg Roach            [
82*c1010edaSGreg Roach                'NAME' => '/Black/',
83*c1010edaSGreg Roach                'SURN' => 'Black',
84*c1010edaSGreg Roach            ],
85323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
86323788f4SGreg Roach        );
87323788f4SGreg Roach    }
88323788f4SGreg Roach
89323788f4SGreg Roach    /**
90323788f4SGreg Roach     * Test new child names
9117d74f3aSGreg Roach     *
9215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
93323788f4SGreg Roach     */
94*c1010edaSGreg Roach    public function testNewChildNames()
95*c1010edaSGreg Roach    {
96323788f4SGreg Roach        $this->assertSame(
97*c1010edaSGreg Roach            [
98*c1010edaSGreg Roach                'NAME' => '/Black/',
99*c1010edaSGreg Roach                'SURN' => 'Black',
100*c1010edaSGreg Roach            ],
101323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
102323788f4SGreg Roach        );
103323788f4SGreg Roach    }
104323788f4SGreg Roach
105323788f4SGreg Roach    /**
106323788f4SGreg Roach     * Test new child names
10717d74f3aSGreg Roach     *
10815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
109323788f4SGreg Roach     */
110*c1010edaSGreg Roach    public function testNewChildNamesWithSpfx()
111*c1010edaSGreg Roach    {
112323788f4SGreg Roach        $this->assertSame(
113*c1010edaSGreg Roach            [
114*c1010edaSGreg Roach                'NAME' => '/van Black/',
115*c1010edaSGreg Roach                'SPFX' => 'van',
116*c1010edaSGreg Roach                'SURN' => 'Black',
117*c1010edaSGreg Roach            ],
118323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
119323788f4SGreg Roach        );
120323788f4SGreg Roach    }
121323788f4SGreg Roach
122323788f4SGreg Roach    /**
1231677a03aSGreg Roach     * Test new child names
12417d74f3aSGreg Roach     *
12515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
1261677a03aSGreg Roach     */
127*c1010edaSGreg Roach    public function testNewChildNamesWithNoParentsNames()
128*c1010edaSGreg Roach    {
1291677a03aSGreg Roach        $this->assertSame(
13013abd6f3SGreg Roach            ['NAME' => '//'],
1311677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1321677a03aSGreg Roach        );
1331677a03aSGreg Roach    }
1341677a03aSGreg Roach
1351677a03aSGreg Roach    /**
136323788f4SGreg Roach     * Test new father names
13717d74f3aSGreg Roach     *
13815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
139323788f4SGreg Roach     */
140*c1010edaSGreg Roach    public function testNewFatherNames()
141*c1010edaSGreg Roach    {
142323788f4SGreg Roach        $this->assertSame(
14313abd6f3SGreg Roach            ['NAME' => '//'],
144323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
145323788f4SGreg Roach        );
146323788f4SGreg Roach    }
147323788f4SGreg Roach
148323788f4SGreg Roach    /**
149323788f4SGreg Roach     * Test new mother names
15017d74f3aSGreg Roach     *
15115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
152323788f4SGreg Roach     */
153*c1010edaSGreg Roach    public function testNewMotherNames()
154*c1010edaSGreg Roach    {
155323788f4SGreg Roach        $this->assertSame(
156*c1010edaSGreg Roach            [
157*c1010edaSGreg Roach                'NAME' => '/White/',
158*c1010edaSGreg Roach                'SURN' => 'White',
159*c1010edaSGreg Roach            ],
160323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
161323788f4SGreg Roach        );
162323788f4SGreg Roach    }
163323788f4SGreg Roach
164323788f4SGreg Roach    /**
165323788f4SGreg Roach     * Test new parent names
16617d74f3aSGreg Roach     *
16715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
168323788f4SGreg Roach     */
169*c1010edaSGreg Roach    public function testNewParentNames()
170*c1010edaSGreg Roach    {
171323788f4SGreg Roach        $this->assertSame(
17213abd6f3SGreg Roach            ['NAME' => '//'],
173323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
174323788f4SGreg Roach        );
175323788f4SGreg Roach    }
176323788f4SGreg Roach
177323788f4SGreg Roach    /**
178323788f4SGreg Roach     * Test new husband names
17917d74f3aSGreg Roach     *
18015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
181323788f4SGreg Roach     */
182*c1010edaSGreg Roach    public function testNewHusbandNames()
183*c1010edaSGreg Roach    {
184323788f4SGreg Roach        $this->assertSame(
18513abd6f3SGreg Roach            ['NAME' => '//'],
186323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
187323788f4SGreg Roach        );
188323788f4SGreg Roach    }
189323788f4SGreg Roach
190323788f4SGreg Roach    /**
191323788f4SGreg Roach     * Test new wife names
19217d74f3aSGreg Roach     *
19315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
194323788f4SGreg Roach     */
195*c1010edaSGreg Roach    public function testNewWifeNames()
196*c1010edaSGreg Roach    {
197323788f4SGreg Roach        $this->assertSame(
19813abd6f3SGreg Roach            ['NAME' => '//'],
199323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
200323788f4SGreg Roach        );
201323788f4SGreg Roach    }
202323788f4SGreg Roach
203323788f4SGreg Roach    /**
204323788f4SGreg Roach     * Test new spouse names
20517d74f3aSGreg Roach     *
20615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition
207323788f4SGreg Roach     */
208*c1010edaSGreg Roach    public function testNewSpouseNames()
209*c1010edaSGreg Roach    {
210323788f4SGreg Roach        $this->assertSame(
21113abd6f3SGreg Roach            ['NAME' => '//'],
212323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
213323788f4SGreg Roach        );
214323788f4SGreg Roach    }
215323788f4SGreg Roach}
216