xref: /webtrees/tests/app/SurnameTradition/PatrilinealSurnameTraditionTest.php (revision 323788f4145f5a5554b028e0581a6e2063364968)
1*323788f4SGreg Roach<?php
2*323788f4SGreg Roach
3*323788f4SGreg Roach/**
4*323788f4SGreg Roach * webtrees: online genealogy
5*323788f4SGreg Roach * Copyright (C) 2015 webtrees development team
6*323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
7*323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
8*323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*323788f4SGreg Roach * (at your option) any later version.
10*323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
11*323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*323788f4SGreg Roach * GNU General Public License for more details.
14*323788f4SGreg Roach * You should have received a copy of the GNU General Public License
15*323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16*323788f4SGreg Roach */
17*323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition;
18*323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
19*323788f4SGreg Roach
20*323788f4SGreg Roach/**
21*323788f4SGreg Roach * Test harness for the class PatrilinenalSurnameTradition
22*323788f4SGreg Roach */
23*323788f4SGreg Roachclass PatrilinealSurnameTraditionTest extends PHPUnit_Framework_TestCase {
24*323788f4SGreg Roach	/** @var SurnameTraditionInterface */
25*323788f4SGreg Roach	private $surname_tradition;
26*323788f4SGreg Roach
27*323788f4SGreg Roach	/**
28*323788f4SGreg Roach	 * Prepare the environment for these tests
29*323788f4SGreg Roach	 */
30*323788f4SGreg Roach	public function setUp() {
31*323788f4SGreg Roach		$this->surname_tradition = new PatrilinealSurnameTradition;
32*323788f4SGreg Roach	}
33*323788f4SGreg Roach
34*323788f4SGreg Roach	/**
35*323788f4SGreg Roach	 * Test whether married surnames are used
36*323788f4SGreg Roach	 */
37*323788f4SGreg Roach	public function testMarriedSurnames() {
38*323788f4SGreg Roach		$this->assertSame(false, $this->surname_tradition->hasMarriedNames());
39*323788f4SGreg Roach	}
40*323788f4SGreg Roach
41*323788f4SGreg Roach	/**
42*323788f4SGreg Roach	 * Test new son names
43*323788f4SGreg Roach	 */
44*323788f4SGreg Roach	public function testNewSonNames() {
45*323788f4SGreg Roach		$this->assertSame(
46*323788f4SGreg Roach			array('NAME' => '/White/', 'SURN' => 'White'),
47*323788f4SGreg Roach			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
48*323788f4SGreg Roach		);
49*323788f4SGreg Roach	}
50*323788f4SGreg Roach
51*323788f4SGreg Roach	/**
52*323788f4SGreg Roach	 * Test new daughter names
53*323788f4SGreg Roach	 */
54*323788f4SGreg Roach	public function testNewDaughterNames() {
55*323788f4SGreg Roach		$this->assertSame(
56*323788f4SGreg Roach			array('NAME' => '/White/', 'SURN' => 'White'),
57*323788f4SGreg Roach			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
58*323788f4SGreg Roach		);
59*323788f4SGreg Roach	}
60*323788f4SGreg Roach
61*323788f4SGreg Roach	/**
62*323788f4SGreg Roach	 * Test new child names
63*323788f4SGreg Roach	 */
64*323788f4SGreg Roach	public function testNewChildNames() {
65*323788f4SGreg Roach		$this->assertSame(
66*323788f4SGreg Roach			array('NAME' => '/White/', 'SURN' => 'White'),
67*323788f4SGreg Roach			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
68*323788f4SGreg Roach		);
69*323788f4SGreg Roach	}
70*323788f4SGreg Roach
71*323788f4SGreg Roach	/**
72*323788f4SGreg Roach	 * Test new child names
73*323788f4SGreg Roach	 */
74*323788f4SGreg Roach	public function testNewChildNamesWithSpfx() {
75*323788f4SGreg Roach		$this->assertSame(
76*323788f4SGreg Roach			array('NAME' => '/de White/', 'SPFX' => 'de', 'SURN' => 'White'),
77*323788f4SGreg Roach			$this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U')
78*323788f4SGreg Roach		);
79*323788f4SGreg Roach	}
80*323788f4SGreg Roach
81*323788f4SGreg Roach	/**
82*323788f4SGreg Roach	 * Test new father names
83*323788f4SGreg Roach	 */
84*323788f4SGreg Roach	public function testNewFatherNames() {
85*323788f4SGreg Roach		$this->assertSame(
86*323788f4SGreg Roach			array('NAME' => '/White/', 'SURN' => 'White'),
87*323788f4SGreg Roach			$this->surname_tradition->newParentNames('John /White/', 'M')
88*323788f4SGreg Roach		);
89*323788f4SGreg Roach	}
90*323788f4SGreg Roach
91*323788f4SGreg Roach	/**
92*323788f4SGreg Roach	 * Test new mother names
93*323788f4SGreg Roach	 */
94*323788f4SGreg Roach	public function testNewMotherNames() {
95*323788f4SGreg Roach		$this->assertSame(
96*323788f4SGreg Roach			array('NAME' => '//'),
97*323788f4SGreg Roach			$this->surname_tradition->newParentNames('John /White/', 'F')
98*323788f4SGreg Roach		);
99*323788f4SGreg Roach	}
100*323788f4SGreg Roach
101*323788f4SGreg Roach	/**
102*323788f4SGreg Roach	 * Test new parent names
103*323788f4SGreg Roach	 */
104*323788f4SGreg Roach	public function testNewParentNames() {
105*323788f4SGreg Roach		$this->assertSame(
106*323788f4SGreg Roach			array('NAME' => '//'),
107*323788f4SGreg Roach			$this->surname_tradition->newParentNames('John /White/', 'U')
108*323788f4SGreg Roach		);
109*323788f4SGreg Roach	}
110*323788f4SGreg Roach
111*323788f4SGreg Roach	/**
112*323788f4SGreg Roach	 * Test new husband names
113*323788f4SGreg Roach	 */
114*323788f4SGreg Roach	public function testNewHusbandNames() {
115*323788f4SGreg Roach		$this->assertSame(
116*323788f4SGreg Roach			array('NAME' => '//'),
117*323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
118*323788f4SGreg Roach		);
119*323788f4SGreg Roach	}
120*323788f4SGreg Roach
121*323788f4SGreg Roach	/**
122*323788f4SGreg Roach	 * Test new wife names
123*323788f4SGreg Roach	 */
124*323788f4SGreg Roach	public function testNewWifeNames() {
125*323788f4SGreg Roach		$this->assertSame(
126*323788f4SGreg Roach			array('NAME' => '//'),
127*323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('John /White/', 'F')
128*323788f4SGreg Roach		);
129*323788f4SGreg Roach	}
130*323788f4SGreg Roach
131*323788f4SGreg Roach	/**
132*323788f4SGreg Roach	 * Test new spouse names
133*323788f4SGreg Roach	 */
134*323788f4SGreg Roach	public function testNewSpouseNames() {
135*323788f4SGreg Roach		$this->assertSame(
136*323788f4SGreg Roach			array('NAME' => '//'),
137*323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
138*323788f4SGreg Roach		);
139*323788f4SGreg Roach	}
140*323788f4SGreg Roach}
141