1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2018 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 */ 17 18use Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition; 19use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 20 21/** 22 * Test harness for the class SpanishSurnameTradition 23 */ 24class PortugueseSurnameTraditionTest extends \PHPUnit\Framework\TestCase 25{ 26 /** @var SurnameTraditionInterface */ 27 private $surname_tradition; 28 29 /** 30 * Prepare the environment for these tests 31 */ 32 public function setUp() 33 { 34 $this->surname_tradition = new PortugueseSurnameTradition; 35 } 36 37 /** 38 * Test whether married surnames are used 39 * 40 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 41 */ 42 public function testMarriedSurnames() 43 { 44 $this->assertSame(false, $this->surname_tradition->hasMarriedNames()); 45 } 46 47 /** 48 * Test whether surnames are used 49 * 50 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 51 */ 52 public function testSurnames() 53 { 54 $this->assertSame(true, $this->surname_tradition->hasSurnames()); 55 } 56 57 /** 58 * Test new son names 59 * 60 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 61 */ 62 public function testNewSonNames() 63 { 64 $this->assertSame( 65 [ 66 'NAME' => '/Iglesias/ /Lorca/', 67 'SURN' => 'Iglesias,Lorca', 68 ], 69 $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 70 ); 71 } 72 73 /** 74 * Test new daughter names 75 * 76 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 77 */ 78 public function testNewDaughterNames() 79 { 80 $this->assertSame( 81 [ 82 'NAME' => '/Iglesias/ /Lorca/', 83 'SURN' => 'Iglesias,Lorca', 84 ], 85 $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 86 ); 87 } 88 89 /** 90 * Test new child names 91 * 92 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 93 */ 94 public function testNewChildNames() 95 { 96 $this->assertSame( 97 [ 98 'NAME' => '/Iglesias/ /Lorca/', 99 'SURN' => 'Iglesias,Lorca', 100 ], 101 $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 102 ); 103 } 104 105 /** 106 * Test new child names 107 * 108 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 109 */ 110 public function testNewChildNamesWithNoParentsNames() 111 { 112 $this->assertSame( 113 [ 114 'NAME' => '// //', 115 'SURN' => '', 116 ], 117 $this->surname_tradition->newChildNames('', '', 'U') 118 ); 119 } 120 121 /** 122 * Test new child names 123 * 124 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 125 */ 126 public function testNewChildNamesCompunds() 127 { 128 $this->assertSame( 129 [ 130 'NAME' => '/Iglesias/ /Lorca/', 131 'SURN' => 'Iglesias,Lorca', 132 ], 133 $this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M') 134 ); 135 $this->assertSame( 136 [ 137 'NAME' => '/Iglesias/ /Lorca/', 138 'SURN' => 'Iglesias,Lorca', 139 ], 140 $this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M') 141 ); 142 } 143 144 /** 145 * Test new father names 146 * 147 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 148 */ 149 public function testNewFatherNames() 150 { 151 $this->assertSame( 152 [ 153 'NAME' => '// /Garcia/', 154 'SURN' => 'Garcia', 155 ], 156 $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M') 157 ); 158 } 159 160 /** 161 * Test new mother names 162 * 163 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 164 */ 165 public function testNewMotherNames() 166 { 167 $this->assertSame( 168 [ 169 'NAME' => '// /Iglesias/', 170 'SURN' => 'Iglesias', 171 ], 172 $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F') 173 ); 174 } 175 176 /** 177 * Test new parent names 178 * 179 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 180 */ 181 public function testNewParentNames() 182 { 183 $this->assertSame( 184 ['NAME' => '// //'], 185 $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U') 186 ); 187 } 188 189 /** 190 * Test new husband names 191 * 192 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 193 */ 194 public function testNewHusbandNames() 195 { 196 $this->assertSame( 197 ['NAME' => '// //'], 198 $this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M') 199 ); 200 } 201 202 /** 203 * Test new wife names 204 * 205 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 206 */ 207 public function testNewWifeNames() 208 { 209 $this->assertSame( 210 ['NAME' => '// //'], 211 $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F') 212 ); 213 } 214 215 /** 216 * Test new spouse names 217 * 218 * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 219 */ 220 public function testNewSpouseNames() 221 { 222 $this->assertSame( 223 ['NAME' => '// //'], 224 $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U') 225 ); 226 } 227} 228