xref: /webtrees/tests/app/SurnameTradition/PatrilinealSurnameTraditionTest.php (revision 0115bc1678cafd957052cd2d256563ad3e242cc1)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach/**
3323788f4SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
5323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
6323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
7323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8323788f4SGreg Roach * (at your option) any later version.
9323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
10323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12323788f4SGreg Roach * GNU General Public License for more details.
13323788f4SGreg Roach * You should have received a copy of the GNU General Public License
14323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15323788f4SGreg Roach */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
19c1010edaSGreg Roach
20323788f4SGreg Roach/**
21323788f4SGreg Roach * Test harness for the class PatrilinenalSurnameTradition
22323788f4SGreg Roach */
2384e2cf4eSGreg Roachclass PatrilinealSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
24c1010edaSGreg Roach{
25323788f4SGreg Roach    /** @var SurnameTraditionInterface */
26323788f4SGreg Roach    private $surname_tradition;
27323788f4SGreg Roach
28323788f4SGreg Roach    /**
29323788f4SGreg Roach     * Prepare the environment for these tests
3052348eb8SGreg Roach     *
3152348eb8SGreg Roach     * @return void
32323788f4SGreg Roach     */
33*0115bc16SGreg Roach    protected function setUp()
34c1010edaSGreg Roach    {
35*0115bc16SGreg Roach        parent::setUp();
36*0115bc16SGreg Roach
37323788f4SGreg Roach        $this->surname_tradition = new PatrilinealSurnameTradition;
38323788f4SGreg Roach    }
39323788f4SGreg Roach
40323788f4SGreg Roach    /**
41323788f4SGreg Roach     * Test whether married surnames are used
4217d74f3aSGreg Roach     *
4315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
4452348eb8SGreg Roach     *
4552348eb8SGreg Roach     * @return void
46323788f4SGreg Roach     */
47c1010edaSGreg Roach    public function testMarriedSurnames()
48c1010edaSGreg Roach    {
49323788f4SGreg Roach        $this->assertSame(false, $this->surname_tradition->hasMarriedNames());
50323788f4SGreg Roach    }
51323788f4SGreg Roach
52323788f4SGreg Roach    /**
53c1ec7145SGreg Roach     * Test whether surnames are used
5417d74f3aSGreg Roach     *
5515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
5652348eb8SGreg Roach     *
5752348eb8SGreg Roach     * @return void
58c1ec7145SGreg Roach     */
59c1010edaSGreg Roach    public function testSurnames()
60c1010edaSGreg Roach    {
61c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
62c1ec7145SGreg Roach    }
63c1ec7145SGreg Roach
64c1ec7145SGreg Roach    /**
65323788f4SGreg Roach     * Test new son names
6617d74f3aSGreg Roach     *
6715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
6852348eb8SGreg Roach     *
6952348eb8SGreg Roach     * @return void
70323788f4SGreg Roach     */
71c1010edaSGreg Roach    public function testNewSonNames()
72c1010edaSGreg Roach    {
73323788f4SGreg Roach        $this->assertSame(
74c1010edaSGreg Roach            [
75c1010edaSGreg Roach                'NAME' => '/White/',
76c1010edaSGreg Roach                'SURN' => 'White',
77c1010edaSGreg Roach            ],
78323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
79323788f4SGreg Roach        );
80323788f4SGreg Roach    }
81323788f4SGreg Roach
82323788f4SGreg Roach    /**
83323788f4SGreg Roach     * Test new daughter names
8417d74f3aSGreg Roach     *
8515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
8652348eb8SGreg Roach     *
8752348eb8SGreg Roach     * @return void
88323788f4SGreg Roach     */
89c1010edaSGreg Roach    public function testNewDaughterNames()
90c1010edaSGreg Roach    {
91323788f4SGreg Roach        $this->assertSame(
92c1010edaSGreg Roach            [
93c1010edaSGreg Roach                'NAME' => '/White/',
94c1010edaSGreg Roach                'SURN' => 'White',
95c1010edaSGreg Roach            ],
96323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
97323788f4SGreg Roach        );
98323788f4SGreg Roach    }
99323788f4SGreg Roach
100323788f4SGreg Roach    /**
101323788f4SGreg Roach     * Test new child names
10217d74f3aSGreg Roach     *
10315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
10452348eb8SGreg Roach     *
10552348eb8SGreg Roach     * @return void
106323788f4SGreg Roach     */
107c1010edaSGreg Roach    public function testNewChildNames()
108c1010edaSGreg Roach    {
109323788f4SGreg Roach        $this->assertSame(
110c1010edaSGreg Roach            [
111c1010edaSGreg Roach                'NAME' => '/White/',
112c1010edaSGreg Roach                'SURN' => 'White',
113c1010edaSGreg Roach            ],
114323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
115323788f4SGreg Roach        );
116323788f4SGreg Roach    }
117323788f4SGreg Roach
118323788f4SGreg Roach    /**
119323788f4SGreg Roach     * Test new child names
12017d74f3aSGreg Roach     *
12115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
12252348eb8SGreg Roach     *
12352348eb8SGreg Roach     * @return void
124323788f4SGreg Roach     */
125c1010edaSGreg Roach    public function testNewChildNamesWithSpfx()
126c1010edaSGreg Roach    {
127323788f4SGreg Roach        $this->assertSame(
128c1010edaSGreg Roach            [
129c1010edaSGreg Roach                'NAME' => '/de White/',
130c1010edaSGreg Roach                'SPFX' => 'de',
131c1010edaSGreg Roach                'SURN' => 'White',
132c1010edaSGreg Roach            ],
133323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
134323788f4SGreg Roach        );
135323788f4SGreg Roach    }
136323788f4SGreg Roach
137323788f4SGreg Roach    /**
1381677a03aSGreg Roach     * Test new child names
13917d74f3aSGreg Roach     *
14015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
14152348eb8SGreg Roach     *
14252348eb8SGreg Roach     * @return void
1431677a03aSGreg Roach     */
144c1010edaSGreg Roach    public function testNewChildNamesWithNoParentsNames()
145c1010edaSGreg Roach    {
1461677a03aSGreg Roach        $this->assertSame(
14713abd6f3SGreg Roach            ['NAME' => '//'],
1481677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1491677a03aSGreg Roach        );
1501677a03aSGreg Roach    }
1511677a03aSGreg Roach
1521677a03aSGreg Roach    /**
153323788f4SGreg Roach     * Test new father names
15417d74f3aSGreg Roach     *
15515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
15652348eb8SGreg Roach     *
15752348eb8SGreg Roach     * @return void
158323788f4SGreg Roach     */
159c1010edaSGreg Roach    public function testNewFatherNames()
160c1010edaSGreg Roach    {
161323788f4SGreg Roach        $this->assertSame(
162c1010edaSGreg Roach            [
163c1010edaSGreg Roach                'NAME' => '/White/',
164c1010edaSGreg Roach                'SURN' => 'White',
165c1010edaSGreg Roach            ],
166323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
167323788f4SGreg Roach        );
168323788f4SGreg Roach    }
169323788f4SGreg Roach
170323788f4SGreg Roach    /**
171323788f4SGreg Roach     * Test new mother names
17217d74f3aSGreg Roach     *
17315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
17452348eb8SGreg Roach     *
17552348eb8SGreg Roach     * @return void
176323788f4SGreg Roach     */
177c1010edaSGreg Roach    public function testNewMotherNames()
178c1010edaSGreg Roach    {
179323788f4SGreg Roach        $this->assertSame(
18013abd6f3SGreg Roach            ['NAME' => '//'],
181323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
182323788f4SGreg Roach        );
183323788f4SGreg Roach    }
184323788f4SGreg Roach
185323788f4SGreg Roach    /**
186323788f4SGreg Roach     * Test new parent names
18717d74f3aSGreg Roach     *
18815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
18952348eb8SGreg Roach     *
19052348eb8SGreg Roach     * @return void
191323788f4SGreg Roach     */
192c1010edaSGreg Roach    public function testNewParentNames()
193c1010edaSGreg Roach    {
194323788f4SGreg Roach        $this->assertSame(
19513abd6f3SGreg Roach            ['NAME' => '//'],
196323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
197323788f4SGreg Roach        );
198323788f4SGreg Roach    }
199323788f4SGreg Roach
200323788f4SGreg Roach    /**
201323788f4SGreg Roach     * Test new husband names
20217d74f3aSGreg Roach     *
20315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
20452348eb8SGreg Roach     *
20552348eb8SGreg Roach     * @return void
206323788f4SGreg Roach     */
207c1010edaSGreg Roach    public function testNewHusbandNames()
208c1010edaSGreg Roach    {
209323788f4SGreg Roach        $this->assertSame(
21013abd6f3SGreg Roach            ['NAME' => '//'],
211323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
212323788f4SGreg Roach        );
213323788f4SGreg Roach    }
214323788f4SGreg Roach
215323788f4SGreg Roach    /**
216323788f4SGreg Roach     * Test new wife names
21717d74f3aSGreg Roach     *
21815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
21952348eb8SGreg Roach     *
22052348eb8SGreg Roach     * @return void
221323788f4SGreg Roach     */
222c1010edaSGreg Roach    public function testNewWifeNames()
223c1010edaSGreg Roach    {
224323788f4SGreg Roach        $this->assertSame(
22513abd6f3SGreg Roach            ['NAME' => '//'],
226323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
227323788f4SGreg Roach        );
228323788f4SGreg Roach    }
229323788f4SGreg Roach
230323788f4SGreg Roach    /**
231323788f4SGreg Roach     * Test new spouse names
23217d74f3aSGreg Roach     *
23315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
23452348eb8SGreg Roach     *
23552348eb8SGreg Roach     * @return void
236323788f4SGreg Roach     */
237c1010edaSGreg Roach    public function testNewSpouseNames()
238c1010edaSGreg Roach    {
239323788f4SGreg Roach        $this->assertSame(
24013abd6f3SGreg Roach            ['NAME' => '//'],
241323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
242323788f4SGreg Roach        );
243323788f4SGreg Roach    }
244323788f4SGreg Roach}
245