xref: /webtrees/tests/app/SurnameTradition/PortugueseSurnameTraditionTest.php (revision 323788f4145f5a5554b028e0581a6e2063364968)
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\PortugueseSurnameTradition;
18use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
19
20/**
21 * Test harness for the class SpanishSurnameTradition
22 */
23class PortugueseSurnameTraditionTest 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 PortugueseSurnameTradition;
32	}
33
34	/**
35	 * Test whether married surnames are used
36	 */
37	public function testMarriedSurnames() {
38		$this->assertSame(false, $this->surname_tradition->hasMarriedNames());
39	}
40
41	/**
42	 * Test new son names
43	 */
44	public function testNewSonNames() {
45		$this->assertSame(
46			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
47			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
48		);
49	}
50
51	/**
52	 * Test new daughter names
53	 */
54	public function testNewDaughterNames() {
55		$this->assertSame(
56			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
57			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
58		);
59	}
60
61	/**
62	 * Test new child names
63	 */
64	public function testNewChildNames() {
65		$this->assertSame(
66			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
67			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
68		);
69	}
70
71	/**
72	 * Test new child names
73	 */
74	public function testNewChildNamesCompunds() {
75		$this->assertSame(
76			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
77			$this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M')
78		);
79		$this->assertSame(
80			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
81			$this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M')
82		);
83	}
84
85	/**
86	 * Test new father names
87	 */
88	public function testNewFatherNames() {
89		$this->assertSame(
90			array('NAME' => '// /Garcia/', 'SURN' => 'Garcia'),
91			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M')
92		);
93	}
94
95	/**
96	 * Test new mother names
97	 */
98	public function testNewMotherNames() {
99		$this->assertSame(
100			array('NAME' => '// /Iglesias/', 'SURN' => 'Iglesias'),
101			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F')
102		);
103	}
104
105	/**
106	 * Test new parent names
107	 */
108	public function testNewParentNames() {
109		$this->assertSame(
110			array('NAME' => '// //'),
111			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U')
112		);
113	}
114
115	/**
116	 * Test new husband names
117	 */
118	public function testNewHusbandNames() {
119		$this->assertSame(
120			array('NAME' => '// //'),
121			$this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M')
122		);
123	}
124
125	/**
126	 * Test new wife names
127	 */
128	public function testNewWifeNames() {
129		$this->assertSame(
130			array('NAME' => '// //'),
131			$this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F')
132		);
133	}
134
135	/**
136	 * Test new spouse names
137	 */
138	public function testNewSpouseNames() {
139		$this->assertSame(
140			array('NAME' => '// //'),
141			$this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U')
142		);
143	}
144}
145