xref: /webtrees/tests/app/SurnameTradition/DefaultSurnameTraditionTest.php (revision e7f56f2af615447ab1a7646851f88b465ace9e04)
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 */
16*e7f56f2aSGreg Roachdeclare(strict_types=1);
17*e7f56f2aSGreg Roach
1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
19c1010edaSGreg Roach
20323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition;
21323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
22323788f4SGreg Roach
23323788f4SGreg Roach/**
2417d74f3aSGreg Roach * Test harness for the class DefaultSurnameTradition
25323788f4SGreg Roach */
2684e2cf4eSGreg Roachclass DefaultSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase
27c1010edaSGreg Roach{
28323788f4SGreg Roach    /** @var SurnameTraditionInterface */
29323788f4SGreg Roach    private $surname_tradition;
30323788f4SGreg Roach
31323788f4SGreg Roach    /**
32323788f4SGreg Roach     * Prepare the environment for these tests
3352348eb8SGreg Roach     *
3452348eb8SGreg Roach     * @return void
35323788f4SGreg Roach     */
36c1010edaSGreg Roach    public function setUp()
37c1010edaSGreg Roach    {
38323788f4SGreg Roach        $this->surname_tradition = new DefaultSurnameTradition;
39323788f4SGreg Roach    }
40323788f4SGreg Roach
41323788f4SGreg Roach    /**
42323788f4SGreg Roach     * Test whether married surnames are used
4317d74f3aSGreg Roach     *
4415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
4552348eb8SGreg Roach     *
4652348eb8SGreg Roach     * @return void
47323788f4SGreg Roach     */
48c1010edaSGreg Roach    public function testMarriedSurnames()
49c1010edaSGreg Roach    {
50323788f4SGreg Roach        $this->assertSame(false, $this->surname_tradition->hasMarriedNames());
51323788f4SGreg Roach    }
52323788f4SGreg Roach
53323788f4SGreg Roach    /**
54c1ec7145SGreg Roach     * Test whether surnames are used
5517d74f3aSGreg Roach     *
5615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
5752348eb8SGreg Roach     *
5852348eb8SGreg Roach     * @return void
59c1ec7145SGreg Roach     */
60c1010edaSGreg Roach    public function testSurnames()
61c1010edaSGreg Roach    {
62c1ec7145SGreg Roach        $this->assertSame(true, $this->surname_tradition->hasSurnames());
63c1ec7145SGreg Roach    }
64c1ec7145SGreg Roach
65c1ec7145SGreg Roach    /**
66323788f4SGreg Roach     * Test new son names
6717d74f3aSGreg Roach     *
6815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
6952348eb8SGreg Roach     *
7052348eb8SGreg Roach     * @return void
71323788f4SGreg Roach     */
72c1010edaSGreg Roach    public function testNewSonNames()
73c1010edaSGreg Roach    {
74323788f4SGreg Roach        $this->assertSame(
7513abd6f3SGreg Roach            ['NAME' => '//'],
76323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
77323788f4SGreg Roach        );
78323788f4SGreg Roach    }
79323788f4SGreg Roach
80323788f4SGreg Roach    /**
81323788f4SGreg Roach     * Test new daughter names
8217d74f3aSGreg Roach     *
8315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
8452348eb8SGreg Roach     *
8552348eb8SGreg Roach     * @return void
86323788f4SGreg Roach     */
87c1010edaSGreg Roach    public function testNewDaughterNames()
88c1010edaSGreg Roach    {
89323788f4SGreg Roach        $this->assertSame(
9013abd6f3SGreg Roach            ['NAME' => '//'],
91323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
92323788f4SGreg Roach        );
93323788f4SGreg Roach    }
94323788f4SGreg Roach
95323788f4SGreg Roach    /**
96323788f4SGreg Roach     * Test new child names
9717d74f3aSGreg Roach     *
9815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
9952348eb8SGreg Roach     *
10052348eb8SGreg Roach     * @return void
101323788f4SGreg Roach     */
102c1010edaSGreg Roach    public function testNewChildNames()
103c1010edaSGreg Roach    {
104323788f4SGreg Roach        $this->assertSame(
10513abd6f3SGreg Roach            ['NAME' => '//'],
106323788f4SGreg Roach            $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
107323788f4SGreg Roach        );
108323788f4SGreg Roach    }
109323788f4SGreg Roach
110323788f4SGreg Roach    /**
111323788f4SGreg Roach     * Test new father names
11217d74f3aSGreg Roach     *
11315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
11452348eb8SGreg Roach     *
11552348eb8SGreg Roach     * @return void
116323788f4SGreg Roach     */
117c1010edaSGreg Roach    public function testNewFatherNames()
118c1010edaSGreg Roach    {
119323788f4SGreg Roach        $this->assertSame(
12013abd6f3SGreg Roach            ['NAME' => '//'],
121323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'M')
122323788f4SGreg Roach        );
123323788f4SGreg Roach    }
124323788f4SGreg Roach
125323788f4SGreg Roach    /**
126323788f4SGreg Roach     * Test new mother names
12717d74f3aSGreg Roach     *
12815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
12952348eb8SGreg Roach     *
13052348eb8SGreg Roach     * @return void
131323788f4SGreg Roach     */
132c1010edaSGreg Roach    public function testNewMotherNames()
133c1010edaSGreg Roach    {
134323788f4SGreg Roach        $this->assertSame(
13513abd6f3SGreg Roach            ['NAME' => '//'],
136323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'F')
137323788f4SGreg Roach        );
138323788f4SGreg Roach    }
139323788f4SGreg Roach
140323788f4SGreg Roach    /**
141323788f4SGreg Roach     * Test new parent names
14217d74f3aSGreg Roach     *
14315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
14452348eb8SGreg Roach     *
14552348eb8SGreg Roach     * @return void
146323788f4SGreg Roach     */
147c1010edaSGreg Roach    public function testNewParentNames()
148c1010edaSGreg Roach    {
149323788f4SGreg Roach        $this->assertSame(
15013abd6f3SGreg Roach            ['NAME' => '//'],
151323788f4SGreg Roach            $this->surname_tradition->newParentNames('John /White/', 'U')
152323788f4SGreg Roach        );
153323788f4SGreg Roach    }
154323788f4SGreg Roach
155323788f4SGreg Roach    /**
156323788f4SGreg Roach     * Test new husband names
15717d74f3aSGreg Roach     *
15815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
15952348eb8SGreg Roach     *
16052348eb8SGreg Roach     * @return void
161323788f4SGreg Roach     */
162c1010edaSGreg Roach    public function testNewHusbandNames()
163c1010edaSGreg Roach    {
164323788f4SGreg Roach        $this->assertSame(
16513abd6f3SGreg Roach            ['NAME' => '//'],
166323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
167323788f4SGreg Roach        );
168323788f4SGreg Roach    }
169323788f4SGreg Roach
170323788f4SGreg Roach    /**
171323788f4SGreg Roach     * Test new wife names
17217d74f3aSGreg Roach     *
17315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
17452348eb8SGreg Roach     *
17552348eb8SGreg Roach     * @return void
176323788f4SGreg Roach     */
177c1010edaSGreg Roach    public function testNewWifeNames()
178c1010edaSGreg Roach    {
179323788f4SGreg Roach        $this->assertSame(
18013abd6f3SGreg Roach            ['NAME' => '//'],
181323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('John /White/', 'F')
182323788f4SGreg Roach        );
183323788f4SGreg Roach    }
184323788f4SGreg Roach
185323788f4SGreg Roach    /**
186323788f4SGreg Roach     * Test new spouse names
18717d74f3aSGreg Roach     *
18815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
18952348eb8SGreg Roach     *
19052348eb8SGreg Roach     * @return void
191323788f4SGreg Roach     */
192c1010edaSGreg Roach    public function testNewSpouseNames()
193c1010edaSGreg Roach    {
194323788f4SGreg Roach        $this->assertSame(
19513abd6f3SGreg Roach            ['NAME' => '//'],
196323788f4SGreg Roach            $this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
197323788f4SGreg Roach        );
198323788f4SGreg Roach    }
199323788f4SGreg Roach}
200