1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2018 webtrees development team 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16declare(strict_types=1); 17 18namespace Fisharebest\Webtrees\SurnameTradition; 19 20/** 21 * Test harness for the class SpanishSurnameTradition 22 */ 23class PolishSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase 24{ 25 /** @var SurnameTraditionInterface */ 26 private $surname_tradition; 27 28 /** 29 * Prepare the environment for these tests 30 * 31 * @return void 32 */ 33 public function setUp() 34 { 35 $this->surname_tradition = new PolishSurnameTradition; 36 } 37 38 /** 39 * Test whether married surnames are used 40 * 41 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 42 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 43 * 44 * @return void 45 */ 46 public function testMarriedSurnames() 47 { 48 $this->assertSame(true, $this->surname_tradition->hasMarriedNames()); 49 } 50 51 /** 52 * Test whether surnames are used 53 * 54 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 55 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 56 * 57 * @return void 58 */ 59 public function testSurnames() 60 { 61 $this->assertSame(true, $this->surname_tradition->hasSurnames()); 62 } 63 64 /** 65 * Test new son names 66 * 67 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 68 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 69 * 70 * @return void 71 */ 72 public function testNewSonNames() 73 { 74 $this->assertSame( 75 [ 76 'NAME' => '/White/', 77 'SURN' => 'White', 78 ], 79 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 80 ); 81 } 82 83 /** 84 * Test new daughter names 85 * 86 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 87 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 88 * 89 * @return void 90 */ 91 public function testNewDaughterNames() 92 { 93 $this->assertSame( 94 [ 95 'NAME' => '/White/', 96 'SURN' => 'White', 97 ], 98 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 99 ); 100 } 101 102 /** 103 * Test new daughter names 104 * 105 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 106 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 107 * 108 * @return void 109 */ 110 public function testNewDaughterNamesInflected() 111 { 112 $this->assertSame( 113 [ 114 'NAME' => '/Whitecka/', 115 'SURN' => 'Whitecki', 116 ], 117 $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F') 118 ); 119 $this->assertSame( 120 [ 121 'NAME' => '/Whitedzka/', 122 'SURN' => 'Whitedzki', 123 ], 124 $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F') 125 ); 126 $this->assertSame( 127 [ 128 'NAME' => '/Whiteska/', 129 'SURN' => 'Whiteski', 130 ], 131 $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F') 132 ); 133 $this->assertSame( 134 [ 135 'NAME' => '/Whiteżka/', 136 'SURN' => 'Whiteżki', 137 ], 138 $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F') 139 ); 140 } 141 142 /** 143 * Test new child names 144 * 145 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 146 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 147 * 148 * @return void 149 */ 150 public function testNewChildNames() 151 { 152 $this->assertSame( 153 [ 154 'NAME' => '/White/', 155 'SURN' => 'White', 156 ], 157 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 158 ); 159 } 160 161 /** 162 * Test new child names 163 * 164 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 165 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 166 * 167 * @return void 168 */ 169 public function testNewChildNamesWithNoParentsNames() 170 { 171 $this->assertSame( 172 ['NAME' => '//'], 173 $this->surname_tradition->newChildNames('', '', 'U') 174 ); 175 } 176 177 /** 178 * Test new father names 179 * 180 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 181 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 182 * 183 * @return void 184 */ 185 public function testNewFatherNames() 186 { 187 $this->assertSame( 188 [ 189 'NAME' => '/White/', 190 'SURN' => 'White', 191 ], 192 $this->surname_tradition->newParentNames('John /White/', 'M') 193 ); 194 } 195 196 /** 197 * Test new father names 198 * 199 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 200 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 201 * 202 * @return void 203 */ 204 public function testNewFatherNamesInflected() 205 { 206 $this->assertSame( 207 [ 208 'NAME' => '/Whitecki/', 209 'SURN' => 'Whitecki', 210 ], 211 $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M') 212 ); 213 $this->assertSame( 214 [ 215 'NAME' => '/Whitedzki/', 216 'SURN' => 'Whitedzki', 217 ], 218 $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M') 219 ); 220 $this->assertSame( 221 [ 222 'NAME' => '/Whiteski/', 223 'SURN' => 'Whiteski', 224 ], 225 $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M') 226 ); 227 $this->assertSame( 228 [ 229 'NAME' => '/Whiteżki/', 230 'SURN' => 'Whiteżki', 231 ], 232 $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M') 233 ); 234 } 235 236 /** 237 * Test new mother names 238 * 239 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 240 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 241 * 242 * @return void 243 */ 244 public function testNewMotherNames() 245 { 246 $this->assertSame( 247 ['NAME' => '//'], 248 $this->surname_tradition->newParentNames('John /White/', 'F') 249 ); 250 } 251 252 /** 253 * Test new parent names 254 * 255 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 256 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 257 * 258 * @return void 259 */ 260 public function testNewParentNames() 261 { 262 $this->assertSame( 263 ['NAME' => '//'], 264 $this->surname_tradition->newParentNames('John /White/', 'U') 265 ); 266 } 267 268 /** 269 * Test new husband names 270 * 271 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 272 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 273 * 274 * @return void 275 */ 276 public function testNewHusbandNames() 277 { 278 $this->assertSame( 279 ['NAME' => '//'], 280 $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 281 ); 282 } 283 284 /** 285 * Test new wife names 286 * 287 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 288 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 289 * 290 * @return void 291 */ 292 public function testNewWifeNames() 293 { 294 $this->assertSame( 295 [ 296 'NAME' => '//', 297 '_MARNM' => '/White/', 298 ], 299 $this->surname_tradition->newSpouseNames('John /White/', 'F') 300 ); 301 } 302 303 /** 304 * Test new spouse names 305 * 306 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 307 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 308 * 309 * @return void 310 */ 311 public function testNewSpouseNames() 312 { 313 $this->assertSame( 314 ['NAME' => '//'], 315 $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 316 ); 317 } 318} 319