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