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