1323788f4SGreg Roach<?php 2323788f4SGreg Roach/** 3323788f4SGreg Roach * webtrees: online genealogy 48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 5323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify 6323788f4SGreg Roach * it under the terms of the GNU General Public License as published by 7323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or 8323788f4SGreg Roach * (at your option) any later version. 9323788f4SGreg Roach * This program is distributed in the hope that it will be useful, 10323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 11323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12323788f4SGreg Roach * GNU General Public License for more details. 13323788f4SGreg Roach * You should have received a copy of the GNU General Public License 14323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 15323788f4SGreg Roach */ 16e7f56f2aSGreg Roachdeclare(strict_types=1); 17e7f56f2aSGreg Roach 1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 19c1010edaSGreg Roach 20323788f4SGreg Roach/** 21323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition 22323788f4SGreg Roach */ 2384e2cf4eSGreg Roachclass PolishSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase 24c1010edaSGreg Roach{ 25323788f4SGreg Roach /** @var SurnameTraditionInterface */ 26323788f4SGreg Roach private $surname_tradition; 27323788f4SGreg Roach 28323788f4SGreg Roach /** 29323788f4SGreg Roach * Prepare the environment for these tests 3052348eb8SGreg Roach * 3152348eb8SGreg Roach * @return void 32323788f4SGreg Roach */ 335c48bcd6SGreg Roach protected function setUp(): void 34c1010edaSGreg Roach { 350115bc16SGreg Roach parent::setUp(); 360115bc16SGreg Roach 3774d6dc0eSGreg Roach $this->surname_tradition = new PolishSurnameTradition(); 38323788f4SGreg Roach } 39323788f4SGreg Roach 40323788f4SGreg Roach /** 41323788f4SGreg Roach * Test whether married surnames are used 4217d74f3aSGreg Roach * 4315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 4415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 4552348eb8SGreg Roach * 4652348eb8SGreg Roach * @return void 47323788f4SGreg Roach */ 489b802b22SGreg Roach public function testMarriedSurnames(): void 49c1010edaSGreg Roach { 50*a32e6421SGreg Roach $this->assertTrue($this->surname_tradition->hasMarriedNames()); 51323788f4SGreg Roach } 52323788f4SGreg Roach 53323788f4SGreg Roach /** 54c1ec7145SGreg Roach * Test whether surnames are used 5517d74f3aSGreg Roach * 5615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 5715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 5852348eb8SGreg Roach * 5952348eb8SGreg Roach * @return void 60c1ec7145SGreg Roach */ 619b802b22SGreg Roach public function testSurnames(): void 62c1010edaSGreg Roach { 63*a32e6421SGreg Roach $this->assertTrue($this->surname_tradition->hasSurnames()); 64c1ec7145SGreg Roach } 65c1ec7145SGreg Roach 66c1ec7145SGreg Roach /** 67323788f4SGreg Roach * Test new son names 6817d74f3aSGreg Roach * 6915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 7015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 7152348eb8SGreg Roach * 7252348eb8SGreg Roach * @return void 73323788f4SGreg Roach */ 749b802b22SGreg Roach public function testNewSonNames(): void 75c1010edaSGreg Roach { 76323788f4SGreg Roach $this->assertSame( 77c1010edaSGreg Roach [ 78c1010edaSGreg Roach 'NAME' => '/White/', 79c1010edaSGreg Roach 'SURN' => 'White', 80c1010edaSGreg Roach ], 81323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 82323788f4SGreg Roach ); 83323788f4SGreg Roach } 84323788f4SGreg Roach 85323788f4SGreg Roach /** 86323788f4SGreg Roach * Test new daughter names 8717d74f3aSGreg Roach * 8815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 8915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 9052348eb8SGreg Roach * 9152348eb8SGreg Roach * @return void 92323788f4SGreg Roach */ 939b802b22SGreg Roach public function testNewDaughterNames(): void 94c1010edaSGreg Roach { 95323788f4SGreg Roach $this->assertSame( 96c1010edaSGreg Roach [ 97c1010edaSGreg Roach 'NAME' => '/White/', 98c1010edaSGreg Roach 'SURN' => 'White', 99c1010edaSGreg Roach ], 100323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 101323788f4SGreg Roach ); 102323788f4SGreg Roach } 103323788f4SGreg Roach 104323788f4SGreg Roach /** 105323788f4SGreg Roach * Test new daughter names 10617d74f3aSGreg Roach * 10715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 10815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 10952348eb8SGreg Roach * 11052348eb8SGreg Roach * @return void 111323788f4SGreg Roach */ 1129b802b22SGreg Roach public function testNewDaughterNamesInflected(): void 113c1010edaSGreg Roach { 114323788f4SGreg Roach $this->assertSame( 115c1010edaSGreg Roach [ 116c1010edaSGreg Roach 'NAME' => '/Whitecka/', 117c1010edaSGreg Roach 'SURN' => 'Whitecki', 118c1010edaSGreg Roach ], 119323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F') 120323788f4SGreg Roach ); 121323788f4SGreg Roach $this->assertSame( 122c1010edaSGreg Roach [ 123c1010edaSGreg Roach 'NAME' => '/Whitedzka/', 124c1010edaSGreg Roach 'SURN' => 'Whitedzki', 125c1010edaSGreg Roach ], 126323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F') 127323788f4SGreg Roach ); 128323788f4SGreg Roach $this->assertSame( 129c1010edaSGreg Roach [ 130c1010edaSGreg Roach 'NAME' => '/Whiteska/', 131c1010edaSGreg Roach 'SURN' => 'Whiteski', 132c1010edaSGreg Roach ], 133323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F') 134323788f4SGreg Roach ); 135323788f4SGreg Roach $this->assertSame( 136c1010edaSGreg Roach [ 137c1010edaSGreg Roach 'NAME' => '/Whiteżka/', 138c1010edaSGreg Roach 'SURN' => 'Whiteżki', 139c1010edaSGreg Roach ], 140323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F') 141323788f4SGreg Roach ); 142323788f4SGreg Roach } 143323788f4SGreg Roach 144323788f4SGreg Roach /** 145323788f4SGreg Roach * Test new child names 14617d74f3aSGreg Roach * 14715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 14815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 14952348eb8SGreg Roach * 15052348eb8SGreg Roach * @return void 151323788f4SGreg Roach */ 1529b802b22SGreg Roach public function testNewChildNames(): void 153c1010edaSGreg Roach { 154323788f4SGreg Roach $this->assertSame( 155c1010edaSGreg Roach [ 156c1010edaSGreg Roach 'NAME' => '/White/', 157c1010edaSGreg Roach 'SURN' => 'White', 158c1010edaSGreg Roach ], 159323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 160323788f4SGreg Roach ); 161323788f4SGreg Roach } 162323788f4SGreg Roach 163323788f4SGreg Roach /** 1641677a03aSGreg Roach * Test new child names 16517d74f3aSGreg Roach * 16615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 16715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 16852348eb8SGreg Roach * 16952348eb8SGreg Roach * @return void 1701677a03aSGreg Roach */ 1719b802b22SGreg Roach public function testNewChildNamesWithNoParentsNames(): void 172c1010edaSGreg Roach { 1731677a03aSGreg Roach $this->assertSame( 17413abd6f3SGreg Roach ['NAME' => '//'], 1751677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 1761677a03aSGreg Roach ); 1771677a03aSGreg Roach } 1781677a03aSGreg Roach 1791677a03aSGreg Roach /** 180323788f4SGreg Roach * Test new father names 18117d74f3aSGreg Roach * 18215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 18315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 18452348eb8SGreg Roach * 18552348eb8SGreg Roach * @return void 186323788f4SGreg Roach */ 1879b802b22SGreg Roach public function testNewFatherNames(): void 188c1010edaSGreg Roach { 189323788f4SGreg Roach $this->assertSame( 190c1010edaSGreg Roach [ 191c1010edaSGreg Roach 'NAME' => '/White/', 192c1010edaSGreg Roach 'SURN' => 'White', 193c1010edaSGreg Roach ], 194323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 195323788f4SGreg Roach ); 196323788f4SGreg Roach } 197323788f4SGreg Roach 198323788f4SGreg Roach /** 199323788f4SGreg Roach * Test new father names 20017d74f3aSGreg Roach * 20115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 20215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 20352348eb8SGreg Roach * 20452348eb8SGreg Roach * @return void 205323788f4SGreg Roach */ 2069b802b22SGreg Roach public function testNewFatherNamesInflected(): void 207c1010edaSGreg Roach { 208323788f4SGreg Roach $this->assertSame( 209c1010edaSGreg Roach [ 210c1010edaSGreg Roach 'NAME' => '/Whitecki/', 211c1010edaSGreg Roach 'SURN' => 'Whitecki', 212c1010edaSGreg Roach ], 213323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M') 214323788f4SGreg Roach ); 215323788f4SGreg Roach $this->assertSame( 216c1010edaSGreg Roach [ 217c1010edaSGreg Roach 'NAME' => '/Whitedzki/', 218c1010edaSGreg Roach 'SURN' => 'Whitedzki', 219c1010edaSGreg Roach ], 220323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M') 221323788f4SGreg Roach ); 222323788f4SGreg Roach $this->assertSame( 223c1010edaSGreg Roach [ 224c1010edaSGreg Roach 'NAME' => '/Whiteski/', 225c1010edaSGreg Roach 'SURN' => 'Whiteski', 226c1010edaSGreg Roach ], 227323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M') 228323788f4SGreg Roach ); 229323788f4SGreg Roach $this->assertSame( 230c1010edaSGreg Roach [ 231c1010edaSGreg Roach 'NAME' => '/Whiteżki/', 232c1010edaSGreg Roach 'SURN' => 'Whiteżki', 233c1010edaSGreg Roach ], 234323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M') 235323788f4SGreg Roach ); 236323788f4SGreg Roach } 237323788f4SGreg Roach 238323788f4SGreg Roach /** 239323788f4SGreg Roach * Test new mother names 24017d74f3aSGreg Roach * 24115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 24215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 24352348eb8SGreg Roach * 24452348eb8SGreg Roach * @return void 245323788f4SGreg Roach */ 2469b802b22SGreg Roach public function testNewMotherNames(): void 247c1010edaSGreg Roach { 248323788f4SGreg Roach $this->assertSame( 24913abd6f3SGreg Roach ['NAME' => '//'], 250323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 251323788f4SGreg Roach ); 252323788f4SGreg Roach } 253323788f4SGreg Roach 254323788f4SGreg Roach /** 255323788f4SGreg Roach * Test new parent names 25617d74f3aSGreg Roach * 25715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 25815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 25952348eb8SGreg Roach * 26052348eb8SGreg Roach * @return void 261323788f4SGreg Roach */ 2629b802b22SGreg Roach public function testNewParentNames(): void 263c1010edaSGreg Roach { 264323788f4SGreg Roach $this->assertSame( 26513abd6f3SGreg Roach ['NAME' => '//'], 266323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 267323788f4SGreg Roach ); 268323788f4SGreg Roach } 269323788f4SGreg Roach 270323788f4SGreg Roach /** 271323788f4SGreg Roach * Test new husband names 27217d74f3aSGreg Roach * 27315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 27415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 27552348eb8SGreg Roach * 27652348eb8SGreg Roach * @return void 277323788f4SGreg Roach */ 2789b802b22SGreg Roach public function testNewHusbandNames(): void 279c1010edaSGreg Roach { 280323788f4SGreg Roach $this->assertSame( 28113abd6f3SGreg Roach ['NAME' => '//'], 282323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 283323788f4SGreg Roach ); 284323788f4SGreg Roach } 285323788f4SGreg Roach 286323788f4SGreg Roach /** 287323788f4SGreg Roach * Test new wife names 28817d74f3aSGreg Roach * 28915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 29015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 29152348eb8SGreg Roach * 29252348eb8SGreg Roach * @return void 293323788f4SGreg Roach */ 2949b802b22SGreg Roach public function testNewWifeNames(): void 295c1010edaSGreg Roach { 296323788f4SGreg Roach $this->assertSame( 297c1010edaSGreg Roach [ 298c1010edaSGreg Roach 'NAME' => '//', 299c1010edaSGreg Roach '_MARNM' => '/White/', 300c1010edaSGreg Roach ], 301323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 302323788f4SGreg Roach ); 303323788f4SGreg Roach } 304323788f4SGreg Roach 305323788f4SGreg Roach /** 306323788f4SGreg Roach * Test new spouse names 30717d74f3aSGreg Roach * 30815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 30915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 31052348eb8SGreg Roach * 31152348eb8SGreg Roach * @return void 312323788f4SGreg Roach */ 3139b802b22SGreg Roach public function testNewSpouseNames(): void 314c1010edaSGreg Roach { 315323788f4SGreg Roach $this->assertSame( 31613abd6f3SGreg Roach ['NAME' => '//'], 317323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 318323788f4SGreg Roach ); 319323788f4SGreg Roach } 320323788f4SGreg Roach} 321