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