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