xref: /webtrees/tests/app/SurnameTradition/DefaultSurnameTraditionTest.php (revision 52348eb8c11b06a8488e13475e6561273832716a)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach/**
3323788f4SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
5323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
6323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
7323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8323788f4SGreg Roach * (at your option) any later version.
9323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
10323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12323788f4SGreg Roach * GNU General Public License for more details.
13323788f4SGreg Roach * You should have received a copy of the GNU General Public License
14323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15323788f4SGreg Roach */
1684e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
17c1010edaSGreg Roach
18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition;
19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
20323788f4SGreg Roach
21323788f4SGreg Roach/**
2217d74f3aSGreg Roach * Test harness for the class DefaultSurnameTradition
23323788f4SGreg Roach */
2484e2cf4eSGreg Roachclass DefaultSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
25c1010edaSGreg Roach{
26323788f4SGreg Roach    /** @var SurnameTraditionInterface */
27323788f4SGreg Roach    private $surname_tradition;
28323788f4SGreg Roach
29323788f4SGreg Roach    /**
30323788f4SGreg Roach     * Prepare the environment for these tests
31*52348eb8SGreg Roach     *
32*52348eb8SGreg Roach     * @return void
33323788f4SGreg Roach     */
34c1010edaSGreg Roach    public function setUp()
35c1010edaSGreg Roach    {
36323788f4SGreg Roach        $this->surname_tradition = new DefaultSurnameTradition;
37323788f4SGreg Roach    }
38323788f4SGreg Roach
39323788f4SGreg Roach    /**
40323788f4SGreg Roach     * Test whether married surnames are used
4117d74f3aSGreg Roach     *
4215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
43*52348eb8SGreg Roach     *
44*52348eb8SGreg Roach     * @return void
45323788f4SGreg Roach     */
46c1010edaSGreg Roach    public function testMarriedSurnames()
47c1010edaSGreg Roach    {
48323788f4SGreg Roach        $this->assertSame(false, $this->surname_tradition->hasMarriedNames());
49323788f4SGreg Roach    }
50323788f4SGreg Roach
51323788f4SGreg Roach    /**
52c1ec7145SGreg Roach     * Test whether surnames are used
5317d74f3aSGreg Roach     *
5415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
55*52348eb8SGreg Roach     *
56*52348eb8SGreg Roach     * @return void
57c1ec7145SGreg Roach     */
58c1010edaSGreg Roach    public function testSurnames()
59c1010edaSGreg Roach    {
60c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
61c1ec7145SGreg Roach    }
62c1ec7145SGreg Roach
63c1ec7145SGreg Roach    /**
64323788f4SGreg Roach     * Test new son names
6517d74f3aSGreg Roach     *
6615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
67*52348eb8SGreg Roach     *
68*52348eb8SGreg Roach     * @return void
69323788f4SGreg Roach     */
70c1010edaSGreg Roach    public function testNewSonNames()
71c1010edaSGreg Roach    {
72323788f4SGreg Roach        $this->assertSame(
7313abd6f3SGreg Roach            ['NAME' => '//'],
74323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
75323788f4SGreg Roach        );
76323788f4SGreg Roach    }
77323788f4SGreg Roach
78323788f4SGreg Roach    /**
79323788f4SGreg Roach     * Test new daughter names
8017d74f3aSGreg Roach     *
8115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
82*52348eb8SGreg Roach     *
83*52348eb8SGreg Roach     * @return void
84323788f4SGreg Roach     */
85c1010edaSGreg Roach    public function testNewDaughterNames()
86c1010edaSGreg Roach    {
87323788f4SGreg Roach        $this->assertSame(
8813abd6f3SGreg Roach            ['NAME' => '//'],
89323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
90323788f4SGreg Roach        );
91323788f4SGreg Roach    }
92323788f4SGreg Roach
93323788f4SGreg Roach    /**
94323788f4SGreg Roach     * Test new child names
9517d74f3aSGreg Roach     *
9615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
97*52348eb8SGreg Roach     *
98*52348eb8SGreg Roach     * @return void
99323788f4SGreg Roach     */
100c1010edaSGreg Roach    public function testNewChildNames()
101c1010edaSGreg Roach    {
102323788f4SGreg Roach        $this->assertSame(
10313abd6f3SGreg Roach            ['NAME' => '//'],
104323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
105323788f4SGreg Roach        );
106323788f4SGreg Roach    }
107323788f4SGreg Roach
108323788f4SGreg Roach    /**
109323788f4SGreg Roach     * Test new father names
11017d74f3aSGreg Roach     *
11115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
112*52348eb8SGreg Roach     *
113*52348eb8SGreg Roach     * @return void
114323788f4SGreg Roach     */
115c1010edaSGreg Roach    public function testNewFatherNames()
116c1010edaSGreg Roach    {
117323788f4SGreg Roach        $this->assertSame(
11813abd6f3SGreg Roach            ['NAME' => '//'],
119323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
120323788f4SGreg Roach        );
121323788f4SGreg Roach    }
122323788f4SGreg Roach
123323788f4SGreg Roach    /**
124323788f4SGreg Roach     * Test new mother names
12517d74f3aSGreg Roach     *
12615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
127*52348eb8SGreg Roach     *
128*52348eb8SGreg Roach     * @return void
129323788f4SGreg Roach     */
130c1010edaSGreg Roach    public function testNewMotherNames()
131c1010edaSGreg Roach    {
132323788f4SGreg Roach        $this->assertSame(
13313abd6f3SGreg Roach            ['NAME' => '//'],
134323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
135323788f4SGreg Roach        );
136323788f4SGreg Roach    }
137323788f4SGreg Roach
138323788f4SGreg Roach    /**
139323788f4SGreg Roach     * Test new parent names
14017d74f3aSGreg Roach     *
14115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
142*52348eb8SGreg Roach     *
143*52348eb8SGreg Roach     * @return void
144323788f4SGreg Roach     */
145c1010edaSGreg Roach    public function testNewParentNames()
146c1010edaSGreg Roach    {
147323788f4SGreg Roach        $this->assertSame(
14813abd6f3SGreg Roach            ['NAME' => '//'],
149323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
150323788f4SGreg Roach        );
151323788f4SGreg Roach    }
152323788f4SGreg Roach
153323788f4SGreg Roach    /**
154323788f4SGreg Roach     * Test new husband names
15517d74f3aSGreg Roach     *
15615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
157*52348eb8SGreg Roach     *
158*52348eb8SGreg Roach     * @return void
159323788f4SGreg Roach     */
160c1010edaSGreg Roach    public function testNewHusbandNames()
161c1010edaSGreg Roach    {
162323788f4SGreg Roach        $this->assertSame(
16313abd6f3SGreg Roach            ['NAME' => '//'],
164323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
165323788f4SGreg Roach        );
166323788f4SGreg Roach    }
167323788f4SGreg Roach
168323788f4SGreg Roach    /**
169323788f4SGreg Roach     * Test new wife names
17017d74f3aSGreg Roach     *
17115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
172*52348eb8SGreg Roach     *
173*52348eb8SGreg Roach     * @return void
174323788f4SGreg Roach     */
175c1010edaSGreg Roach    public function testNewWifeNames()
176c1010edaSGreg Roach    {
177323788f4SGreg Roach        $this->assertSame(
17813abd6f3SGreg Roach            ['NAME' => '//'],
179323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
180323788f4SGreg Roach        );
181323788f4SGreg Roach    }
182323788f4SGreg Roach
183323788f4SGreg Roach    /**
184323788f4SGreg Roach     * Test new spouse names
18517d74f3aSGreg Roach     *
18615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
187*52348eb8SGreg Roach     *
188*52348eb8SGreg Roach     * @return void
189323788f4SGreg Roach     */
190c1010edaSGreg Roach    public function testNewSpouseNames()
191c1010edaSGreg Roach    {
192323788f4SGreg Roach        $this->assertSame(
19313abd6f3SGreg Roach            ['NAME' => '//'],
194323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
195323788f4SGreg Roach        );
196323788f4SGreg Roach    }
197323788f4SGreg Roach}
198