xref: /webtrees/tests/app/SurnameTradition/DefaultSurnameTraditionTest.php (revision 17907095d917ef2b56d7bdf08f08ea42db03cb32)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2019 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
20/**
21 * Test harness for the class DefaultSurnameTradition
22 */
23class DefaultSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
24{
25    /** @var SurnameTraditionInterface */
26    private $surname_tradition;
27
28    /**
29     * Prepare the environment for these tests
30     *
31     * @return void
32     */
33    protected function setUp()
34    {
35        parent::setUp();
36
37        $this->surname_tradition = new DefaultSurnameTradition;
38    }
39
40    /**
41     * Test whether married surnames are used
42     *
43     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
44     *
45     * @return void
46     */
47    public function testMarriedSurnames(): void
48    {
49        $this->assertSame(false, $this->surname_tradition->hasMarriedNames());
50    }
51
52    /**
53     * Test whether surnames are used
54     *
55     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
56     *
57     * @return void
58     */
59    public function testSurnames(): void
60    {
61        $this->assertSame(true, $this->surname_tradition->hasSurnames());
62    }
63
64    /**
65     * Test new son names
66     *
67     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
68     *
69     * @return void
70     */
71    public function testNewSonNames(): void
72    {
73        $this->assertSame(
74            ['NAME' => '//'],
75            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
76        );
77    }
78
79    /**
80     * Test new daughter names
81     *
82     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
83     *
84     * @return void
85     */
86    public function testNewDaughterNames(): void
87    {
88        $this->assertSame(
89            ['NAME' => '//'],
90            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
91        );
92    }
93
94    /**
95     * Test new child names
96     *
97     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
98     *
99     * @return void
100     */
101    public function testNewChildNames(): void
102    {
103        $this->assertSame(
104            ['NAME' => '//'],
105            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
106        );
107    }
108
109    /**
110     * Test new father names
111     *
112     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
113     *
114     * @return void
115     */
116    public function testNewFatherNames(): void
117    {
118        $this->assertSame(
119            ['NAME' => '//'],
120            $this->surname_tradition->newParentNames('John /White/', 'M')
121        );
122    }
123
124    /**
125     * Test new mother names
126     *
127     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
128     *
129     * @return void
130     */
131    public function testNewMotherNames(): void
132    {
133        $this->assertSame(
134            ['NAME' => '//'],
135            $this->surname_tradition->newParentNames('John /White/', 'F')
136        );
137    }
138
139    /**
140     * Test new parent names
141     *
142     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
143     *
144     * @return void
145     */
146    public function testNewParentNames(): void
147    {
148        $this->assertSame(
149            ['NAME' => '//'],
150            $this->surname_tradition->newParentNames('John /White/', 'U')
151        );
152    }
153
154    /**
155     * Test new husband names
156     *
157     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
158     *
159     * @return void
160     */
161    public function testNewHusbandNames(): void
162    {
163        $this->assertSame(
164            ['NAME' => '//'],
165            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
166        );
167    }
168
169    /**
170     * Test new wife names
171     *
172     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
173     *
174     * @return void
175     */
176    public function testNewWifeNames(): void
177    {
178        $this->assertSame(
179            ['NAME' => '//'],
180            $this->surname_tradition->newSpouseNames('John /White/', 'F')
181        );
182    }
183
184    /**
185     * Test new spouse names
186     *
187     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
188     *
189     * @return void
190     */
191    public function testNewSpouseNames(): void
192    {
193        $this->assertSame(
194            ['NAME' => '//'],
195            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
196        );
197    }
198}
199