xref: /webtrees/tests/app/SurnameTradition/DefaultSurnameTraditionTest.php (revision 15d603e7c7c15d20f055d3d9c38d6b133453c5be)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
56bdf7674SGreg Roach * Copyright (C) 2017 webtrees development team
6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9323788f4SGreg Roach * (at your option) any later version.
10323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13323788f4SGreg Roach * GNU General Public License for more details.
14323788f4SGreg Roach * You should have received a copy of the GNU General Public License
15323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16323788f4SGreg Roach */
17323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition;
18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
19323788f4SGreg Roach
20323788f4SGreg Roach/**
2117d74f3aSGreg Roach * Test harness for the class DefaultSurnameTradition
22323788f4SGreg Roach */
23db7d25eeSGreg Roachclass DefaultSurnameTraditionTest extends \PHPUnit_Framework_TestCase {
24323788f4SGreg Roach	/** @var SurnameTraditionInterface */
25323788f4SGreg Roach	private $surname_tradition;
26323788f4SGreg Roach
27323788f4SGreg Roach	/**
28323788f4SGreg Roach	 * Prepare the environment for these tests
29323788f4SGreg Roach	 */
30323788f4SGreg Roach	public function setUp() {
31323788f4SGreg Roach		$this->surname_tradition = new DefaultSurnameTradition;
32323788f4SGreg Roach	}
33323788f4SGreg Roach
34323788f4SGreg Roach	/**
35323788f4SGreg Roach	 * Test whether married surnames are used
3617d74f3aSGreg Roach	 *
37*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
38323788f4SGreg Roach	 */
39323788f4SGreg Roach	public function testMarriedSurnames() {
40323788f4SGreg Roach		$this->assertSame(false, $this->surname_tradition->hasMarriedNames());
41323788f4SGreg Roach	}
42323788f4SGreg Roach
43323788f4SGreg Roach	/**
44c1ec7145SGreg Roach	 * Test whether surnames are used
4517d74f3aSGreg Roach	 *
46*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
47c1ec7145SGreg Roach	 */
48c1ec7145SGreg Roach	public function testSurnames() {
49c1ec7145SGreg Roach		$this->assertSame(true, $this->surname_tradition->hasSurnames());
50c1ec7145SGreg Roach	}
51c1ec7145SGreg Roach
52c1ec7145SGreg Roach	/**
53323788f4SGreg Roach	 * Test new son names
5417d74f3aSGreg Roach	 *
55*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
56323788f4SGreg Roach	 */
57323788f4SGreg Roach	public function testNewSonNames() {
58323788f4SGreg Roach		$this->assertSame(
5913abd6f3SGreg Roach			['NAME' => '//'],
60323788f4SGreg Roach			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
61323788f4SGreg Roach		);
62323788f4SGreg Roach	}
63323788f4SGreg Roach
64323788f4SGreg Roach	/**
65323788f4SGreg Roach	 * Test new daughter names
6617d74f3aSGreg Roach	 *
67*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
68323788f4SGreg Roach	 */
69323788f4SGreg Roach	public function testNewDaughterNames() {
70323788f4SGreg Roach		$this->assertSame(
7113abd6f3SGreg Roach			['NAME' => '//'],
72323788f4SGreg Roach			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
73323788f4SGreg Roach		);
74323788f4SGreg Roach	}
75323788f4SGreg Roach
76323788f4SGreg Roach	/**
77323788f4SGreg Roach	 * Test new child names
7817d74f3aSGreg Roach	 *
79*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
80323788f4SGreg Roach	 */
81323788f4SGreg Roach	public function testNewChildNames() {
82323788f4SGreg Roach		$this->assertSame(
8313abd6f3SGreg Roach			['NAME' => '//'],
84323788f4SGreg Roach			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
85323788f4SGreg Roach		);
86323788f4SGreg Roach	}
87323788f4SGreg Roach
88323788f4SGreg Roach	/**
89323788f4SGreg Roach	 * Test new father names
9017d74f3aSGreg Roach	 *
91*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
92323788f4SGreg Roach	 */
93323788f4SGreg Roach	public function testNewFatherNames() {
94323788f4SGreg Roach		$this->assertSame(
9513abd6f3SGreg Roach			['NAME' => '//'],
96323788f4SGreg Roach			$this->surname_tradition->newParentNames('John /White/', 'M')
97323788f4SGreg Roach		);
98323788f4SGreg Roach	}
99323788f4SGreg Roach
100323788f4SGreg Roach	/**
101323788f4SGreg Roach	 * Test new mother names
10217d74f3aSGreg Roach	 *
103*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
104323788f4SGreg Roach	 */
105323788f4SGreg Roach	public function testNewMotherNames() {
106323788f4SGreg Roach		$this->assertSame(
10713abd6f3SGreg Roach			['NAME' => '//'],
108323788f4SGreg Roach			$this->surname_tradition->newParentNames('John /White/', 'F')
109323788f4SGreg Roach		);
110323788f4SGreg Roach	}
111323788f4SGreg Roach
112323788f4SGreg Roach	/**
113323788f4SGreg Roach	 * Test new parent names
11417d74f3aSGreg Roach	 *
115*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
116323788f4SGreg Roach	 */
117323788f4SGreg Roach	public function testNewParentNames() {
118323788f4SGreg Roach		$this->assertSame(
11913abd6f3SGreg Roach			['NAME' => '//'],
120323788f4SGreg Roach			$this->surname_tradition->newParentNames('John /White/', 'U')
121323788f4SGreg Roach		);
122323788f4SGreg Roach	}
123323788f4SGreg Roach
124323788f4SGreg Roach	/**
125323788f4SGreg Roach	 * Test new husband names
12617d74f3aSGreg Roach	 *
127*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
128323788f4SGreg Roach	 */
129323788f4SGreg Roach	public function testNewHusbandNames() {
130323788f4SGreg Roach		$this->assertSame(
13113abd6f3SGreg Roach			['NAME' => '//'],
132323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
133323788f4SGreg Roach		);
134323788f4SGreg Roach	}
135323788f4SGreg Roach
136323788f4SGreg Roach	/**
137323788f4SGreg Roach	 * Test new wife names
13817d74f3aSGreg Roach	 *
139*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
140323788f4SGreg Roach	 */
141323788f4SGreg Roach	public function testNewWifeNames() {
142323788f4SGreg Roach		$this->assertSame(
14313abd6f3SGreg Roach			['NAME' => '//'],
144323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('John /White/', 'F')
145323788f4SGreg Roach		);
146323788f4SGreg Roach	}
147323788f4SGreg Roach
148323788f4SGreg Roach	/**
149323788f4SGreg Roach	 * Test new spouse names
15017d74f3aSGreg Roach	 *
151*15d603e7SGreg Roach	 * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition
152323788f4SGreg Roach	 */
153323788f4SGreg Roach	public function testNewSpouseNames() {
154323788f4SGreg Roach		$this->assertSame(
15513abd6f3SGreg Roach			['NAME' => '//'],
156323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
157323788f4SGreg Roach		);
158323788f4SGreg Roach	}
159323788f4SGreg Roach}
160