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