xref: /webtrees/tests/app/SurnameTradition/PortugueseSurnameTraditionTest.php (revision c1ec714599afaffe47dd397d7cd7830e06bebc26)
1323788f4SGreg Roach<?php
2323788f4SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
5323788f4SGreg Roach * Copyright (C) 2015 webtrees development team
6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9323788f4SGreg Roach * (at your option) any later version.
10323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13323788f4SGreg Roach * GNU General Public License for more details.
14323788f4SGreg Roach * You should have received a copy of the GNU General Public License
15323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16323788f4SGreg Roach */
17323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition;
18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface;
19323788f4SGreg Roach
20323788f4SGreg Roach/**
21323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition
22323788f4SGreg Roach */
23323788f4SGreg Roachclass PortugueseSurnameTraditionTest extends PHPUnit_Framework_TestCase {
24323788f4SGreg Roach	/** @var SurnameTraditionInterface */
25323788f4SGreg Roach	private $surname_tradition;
26323788f4SGreg Roach
27323788f4SGreg Roach	/**
28323788f4SGreg Roach	 * Prepare the environment for these tests
29323788f4SGreg Roach	 */
30323788f4SGreg Roach	public function setUp() {
31323788f4SGreg Roach		$this->surname_tradition = new PortugueseSurnameTradition;
32323788f4SGreg Roach	}
33323788f4SGreg Roach
34323788f4SGreg Roach	/**
35323788f4SGreg Roach	 * Test whether married surnames are used
36323788f4SGreg Roach	 */
37323788f4SGreg Roach	public function testMarriedSurnames() {
38323788f4SGreg Roach		$this->assertSame(false, $this->surname_tradition->hasMarriedNames());
39323788f4SGreg Roach	}
40323788f4SGreg Roach
41323788f4SGreg Roach	/**
42*c1ec7145SGreg Roach	 * Test whether surnames are used
43*c1ec7145SGreg Roach	 */
44*c1ec7145SGreg Roach	public function testSurnames() {
45*c1ec7145SGreg Roach		$this->assertSame(true, $this->surname_tradition->hasSurnames());
46*c1ec7145SGreg Roach	}
47*c1ec7145SGreg Roach
48*c1ec7145SGreg Roach	/**
49323788f4SGreg Roach	 * Test new son names
50323788f4SGreg Roach	 */
51323788f4SGreg Roach	public function testNewSonNames() {
52323788f4SGreg Roach		$this->assertSame(
53323788f4SGreg Roach			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
54323788f4SGreg Roach			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
55323788f4SGreg Roach		);
56323788f4SGreg Roach	}
57323788f4SGreg Roach
58323788f4SGreg Roach	/**
59323788f4SGreg Roach	 * Test new daughter names
60323788f4SGreg Roach	 */
61323788f4SGreg Roach	public function testNewDaughterNames() {
62323788f4SGreg Roach		$this->assertSame(
63323788f4SGreg Roach			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
64323788f4SGreg Roach			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
65323788f4SGreg Roach		);
66323788f4SGreg Roach	}
67323788f4SGreg Roach
68323788f4SGreg Roach	/**
69323788f4SGreg Roach	 * Test new child names
70323788f4SGreg Roach	 */
71323788f4SGreg Roach	public function testNewChildNames() {
72323788f4SGreg Roach		$this->assertSame(
73323788f4SGreg Roach			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
74323788f4SGreg Roach			$this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M')
75323788f4SGreg Roach		);
76323788f4SGreg Roach	}
77323788f4SGreg Roach
78323788f4SGreg Roach	/**
79323788f4SGreg Roach	 * Test new child names
80323788f4SGreg Roach	 */
81323788f4SGreg Roach	public function testNewChildNamesCompunds() {
82323788f4SGreg Roach		$this->assertSame(
83323788f4SGreg Roach			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
84323788f4SGreg Roach			$this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M')
85323788f4SGreg Roach		);
86323788f4SGreg Roach		$this->assertSame(
87323788f4SGreg Roach			array('NAME' => '/Iglesias/ /Lorca/', 'SURN' => 'Iglesias,Lorca'),
88323788f4SGreg Roach			$this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M')
89323788f4SGreg Roach		);
90323788f4SGreg Roach	}
91323788f4SGreg Roach
92323788f4SGreg Roach	/**
93323788f4SGreg Roach	 * Test new father names
94323788f4SGreg Roach	 */
95323788f4SGreg Roach	public function testNewFatherNames() {
96323788f4SGreg Roach		$this->assertSame(
97323788f4SGreg Roach			array('NAME' => '// /Garcia/', 'SURN' => 'Garcia'),
98323788f4SGreg Roach			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M')
99323788f4SGreg Roach		);
100323788f4SGreg Roach	}
101323788f4SGreg Roach
102323788f4SGreg Roach	/**
103323788f4SGreg Roach	 * Test new mother names
104323788f4SGreg Roach	 */
105323788f4SGreg Roach	public function testNewMotherNames() {
106323788f4SGreg Roach		$this->assertSame(
107323788f4SGreg Roach			array('NAME' => '// /Iglesias/', 'SURN' => 'Iglesias'),
108323788f4SGreg Roach			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F')
109323788f4SGreg Roach		);
110323788f4SGreg Roach	}
111323788f4SGreg Roach
112323788f4SGreg Roach	/**
113323788f4SGreg Roach	 * Test new parent names
114323788f4SGreg Roach	 */
115323788f4SGreg Roach	public function testNewParentNames() {
116323788f4SGreg Roach		$this->assertSame(
117323788f4SGreg Roach			array('NAME' => '// //'),
118323788f4SGreg Roach			$this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U')
119323788f4SGreg Roach		);
120323788f4SGreg Roach	}
121323788f4SGreg Roach
122323788f4SGreg Roach	/**
123323788f4SGreg Roach	 * Test new husband names
124323788f4SGreg Roach	 */
125323788f4SGreg Roach	public function testNewHusbandNames() {
126323788f4SGreg Roach		$this->assertSame(
127323788f4SGreg Roach			array('NAME' => '// //'),
128323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M')
129323788f4SGreg Roach		);
130323788f4SGreg Roach	}
131323788f4SGreg Roach
132323788f4SGreg Roach	/**
133323788f4SGreg Roach	 * Test new wife names
134323788f4SGreg Roach	 */
135323788f4SGreg Roach	public function testNewWifeNames() {
136323788f4SGreg Roach		$this->assertSame(
137323788f4SGreg Roach			array('NAME' => '// //'),
138323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F')
139323788f4SGreg Roach		);
140323788f4SGreg Roach	}
141323788f4SGreg Roach
142323788f4SGreg Roach	/**
143323788f4SGreg Roach	 * Test new spouse names
144323788f4SGreg Roach	 */
145323788f4SGreg Roach	public function testNewSpouseNames() {
146323788f4SGreg Roach		$this->assertSame(
147323788f4SGreg Roach			array('NAME' => '// //'),
148323788f4SGreg Roach			$this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U')
149323788f4SGreg Roach		);
150323788f4SGreg Roach	}
151323788f4SGreg Roach}
152