xref: /webtrees/tests/app/SurnameTradition/PatrilinealSurnameTraditionTest.php (revision 5e933c21f8006e675d1df8bcedc634ee61f4aec2)
1323788f4SGreg Roach<?php
23976b470SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
5*5e933c21SGreg Roach * Copyright (C) 2020 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 */
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/**
25323788f4SGreg Roach * Test harness for the class PatrilinenalSurnameTradition
26323788f4SGreg Roach */
273cfcc809SGreg Roachclass PatrilinealSurnameTraditionTest 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 PatrilinealSurnameTradition();
42323788f4SGreg Roach    }
43323788f4SGreg Roach
44323788f4SGreg Roach    /**
45323788f4SGreg Roach     * Test whether married surnames are used
4617d74f3aSGreg Roach     *
4715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
4852348eb8SGreg Roach     *
4952348eb8SGreg Roach     * @return void
50323788f4SGreg Roach     */
519b802b22SGreg Roach    public function testMarriedSurnames(): void
52c1010edaSGreg Roach    {
53*5e933c21SGreg Roach        self::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\PatrilinealSurnameTradition
6052348eb8SGreg Roach     *
6152348eb8SGreg Roach     * @return void
62c1ec7145SGreg Roach     */
639b802b22SGreg Roach    public function testSurnames(): void
64c1010edaSGreg Roach    {
65*5e933c21SGreg Roach        self::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\PatrilinealSurnameTradition
7252348eb8SGreg Roach     *
7352348eb8SGreg Roach     * @return void
74323788f4SGreg Roach     */
759b802b22SGreg Roach    public function testNewSonNames(): void
76c1010edaSGreg Roach    {
77*5e933c21SGreg Roach        self::assertSame(
78c1010edaSGreg Roach            [
79c1010edaSGreg Roach                'NAME' => '/White/',
80c1010edaSGreg Roach                'SURN' => 'White',
81c1010edaSGreg Roach            ],
82323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
83323788f4SGreg Roach        );
84323788f4SGreg Roach    }
85323788f4SGreg Roach
86323788f4SGreg Roach    /**
87323788f4SGreg Roach     * Test new daughter names
8817d74f3aSGreg Roach     *
8915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
9052348eb8SGreg Roach     *
9152348eb8SGreg Roach     * @return void
92323788f4SGreg Roach     */
939b802b22SGreg Roach    public function testNewDaughterNames(): void
94c1010edaSGreg Roach    {
95*5e933c21SGreg Roach        self::assertSame(
96c1010edaSGreg Roach            [
97c1010edaSGreg Roach                'NAME' => '/White/',
98c1010edaSGreg Roach                'SURN' => 'White',
99c1010edaSGreg Roach            ],
100323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
101323788f4SGreg Roach        );
102323788f4SGreg Roach    }
103323788f4SGreg Roach
104323788f4SGreg Roach    /**
105323788f4SGreg Roach     * Test new child names
10617d74f3aSGreg Roach     *
10715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
10852348eb8SGreg Roach     *
10952348eb8SGreg Roach     * @return void
110323788f4SGreg Roach     */
1119b802b22SGreg Roach    public function testNewChildNames(): void
112c1010edaSGreg Roach    {
113*5e933c21SGreg Roach        self::assertSame(
114c1010edaSGreg Roach            [
115c1010edaSGreg Roach                'NAME' => '/White/',
116c1010edaSGreg Roach                'SURN' => 'White',
117c1010edaSGreg Roach            ],
118323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
119323788f4SGreg Roach        );
120323788f4SGreg Roach    }
121323788f4SGreg Roach
122323788f4SGreg Roach    /**
123323788f4SGreg Roach     * Test new child names
12417d74f3aSGreg Roach     *
12515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
12652348eb8SGreg Roach     *
12752348eb8SGreg Roach     * @return void
128323788f4SGreg Roach     */
1299b802b22SGreg Roach    public function testNewChildNamesWithSpfx(): void
130c1010edaSGreg Roach    {
131*5e933c21SGreg Roach        self::assertSame(
132c1010edaSGreg Roach            [
133c1010edaSGreg Roach                'NAME' => '/de White/',
134c1010edaSGreg Roach                'SPFX' => 'de',
135c1010edaSGreg Roach                'SURN' => 'White',
136c1010edaSGreg Roach            ],
137323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
138323788f4SGreg Roach        );
139323788f4SGreg Roach    }
140323788f4SGreg Roach
141323788f4SGreg Roach    /**
1421677a03aSGreg Roach     * Test new child names
14317d74f3aSGreg Roach     *
14415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
14552348eb8SGreg Roach     *
14652348eb8SGreg Roach     * @return void
1471677a03aSGreg Roach     */
1489b802b22SGreg Roach    public function testNewChildNamesWithNoParentsNames(): void
149c1010edaSGreg Roach    {
150*5e933c21SGreg Roach        self::assertSame(
15113abd6f3SGreg Roach            ['NAME' => '//'],
1521677a03aSGreg Roach            $this->surname_tradition->newChildNames('', '', 'U')
1531677a03aSGreg Roach        );
1541677a03aSGreg Roach    }
1551677a03aSGreg Roach
1561677a03aSGreg Roach    /**
157323788f4SGreg Roach     * Test new father names
15817d74f3aSGreg Roach     *
15915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
16052348eb8SGreg Roach     *
16152348eb8SGreg Roach     * @return void
162323788f4SGreg Roach     */
1639b802b22SGreg Roach    public function testNewFatherNames(): void
164c1010edaSGreg Roach    {
165*5e933c21SGreg Roach        self::assertSame(
166c1010edaSGreg Roach            [
167c1010edaSGreg Roach                'NAME' => '/White/',
168c1010edaSGreg Roach                'SURN' => 'White',
169c1010edaSGreg Roach            ],
170323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
171323788f4SGreg Roach        );
172323788f4SGreg Roach    }
173323788f4SGreg Roach
174323788f4SGreg Roach    /**
175323788f4SGreg Roach     * Test new mother names
17617d74f3aSGreg Roach     *
17715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
17852348eb8SGreg Roach     *
17952348eb8SGreg Roach     * @return void
180323788f4SGreg Roach     */
1819b802b22SGreg Roach    public function testNewMotherNames(): void
182c1010edaSGreg Roach    {
183*5e933c21SGreg Roach        self::assertSame(
18413abd6f3SGreg Roach            ['NAME' => '//'],
185323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
186323788f4SGreg Roach        );
187323788f4SGreg Roach    }
188323788f4SGreg Roach
189323788f4SGreg Roach    /**
190323788f4SGreg Roach     * Test new parent names
19117d74f3aSGreg Roach     *
19215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
19352348eb8SGreg Roach     *
19452348eb8SGreg Roach     * @return void
195323788f4SGreg Roach     */
1969b802b22SGreg Roach    public function testNewParentNames(): void
197c1010edaSGreg Roach    {
198*5e933c21SGreg Roach        self::assertSame(
19913abd6f3SGreg Roach            ['NAME' => '//'],
200323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
201323788f4SGreg Roach        );
202323788f4SGreg Roach    }
203323788f4SGreg Roach
204323788f4SGreg Roach    /**
205323788f4SGreg Roach     * Test new husband names
20617d74f3aSGreg Roach     *
20715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
20852348eb8SGreg Roach     *
20952348eb8SGreg Roach     * @return void
210323788f4SGreg Roach     */
2119b802b22SGreg Roach    public function testNewHusbandNames(): void
212c1010edaSGreg Roach    {
213*5e933c21SGreg Roach        self::assertSame(
21413abd6f3SGreg Roach            ['NAME' => '//'],
215323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
216323788f4SGreg Roach        );
217323788f4SGreg Roach    }
218323788f4SGreg Roach
219323788f4SGreg Roach    /**
220323788f4SGreg Roach     * Test new wife names
22117d74f3aSGreg Roach     *
22215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
22352348eb8SGreg Roach     *
22452348eb8SGreg Roach     * @return void
225323788f4SGreg Roach     */
2269b802b22SGreg Roach    public function testNewWifeNames(): void
227c1010edaSGreg Roach    {
228*5e933c21SGreg Roach        self::assertSame(
22913abd6f3SGreg Roach            ['NAME' => '//'],
230323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
231323788f4SGreg Roach        );
232323788f4SGreg Roach    }
233323788f4SGreg Roach
234323788f4SGreg Roach    /**
235323788f4SGreg Roach     * Test new spouse names
23617d74f3aSGreg Roach     *
23715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
23852348eb8SGreg Roach     *
23952348eb8SGreg Roach     * @return void
240323788f4SGreg Roach     */
2419b802b22SGreg Roach    public function testNewSpouseNames(): void
242c1010edaSGreg Roach    {
243*5e933c21SGreg Roach        self::assertSame(
24413abd6f3SGreg Roach            ['NAME' => '//'],
245323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
246323788f4SGreg Roach        );
247323788f4SGreg Roach    }
248323788f4SGreg Roach}
249