1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2019 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 protected function setUp() 34 { 35 parent::setUp(); 36 37 $this->surname_tradition = new PolishSurnameTradition; 38 } 39 40 /** 41 * Test whether married surnames are used 42 * 43 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 44 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 45 * 46 * @return void 47 */ 48 public function testMarriedSurnames(): void 49 { 50 $this->assertSame(true, $this->surname_tradition->hasMarriedNames()); 51 } 52 53 /** 54 * Test whether surnames are used 55 * 56 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 57 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 58 * 59 * @return void 60 */ 61 public function testSurnames(): void 62 { 63 $this->assertSame(true, $this->surname_tradition->hasSurnames()); 64 } 65 66 /** 67 * Test new son names 68 * 69 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 70 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 71 * 72 * @return void 73 */ 74 public function testNewSonNames(): void 75 { 76 $this->assertSame( 77 [ 78 'NAME' => '/White/', 79 'SURN' => 'White', 80 ], 81 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 82 ); 83 } 84 85 /** 86 * Test new daughter names 87 * 88 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 89 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 90 * 91 * @return void 92 */ 93 public function testNewDaughterNames(): void 94 { 95 $this->assertSame( 96 [ 97 'NAME' => '/White/', 98 'SURN' => 'White', 99 ], 100 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 101 ); 102 } 103 104 /** 105 * Test new daughter names 106 * 107 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 108 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 109 * 110 * @return void 111 */ 112 public function testNewDaughterNamesInflected(): void 113 { 114 $this->assertSame( 115 [ 116 'NAME' => '/Whitecka/', 117 'SURN' => 'Whitecki', 118 ], 119 $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F') 120 ); 121 $this->assertSame( 122 [ 123 'NAME' => '/Whitedzka/', 124 'SURN' => 'Whitedzki', 125 ], 126 $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F') 127 ); 128 $this->assertSame( 129 [ 130 'NAME' => '/Whiteska/', 131 'SURN' => 'Whiteski', 132 ], 133 $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F') 134 ); 135 $this->assertSame( 136 [ 137 'NAME' => '/Whiteżka/', 138 'SURN' => 'Whiteżki', 139 ], 140 $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F') 141 ); 142 } 143 144 /** 145 * Test new child names 146 * 147 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 148 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 149 * 150 * @return void 151 */ 152 public function testNewChildNames(): void 153 { 154 $this->assertSame( 155 [ 156 'NAME' => '/White/', 157 'SURN' => 'White', 158 ], 159 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 160 ); 161 } 162 163 /** 164 * Test new child names 165 * 166 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 167 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 168 * 169 * @return void 170 */ 171 public function testNewChildNamesWithNoParentsNames(): void 172 { 173 $this->assertSame( 174 ['NAME' => '//'], 175 $this->surname_tradition->newChildNames('', '', 'U') 176 ); 177 } 178 179 /** 180 * Test new father names 181 * 182 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 183 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 184 * 185 * @return void 186 */ 187 public function testNewFatherNames(): void 188 { 189 $this->assertSame( 190 [ 191 'NAME' => '/White/', 192 'SURN' => 'White', 193 ], 194 $this->surname_tradition->newParentNames('John /White/', 'M') 195 ); 196 } 197 198 /** 199 * Test new father names 200 * 201 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 202 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 203 * 204 * @return void 205 */ 206 public function testNewFatherNamesInflected(): void 207 { 208 $this->assertSame( 209 [ 210 'NAME' => '/Whitecki/', 211 'SURN' => 'Whitecki', 212 ], 213 $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M') 214 ); 215 $this->assertSame( 216 [ 217 'NAME' => '/Whitedzki/', 218 'SURN' => 'Whitedzki', 219 ], 220 $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M') 221 ); 222 $this->assertSame( 223 [ 224 'NAME' => '/Whiteski/', 225 'SURN' => 'Whiteski', 226 ], 227 $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M') 228 ); 229 $this->assertSame( 230 [ 231 'NAME' => '/Whiteżki/', 232 'SURN' => 'Whiteżki', 233 ], 234 $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M') 235 ); 236 } 237 238 /** 239 * Test new mother names 240 * 241 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 242 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 243 * 244 * @return void 245 */ 246 public function testNewMotherNames(): void 247 { 248 $this->assertSame( 249 ['NAME' => '//'], 250 $this->surname_tradition->newParentNames('John /White/', 'F') 251 ); 252 } 253 254 /** 255 * Test new parent names 256 * 257 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 258 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 259 * 260 * @return void 261 */ 262 public function testNewParentNames(): void 263 { 264 $this->assertSame( 265 ['NAME' => '//'], 266 $this->surname_tradition->newParentNames('John /White/', 'U') 267 ); 268 } 269 270 /** 271 * Test new husband names 272 * 273 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 274 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 275 * 276 * @return void 277 */ 278 public function testNewHusbandNames(): void 279 { 280 $this->assertSame( 281 ['NAME' => '//'], 282 $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 283 ); 284 } 285 286 /** 287 * Test new wife names 288 * 289 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 290 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 291 * 292 * @return void 293 */ 294 public function testNewWifeNames(): void 295 { 296 $this->assertSame( 297 [ 298 'NAME' => '//', 299 '_MARNM' => '/White/', 300 ], 301 $this->surname_tradition->newSpouseNames('John /White/', 'F') 302 ); 303 } 304 305 /** 306 * Test new spouse names 307 * 308 * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 309 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 310 * 311 * @return void 312 */ 313 public function testNewSpouseNames(): void 314 { 315 $this->assertSame( 316 ['NAME' => '//'], 317 $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 318 ); 319 } 320} 321