xref: /webtrees/tests/app/SurnameTradition/PortugueseSurnameTraditionTest.php (revision db7d25eeb5ba43cdc3662cbee9ceabb8d61c7ab5)
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 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' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
54			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
55		);
56	}
57
58	/**
59	 * Test new daughter names
60	 */
61	public function testNewDaughterNames() {
62		$this->assertSame(
63			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
64			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
65		);
66	}
67
68	/**
69	 * Test new child names
70	 */
71	public function testNewChildNames() {
72		$this->assertSame(
73			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
74			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
75		);
76	}
77
78	/**
79	 * Test new child names
80	 */
81	public function testNewChildNamesCompunds() {
82		$this->assertSame(
83			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
84			$this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M')
85		);
86		$this->assertSame(
87			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
88			$this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M')
89		);
90	}
91
92	/**
93	 * Test new father names
94	 */
95	public function testNewFatherNames() {
96		$this->assertSame(
97			array('NAME' => '// /Garcia/', 'SURN' => 'Garcia'),
98			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M')
99		);
100	}
101
102	/**
103	 * Test new mother names
104	 */
105	public function testNewMotherNames() {
106		$this->assertSame(
107			array('NAME' => '// /Iglesias/', 'SURN' => 'Iglesias'),
108			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F')
109		);
110	}
111
112	/**
113	 * Test new parent names
114	 */
115	public function testNewParentNames() {
116		$this->assertSame(
117			array('NAME' => '// //'),
118			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U')
119		);
120	}
121
122	/**
123	 * Test new husband names
124	 */
125	public function testNewHusbandNames() {
126		$this->assertSame(
127			array('NAME' => '// //'),
128			$this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M')
129		);
130	}
131
132	/**
133	 * Test new wife names
134	 */
135	public function testNewWifeNames() {
136		$this->assertSame(
137			array('NAME' => '// //'),
138			$this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F')
139		);
140	}
141
142	/**
143	 * Test new spouse names
144	 */
145	public function testNewSpouseNames() {
146		$this->assertSame(
147			array('NAME' => '// //'),
148			$this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U')
149		);
150	}
151}
152