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