xref: /webtrees/tests/app/SurnameTradition/IcelandicSurnameTraditionTest.php (revision 99125a335d0be11b975e213c69fc4ede0c5303f1)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2021 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\SurnameTradition;
21
22use Fisharebest\Webtrees\TestCase;
23
24/**
25 * Test harness for the class IcelandicSurnameTradition
26 */
27class IcelandicSurnameTraditionTest extends TestCase
28{
29    private SurnameTraditionInterface $surname_tradition;
30
31    /**
32     * Prepare the environment for these tests
33     *
34     * @return void
35     */
36    protected function setUp(): void
37    {
38        parent::setUp();
39
40        $this->surname_tradition = new IcelandicSurnameTradition();
41    }
42
43    /**
44     * Test whether married surnames are used
45     *
46     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
47     *
48     * @return void
49     */
50    public function testMarriedSurnames(): void
51    {
52        self::assertFalse($this->surname_tradition->hasMarriedNames());
53    }
54
55    /**
56     * Test whether surnames are used
57     *
58     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
59     *
60     * @return void
61     */
62    public function testSurnames(): void
63    {
64        self::assertFalse($this->surname_tradition->hasSurnames());
65    }
66
67    /**
68     * Test new son names
69     *
70     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
71     *
72     * @return void
73     */
74    public function testNewSonNames(): void
75    {
76        self::assertSame(
77            ['NAME' => 'Jonsson'],
78            $this->surname_tradition->newChildNames('Jon Einarsson', 'Eva Stefansdottir', 'M')
79        );
80    }
81
82    /**
83     * Test new daughter names
84     *
85     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
86     *
87     * @return void
88     */
89    public function testNewDaughterNames(): void
90    {
91        self::assertSame(
92            ['NAME' => 'Jonsdottir'],
93            $this->surname_tradition->newChildNames('Jon Einarsson', 'Eva Stefansdottir', 'F')
94        );
95    }
96
97    /**
98     * Test new child names
99     *
100     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
101     *
102     * @return void
103     */
104    public function testNewChildNames(): void
105    {
106        self::assertSame(
107            [],
108            $this->surname_tradition->newChildNames('Jon Einarsson', 'Eva Stefansdottir', 'U')
109        );
110    }
111
112    /**
113     * Test new father names
114     *
115     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
116     *
117     * @return void
118     */
119    public function testNewFatherNames(): void
120    {
121        self::assertSame(
122            [
123                'NAME' => 'Einar',
124                'GIVN' => 'Einar',
125            ],
126            $this->surname_tradition->newParentNames('Jon Einarsson', 'M')
127        );
128    }
129
130    /**
131     * Test new mother names
132     *
133     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
134     *
135     * @return void
136     */
137    public function testNewMotherNames(): void
138    {
139        self::assertSame(
140            [],
141            $this->surname_tradition->newParentNames('Jon Einarsson', 'F')
142        );
143    }
144
145    /**
146     * Test new parent names
147     *
148     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
149     *
150     * @return void
151     */
152    public function testNewParentNames(): void
153    {
154        self::assertSame(
155            [],
156            $this->surname_tradition->newParentNames('Jon Einarsson', 'U')
157        );
158    }
159
160    /**
161     * Test new husband names
162     *
163     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
164     *
165     * @return void
166     */
167    public function testNewHusbandNames(): void
168    {
169        self::assertSame(
170            [],
171            $this->surname_tradition->newSpouseNames('Eva Stefansdottir', 'M')
172        );
173    }
174
175    /**
176     * Test new wife names
177     *
178     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
179     *
180     * @return void
181     */
182    public function testNewWifeNames(): void
183    {
184        self::assertSame(
185            [],
186            $this->surname_tradition->newSpouseNames('Jon Einarsson', 'F')
187        );
188    }
189
190    /**
191     * Test new spouse names
192     *
193     * @covers \Fisharebest\Webtrees\SurnameTradition\IcelandicSurnameTradition
194     *
195     * @return void
196     */
197    public function testNewSpouseNames(): void
198    {
199        self::assertSame(
200            [],
201            $this->surname_tradition->newSpouseNames('Jon Einarsson', 'U')
202        );
203    }
204}
205