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