1323788f4SGreg Roach<?php 2323788f4SGreg Roach/** 3323788f4SGreg Roach * webtrees: online genealogy 41062a142SGreg Roach * Copyright (C) 2018 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 */ 16*e7f56f2aSGreg Roachdeclare(strict_types=1); 17*e7f56f2aSGreg Roach 1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 19c1010edaSGreg Roach 20323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition; 21323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 22323788f4SGreg Roach 23323788f4SGreg Roach/** 24323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition 25323788f4SGreg Roach */ 2684e2cf4eSGreg Roachclass PolishSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase 27c1010edaSGreg Roach{ 28323788f4SGreg Roach /** @var SurnameTraditionInterface */ 29323788f4SGreg Roach private $surname_tradition; 30323788f4SGreg Roach 31323788f4SGreg Roach /** 32323788f4SGreg Roach * Prepare the environment for these tests 3352348eb8SGreg Roach * 3452348eb8SGreg Roach * @return void 35323788f4SGreg Roach */ 36c1010edaSGreg Roach public function setUp() 37c1010edaSGreg Roach { 38323788f4SGreg Roach $this->surname_tradition = new PolishSurnameTradition; 39323788f4SGreg Roach } 40323788f4SGreg Roach 41323788f4SGreg Roach /** 42323788f4SGreg Roach * Test whether married surnames are used 4317d74f3aSGreg Roach * 4415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 4515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 4652348eb8SGreg Roach * 4752348eb8SGreg Roach * @return void 48323788f4SGreg Roach */ 49c1010edaSGreg Roach public function testMarriedSurnames() 50c1010edaSGreg Roach { 51323788f4SGreg Roach $this->assertSame(true, $this->surname_tradition->hasMarriedNames()); 52323788f4SGreg Roach } 53323788f4SGreg Roach 54323788f4SGreg Roach /** 55c1ec7145SGreg Roach * Test whether surnames are used 5617d74f3aSGreg Roach * 5715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 5815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 5952348eb8SGreg Roach * 6052348eb8SGreg Roach * @return void 61c1ec7145SGreg Roach */ 62c1010edaSGreg Roach public function testSurnames() 63c1010edaSGreg Roach { 64c1ec7145SGreg Roach $this->assertSame(true, $this->surname_tradition->hasSurnames()); 65c1ec7145SGreg Roach } 66c1ec7145SGreg Roach 67c1ec7145SGreg Roach /** 68323788f4SGreg Roach * Test new son names 6917d74f3aSGreg Roach * 7015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 7115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 7252348eb8SGreg Roach * 7352348eb8SGreg Roach * @return void 74323788f4SGreg Roach */ 75c1010edaSGreg Roach public function testNewSonNames() 76c1010edaSGreg Roach { 77323788f4SGreg Roach $this->assertSame( 78c1010edaSGreg Roach [ 79c1010edaSGreg Roach 'NAME' => '/White/', 80c1010edaSGreg Roach 'SURN' => 'White', 81c1010edaSGreg Roach ], 82323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 83323788f4SGreg Roach ); 84323788f4SGreg Roach } 85323788f4SGreg Roach 86323788f4SGreg Roach /** 87323788f4SGreg Roach * Test new daughter names 8817d74f3aSGreg Roach * 8915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 9015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 9152348eb8SGreg Roach * 9252348eb8SGreg Roach * @return void 93323788f4SGreg Roach */ 94c1010edaSGreg Roach public function testNewDaughterNames() 95c1010edaSGreg Roach { 96323788f4SGreg Roach $this->assertSame( 97c1010edaSGreg Roach [ 98c1010edaSGreg Roach 'NAME' => '/White/', 99c1010edaSGreg Roach 'SURN' => 'White', 100c1010edaSGreg Roach ], 101323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 102323788f4SGreg Roach ); 103323788f4SGreg Roach } 104323788f4SGreg Roach 105323788f4SGreg Roach /** 106323788f4SGreg Roach * Test new daughter names 10717d74f3aSGreg Roach * 10815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 10915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 11052348eb8SGreg Roach * 11152348eb8SGreg Roach * @return void 112323788f4SGreg Roach */ 113c1010edaSGreg Roach public function testNewDaughterNamesInflected() 114c1010edaSGreg Roach { 115323788f4SGreg Roach $this->assertSame( 116c1010edaSGreg Roach [ 117c1010edaSGreg Roach 'NAME' => '/Whitecka/', 118c1010edaSGreg Roach 'SURN' => 'Whitecki', 119c1010edaSGreg Roach ], 120323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F') 121323788f4SGreg Roach ); 122323788f4SGreg Roach $this->assertSame( 123c1010edaSGreg Roach [ 124c1010edaSGreg Roach 'NAME' => '/Whitedzka/', 125c1010edaSGreg Roach 'SURN' => 'Whitedzki', 126c1010edaSGreg Roach ], 127323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F') 128323788f4SGreg Roach ); 129323788f4SGreg Roach $this->assertSame( 130c1010edaSGreg Roach [ 131c1010edaSGreg Roach 'NAME' => '/Whiteska/', 132c1010edaSGreg Roach 'SURN' => 'Whiteski', 133c1010edaSGreg Roach ], 134323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F') 135323788f4SGreg Roach ); 136323788f4SGreg Roach $this->assertSame( 137c1010edaSGreg Roach [ 138c1010edaSGreg Roach 'NAME' => '/Whiteżka/', 139c1010edaSGreg Roach 'SURN' => 'Whiteżki', 140c1010edaSGreg Roach ], 141323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F') 142323788f4SGreg Roach ); 143323788f4SGreg Roach } 144323788f4SGreg Roach 145323788f4SGreg Roach /** 146323788f4SGreg Roach * Test new child names 14717d74f3aSGreg Roach * 14815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 14915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 15052348eb8SGreg Roach * 15152348eb8SGreg Roach * @return void 152323788f4SGreg Roach */ 153c1010edaSGreg Roach public function testNewChildNames() 154c1010edaSGreg Roach { 155323788f4SGreg Roach $this->assertSame( 156c1010edaSGreg Roach [ 157c1010edaSGreg Roach 'NAME' => '/White/', 158c1010edaSGreg Roach 'SURN' => 'White', 159c1010edaSGreg Roach ], 160323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 161323788f4SGreg Roach ); 162323788f4SGreg Roach } 163323788f4SGreg Roach 164323788f4SGreg Roach /** 1651677a03aSGreg Roach * Test new child names 16617d74f3aSGreg Roach * 16715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 16815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 16952348eb8SGreg Roach * 17052348eb8SGreg Roach * @return void 1711677a03aSGreg Roach */ 172c1010edaSGreg Roach public function testNewChildNamesWithNoParentsNames() 173c1010edaSGreg Roach { 1741677a03aSGreg Roach $this->assertSame( 17513abd6f3SGreg Roach ['NAME' => '//'], 1761677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 1771677a03aSGreg Roach ); 1781677a03aSGreg Roach } 1791677a03aSGreg Roach 1801677a03aSGreg Roach /** 181323788f4SGreg Roach * Test new father names 18217d74f3aSGreg Roach * 18315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 18415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 18552348eb8SGreg Roach * 18652348eb8SGreg Roach * @return void 187323788f4SGreg Roach */ 188c1010edaSGreg Roach public function testNewFatherNames() 189c1010edaSGreg Roach { 190323788f4SGreg Roach $this->assertSame( 191c1010edaSGreg Roach [ 192c1010edaSGreg Roach 'NAME' => '/White/', 193c1010edaSGreg Roach 'SURN' => 'White', 194c1010edaSGreg Roach ], 195323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 196323788f4SGreg Roach ); 197323788f4SGreg Roach } 198323788f4SGreg Roach 199323788f4SGreg Roach /** 200323788f4SGreg Roach * Test new father names 20117d74f3aSGreg Roach * 20215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 20315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 20452348eb8SGreg Roach * 20552348eb8SGreg Roach * @return void 206323788f4SGreg Roach */ 207c1010edaSGreg Roach public function testNewFatherNamesInflected() 208c1010edaSGreg Roach { 209323788f4SGreg Roach $this->assertSame( 210c1010edaSGreg Roach [ 211c1010edaSGreg Roach 'NAME' => '/Whitecki/', 212c1010edaSGreg Roach 'SURN' => 'Whitecki', 213c1010edaSGreg Roach ], 214323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M') 215323788f4SGreg Roach ); 216323788f4SGreg Roach $this->assertSame( 217c1010edaSGreg Roach [ 218c1010edaSGreg Roach 'NAME' => '/Whitedzki/', 219c1010edaSGreg Roach 'SURN' => 'Whitedzki', 220c1010edaSGreg Roach ], 221323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M') 222323788f4SGreg Roach ); 223323788f4SGreg Roach $this->assertSame( 224c1010edaSGreg Roach [ 225c1010edaSGreg Roach 'NAME' => '/Whiteski/', 226c1010edaSGreg Roach 'SURN' => 'Whiteski', 227c1010edaSGreg Roach ], 228323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M') 229323788f4SGreg Roach ); 230323788f4SGreg Roach $this->assertSame( 231c1010edaSGreg Roach [ 232c1010edaSGreg Roach 'NAME' => '/Whiteżki/', 233c1010edaSGreg Roach 'SURN' => 'Whiteżki', 234c1010edaSGreg Roach ], 235323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M') 236323788f4SGreg Roach ); 237323788f4SGreg Roach } 238323788f4SGreg Roach 239323788f4SGreg Roach /** 240323788f4SGreg Roach * Test new mother names 24117d74f3aSGreg Roach * 24215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 24315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 24452348eb8SGreg Roach * 24552348eb8SGreg Roach * @return void 246323788f4SGreg Roach */ 247c1010edaSGreg Roach public function testNewMotherNames() 248c1010edaSGreg Roach { 249323788f4SGreg Roach $this->assertSame( 25013abd6f3SGreg Roach ['NAME' => '//'], 251323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 252323788f4SGreg Roach ); 253323788f4SGreg Roach } 254323788f4SGreg Roach 255323788f4SGreg Roach /** 256323788f4SGreg Roach * Test new parent names 25717d74f3aSGreg Roach * 25815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 25915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 26052348eb8SGreg Roach * 26152348eb8SGreg Roach * @return void 262323788f4SGreg Roach */ 263c1010edaSGreg Roach public function testNewParentNames() 264c1010edaSGreg Roach { 265323788f4SGreg Roach $this->assertSame( 26613abd6f3SGreg Roach ['NAME' => '//'], 267323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 268323788f4SGreg Roach ); 269323788f4SGreg Roach } 270323788f4SGreg Roach 271323788f4SGreg Roach /** 272323788f4SGreg Roach * Test new husband names 27317d74f3aSGreg Roach * 27415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 27515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 27652348eb8SGreg Roach * 27752348eb8SGreg Roach * @return void 278323788f4SGreg Roach */ 279c1010edaSGreg Roach public function testNewHusbandNames() 280c1010edaSGreg Roach { 281323788f4SGreg Roach $this->assertSame( 28213abd6f3SGreg Roach ['NAME' => '//'], 283323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 284323788f4SGreg Roach ); 285323788f4SGreg Roach } 286323788f4SGreg Roach 287323788f4SGreg Roach /** 288323788f4SGreg Roach * Test new wife names 28917d74f3aSGreg Roach * 29015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 29115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 29252348eb8SGreg Roach * 29352348eb8SGreg Roach * @return void 294323788f4SGreg Roach */ 295c1010edaSGreg Roach public function testNewWifeNames() 296c1010edaSGreg Roach { 297323788f4SGreg Roach $this->assertSame( 298c1010edaSGreg Roach [ 299c1010edaSGreg Roach 'NAME' => '//', 300c1010edaSGreg Roach '_MARNM' => '/White/', 301c1010edaSGreg Roach ], 302323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 303323788f4SGreg Roach ); 304323788f4SGreg Roach } 305323788f4SGreg Roach 306323788f4SGreg Roach /** 307323788f4SGreg Roach * Test new spouse names 30817d74f3aSGreg Roach * 30915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 31015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 31152348eb8SGreg Roach * 31252348eb8SGreg Roach * @return void 313323788f4SGreg Roach */ 314c1010edaSGreg Roach public function testNewSpouseNames() 315c1010edaSGreg Roach { 316323788f4SGreg Roach $this->assertSame( 31713abd6f3SGreg Roach ['NAME' => '//'], 318323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 319323788f4SGreg Roach ); 320323788f4SGreg Roach } 321323788f4SGreg Roach} 322