1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>. 16 */ 17use Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition; 18use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 19 20/** 21 * Test harness for the class SpanishSurnameTradition 22 */ 23class PolishSurnameTraditionTest extends \PHPUnit_Framework_TestCase { 24 /** @var SurnameTraditionInterface */ 25 private $surname_tradition; 26 27 /** 28 * Prepare the environment for these tests 29 */ 30 public function setUp() { 31 $this->surname_tradition = new PolishSurnameTradition; 32 } 33 34 /** 35 * Test whether married surnames are used 36 * 37 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 38 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 39 */ 40 public function testMarriedSurnames() { 41 $this->assertSame(true, $this->surname_tradition->hasMarriedNames()); 42 } 43 44 /** 45 * Test whether surnames are used 46 * 47 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 48 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 49 */ 50 public function testSurnames() { 51 $this->assertSame(true, $this->surname_tradition->hasSurnames()); 52 } 53 54 /** 55 * Test new son names 56 * 57 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 58 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 59 */ 60 public function testNewSonNames() { 61 $this->assertSame( 62 ['NAME' => '/White/', 'SURN' => 'White'], 63 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 64 ); 65 } 66 67 /** 68 * Test new daughter names 69 * 70 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 71 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 72 */ 73 public function testNewDaughterNames() { 74 $this->assertSame( 75 ['NAME' => '/White/', 'SURN' => 'White'], 76 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 77 ); 78 } 79 80 /** 81 * Test new daughter names 82 * 83 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 84 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 85 */ 86 public function testNewDaughterNamesInflected() { 87 $this->assertSame( 88 ['NAME' => '/Whitecka/', 'SURN' => 'Whitecki'], 89 $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F') 90 ); 91 $this->assertSame( 92 ['NAME' => '/Whitedzka/', 'SURN' => 'Whitedzki'], 93 $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F') 94 ); 95 $this->assertSame( 96 ['NAME' => '/Whiteska/', 'SURN' => 'Whiteski'], 97 $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F') 98 ); 99 $this->assertSame( 100 ['NAME' => '/Whiteżka/', 'SURN' => 'Whiteżki'], 101 $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F') 102 ); 103 } 104 105 /** 106 * Test new child names 107 * 108 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 109 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 110 */ 111 public function testNewChildNames() { 112 $this->assertSame( 113 ['NAME' => '/White/', 'SURN' => 'White'], 114 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 115 ); 116 } 117 118 /** 119 * Test new child names 120 * 121 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 122 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 123 */ 124 public function testNewChildNamesWithNoParentsNames() { 125 $this->assertSame( 126 ['NAME' => '//'], 127 $this->surname_tradition->newChildNames('', '', 'U') 128 ); 129 } 130 131 /** 132 * Test new father names 133 * 134 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 135 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 136 */ 137 public function testNewFatherNames() { 138 $this->assertSame( 139 ['NAME' => '/White/', 'SURN' => 'White'], 140 $this->surname_tradition->newParentNames('John /White/', 'M') 141 ); 142 } 143 144 /** 145 * Test new father names 146 * 147 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 148 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 149 */ 150 public function testNewFatherNamesInflected() { 151 $this->assertSame( 152 ['NAME' => '/Whitecki/', 'SURN' => 'Whitecki'], 153 $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M') 154 ); 155 $this->assertSame( 156 ['NAME' => '/Whitedzki/', 'SURN' => 'Whitedzki'], 157 $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M') 158 ); 159 $this->assertSame( 160 ['NAME' => '/Whiteski/', 'SURN' => 'Whiteski'], 161 $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M') 162 ); 163 $this->assertSame( 164 ['NAME' => '/Whiteżki/', 'SURN' => 'Whiteżki'], 165 $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M') 166 ); 167 } 168 169 /** 170 * Test new mother names 171 * 172 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 173 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 174 */ 175 public function testNewMotherNames() { 176 $this->assertSame( 177 ['NAME' => '//'], 178 $this->surname_tradition->newParentNames('John /White/', 'F') 179 ); 180 } 181 182 /** 183 * Test new parent names 184 * 185 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 186 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 187 */ 188 public function testNewParentNames() { 189 $this->assertSame( 190 ['NAME' => '//'], 191 $this->surname_tradition->newParentNames('John /White/', 'U') 192 ); 193 } 194 195 /** 196 * Test new husband names 197 * 198 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 199 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 200 */ 201 public function testNewHusbandNames() { 202 $this->assertSame( 203 ['NAME' => '//'], 204 $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 205 ); 206 } 207 208 /** 209 * Test new wife names 210 * 211 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 212 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 213 */ 214 public function testNewWifeNames() { 215 $this->assertSame( 216 ['NAME' => '//', '_MARNM' => '/White/'], 217 $this->surname_tradition->newSpouseNames('John /White/', 'F') 218 ); 219 } 220 221 /** 222 * Test new spouse names 223 * 224 * @covers Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 225 * @covers Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 226 */ 227 public function testNewSpouseNames() { 228 $this->assertSame( 229 ['NAME' => '//'], 230 $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 231 ); 232 } 233} 234