xref: /webtrees/tests/app/SurnameTradition/LithuanianSurnameTraditionTest.php (revision c1ec714599afaffe47dd397d7cd7830e06bebc26)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2015 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\LithuanianSurnameTradition;
18use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
19
20/**
21 * Test harness for the class SpanishSurnameTradition
22 */
23class LithuanianSurnameTraditionTest 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 LithuanianSurnameTradition;
32	}
33
34	/**
35	 * Test whether married surnames are used
36	 */
37	public function testMarriedSurnames() {
38		$this->assertSame(true, $this->surname_tradition->hasMarriedNames());
39	}
40
41	/**
42	 * Test whether surnames are used
43	 */
44	public function testSurnames() {
45		$this->assertSame(true, $this->surname_tradition->hasSurnames());
46	}
47
48	/**
49	 * Test new son names
50	 */
51	public function testNewSonNames() {
52		$this->assertSame(
53			array('NAME' => '/White/', 'SURN' => 'White'),
54			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M')
55		);
56	}
57
58	/**
59	 * Test new daughter names
60	 */
61	public function testNewDaughterNames() {
62		$this->assertSame(
63			array('NAME' => '/White/', 'SURN' => 'White'),
64			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F')
65		);
66	}
67
68	/**
69	 * Test new daughter names
70	 */
71	public function testNewDaughterNamesInflected() {
72		$this->assertSame(
73			array('NAME' => '/Whitaitė/', 'SURN' => 'Whita'),
74			$this->surname_tradition->newChildNames('John /Whita/', 'Mary /Black/', 'F')
75		);
76		$this->assertSame(
77			array('NAME' => '/Whitaitė/', 'SURN' => 'Whitas'),
78			$this->surname_tradition->newChildNames('John /Whitas/', 'Mary /Black/', 'F')
79		);
80		$this->assertSame(
81			array('NAME' => '/Whitytė/', 'SURN' => 'Whitis'),
82			$this->surname_tradition->newChildNames('John /Whitis/', 'Mary /Black/', 'F')
83		);
84		$this->assertSame(
85			array('NAME' => '/Whitytė/', 'SURN' => 'Whitys'),
86			$this->surname_tradition->newChildNames('John /Whitys/', 'Mary /Black/', 'F')
87		);
88		$this->assertSame(
89			array('NAME' => '/Whitiūtė/', 'SURN' => 'Whitius'),
90			$this->surname_tradition->newChildNames('John /Whitius/', 'Mary /Black/', 'F')
91		);
92		$this->assertSame(
93			array('NAME' => '/Whitutė/', 'SURN' => 'Whitus'),
94			$this->surname_tradition->newChildNames('John /Whitus/', 'Mary /Black/', 'F')
95		);
96	}
97
98	/**
99	 * Test new child names
100	 */
101	public function testNewChildNames() {
102		$this->assertSame(
103			array('NAME' => '/White/', 'SURN' => 'White'),
104			$this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U')
105		);
106	}
107
108	/**
109	 * Test new father names
110	 */
111	public function testNewFatherNames() {
112		$this->assertSame(
113			array('NAME' => '/White/', 'SURN' => 'White'),
114			$this->surname_tradition->newParentNames('John /White/', 'M')
115		);
116	}
117
118	/**
119	 * Test new father names
120	 */
121	public function testNewFatherNamesInflected() {
122		$this->assertSame(
123			array('NAME' => '/Whitas/', 'SURN' => 'Whitas'),
124			$this->surname_tradition->newParentNames('Mary /Whitaitė/', 'M')
125		);
126		$this->assertSame(
127			array('NAME' => '/Whitis/', 'SURN' => 'Whitis'),
128			$this->surname_tradition->newParentNames('Mary /Whitytė/', 'M')
129		);
130		$this->assertSame(
131			array('NAME' => '/Whitius/', 'SURN' => 'Whitius'),
132			$this->surname_tradition->newParentNames('Mary /Whitiūtė/', 'M')
133		);
134		$this->assertSame(
135			array('NAME' => '/Whitus/', 'SURN' => 'Whitus'),
136			$this->surname_tradition->newParentNames('Mary /Whitutė/', 'M')
137		);
138	}
139
140	/**
141	 * Test new mother names
142	 */
143	public function testNewMotherNames() {
144		$this->assertSame(
145			array('NAME' => '//'),
146			$this->surname_tradition->newParentNames('John /White/', 'F')
147		);
148	}
149
150	/**
151	 * Test new parent names
152	 */
153	public function testNewParentNames() {
154		$this->assertSame(
155			array('NAME' => '//'),
156			$this->surname_tradition->newParentNames('John /White/', 'U')
157		);
158	}
159
160	/**
161	 * Test new husband names
162	 */
163	public function testNewHusbandNames() {
164		$this->assertSame(
165			array('NAME' => '//'),
166			$this->surname_tradition->newSpouseNames('Mary /Black/', 'M')
167		);
168	}
169
170	/**
171	 * Test new wife names
172	 */
173	public function testNewWifeNames() {
174		$this->assertSame(
175			array('NAME' => '//', '_MARNM' => '/White/'),
176			$this->surname_tradition->newSpouseNames('John /White/', 'F')
177		);
178	}
179
180	/**
181	 * Test new spouse names
182	 */
183	public function testNewSpouseNames() {
184		$this->assertSame(
185			array('NAME' => '//'),
186			$this->surname_tradition->newSpouseNames('Chris /Green/', 'U')
187		);
188	}
189}
190