1323788f4SGreg Roach<?php 23976b470SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 5*89f7189bSGreg Roach * Copyright (C) 2021 webtrees development team 6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify 7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by 8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9323788f4SGreg Roach * (at your option) any later version. 10323788f4SGreg Roach * This program is distributed in the hope that it will be useful, 11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13323788f4SGreg Roach * GNU General Public License for more details. 14323788f4SGreg Roach * You should have received a copy of the GNU General Public License 15*89f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16323788f4SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 2084e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 21c1010edaSGreg Roach 223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase; 233cfcc809SGreg Roach 24323788f4SGreg Roach/** 25323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition 26323788f4SGreg Roach */ 273cfcc809SGreg Roachclass PolishSurnameTraditionTest extends TestCase 28c1010edaSGreg Roach{ 29323788f4SGreg Roach /** @var SurnameTraditionInterface */ 30323788f4SGreg Roach private $surname_tradition; 31323788f4SGreg Roach 32323788f4SGreg Roach /** 33323788f4SGreg Roach * Prepare the environment for these tests 3452348eb8SGreg Roach * 3552348eb8SGreg Roach * @return void 36323788f4SGreg Roach */ 375c48bcd6SGreg Roach protected function setUp(): void 38c1010edaSGreg Roach { 390115bc16SGreg Roach parent::setUp(); 400115bc16SGreg Roach 4174d6dc0eSGreg Roach $this->surname_tradition = new PolishSurnameTradition(); 42323788f4SGreg Roach } 43323788f4SGreg Roach 44323788f4SGreg Roach /** 45323788f4SGreg Roach * Test whether married surnames are used 4617d74f3aSGreg Roach * 4715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 4815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 4952348eb8SGreg Roach * 5052348eb8SGreg Roach * @return void 51323788f4SGreg Roach */ 529b802b22SGreg Roach public function testMarriedSurnames(): void 53c1010edaSGreg Roach { 545e933c21SGreg Roach self::assertTrue($this->surname_tradition->hasMarriedNames()); 55323788f4SGreg Roach } 56323788f4SGreg Roach 57323788f4SGreg Roach /** 58c1ec7145SGreg Roach * Test whether surnames are used 5917d74f3aSGreg Roach * 6015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 6115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 6252348eb8SGreg Roach * 6352348eb8SGreg Roach * @return void 64c1ec7145SGreg Roach */ 659b802b22SGreg Roach public function testSurnames(): void 66c1010edaSGreg Roach { 675e933c21SGreg Roach self::assertTrue($this->surname_tradition->hasSurnames()); 68c1ec7145SGreg Roach } 69c1ec7145SGreg Roach 70c1ec7145SGreg Roach /** 71323788f4SGreg Roach * Test new son names 7217d74f3aSGreg Roach * 7315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 7415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 7552348eb8SGreg Roach * 7652348eb8SGreg Roach * @return void 77323788f4SGreg Roach */ 789b802b22SGreg Roach public function testNewSonNames(): void 79c1010edaSGreg Roach { 805e933c21SGreg Roach self::assertSame( 81c1010edaSGreg Roach [ 82c1010edaSGreg Roach 'NAME' => '/White/', 83c1010edaSGreg Roach 'SURN' => 'White', 84c1010edaSGreg Roach ], 85323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 86323788f4SGreg Roach ); 87323788f4SGreg Roach } 88323788f4SGreg Roach 89323788f4SGreg Roach /** 90323788f4SGreg Roach * Test new daughter names 9117d74f3aSGreg Roach * 9215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 9315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 9452348eb8SGreg Roach * 9552348eb8SGreg Roach * @return void 96323788f4SGreg Roach */ 979b802b22SGreg Roach public function testNewDaughterNames(): void 98c1010edaSGreg Roach { 995e933c21SGreg Roach self::assertSame( 100c1010edaSGreg Roach [ 101c1010edaSGreg Roach 'NAME' => '/White/', 102c1010edaSGreg Roach 'SURN' => 'White', 103c1010edaSGreg Roach ], 104323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 105323788f4SGreg Roach ); 106323788f4SGreg Roach } 107323788f4SGreg Roach 108323788f4SGreg Roach /** 109323788f4SGreg Roach * Test new daughter names 11017d74f3aSGreg Roach * 11115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 11215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 11352348eb8SGreg Roach * 11452348eb8SGreg Roach * @return void 115323788f4SGreg Roach */ 1169b802b22SGreg Roach public function testNewDaughterNamesInflected(): void 117c1010edaSGreg Roach { 1185e933c21SGreg Roach self::assertSame( 119c1010edaSGreg Roach [ 120c1010edaSGreg Roach 'NAME' => '/Whitecka/', 121c1010edaSGreg Roach 'SURN' => 'Whitecki', 122c1010edaSGreg Roach ], 123323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whitecki/', 'Mary /Black/', 'F') 124323788f4SGreg Roach ); 1255e933c21SGreg Roach self::assertSame( 126c1010edaSGreg Roach [ 127c1010edaSGreg Roach 'NAME' => '/Whitedzka/', 128c1010edaSGreg Roach 'SURN' => 'Whitedzki', 129c1010edaSGreg Roach ], 130323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whitedzki/', 'Mary /Black/', 'F') 131323788f4SGreg Roach ); 1325e933c21SGreg Roach self::assertSame( 133c1010edaSGreg Roach [ 134c1010edaSGreg Roach 'NAME' => '/Whiteska/', 135c1010edaSGreg Roach 'SURN' => 'Whiteski', 136c1010edaSGreg Roach ], 137323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whiteski/', 'Mary /Black/', 'F') 138323788f4SGreg Roach ); 1395e933c21SGreg Roach self::assertSame( 140c1010edaSGreg Roach [ 141c1010edaSGreg Roach 'NAME' => '/Whiteżka/', 142c1010edaSGreg Roach 'SURN' => 'Whiteżki', 143c1010edaSGreg Roach ], 144323788f4SGreg Roach $this->surname_tradition->newChildNames('John /Whiteżki/', 'Mary /Black/', 'F') 145323788f4SGreg Roach ); 146323788f4SGreg Roach } 147323788f4SGreg Roach 148323788f4SGreg Roach /** 149323788f4SGreg Roach * Test new child names 15017d74f3aSGreg Roach * 15115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 15215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 15352348eb8SGreg Roach * 15452348eb8SGreg Roach * @return void 155323788f4SGreg Roach */ 1569b802b22SGreg Roach public function testNewChildNames(): void 157c1010edaSGreg Roach { 1585e933c21SGreg Roach self::assertSame( 159c1010edaSGreg Roach [ 160c1010edaSGreg Roach 'NAME' => '/White/', 161c1010edaSGreg Roach 'SURN' => 'White', 162c1010edaSGreg Roach ], 163323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 164323788f4SGreg Roach ); 165323788f4SGreg Roach } 166323788f4SGreg Roach 167323788f4SGreg Roach /** 1681677a03aSGreg Roach * Test new child names 16917d74f3aSGreg Roach * 17015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 17115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 17252348eb8SGreg Roach * 17352348eb8SGreg Roach * @return void 1741677a03aSGreg Roach */ 1759b802b22SGreg Roach public function testNewChildNamesWithNoParentsNames(): void 176c1010edaSGreg Roach { 1775e933c21SGreg Roach self::assertSame( 17813abd6f3SGreg Roach ['NAME' => '//'], 1791677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 1801677a03aSGreg Roach ); 1811677a03aSGreg Roach } 1821677a03aSGreg Roach 1831677a03aSGreg Roach /** 184323788f4SGreg Roach * Test new father names 18517d74f3aSGreg Roach * 18615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 18715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 18852348eb8SGreg Roach * 18952348eb8SGreg Roach * @return void 190323788f4SGreg Roach */ 1919b802b22SGreg Roach public function testNewFatherNames(): void 192c1010edaSGreg Roach { 1935e933c21SGreg Roach self::assertSame( 194c1010edaSGreg Roach [ 195c1010edaSGreg Roach 'NAME' => '/White/', 196c1010edaSGreg Roach 'SURN' => 'White', 197c1010edaSGreg Roach ], 198323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 199323788f4SGreg Roach ); 200323788f4SGreg Roach } 201323788f4SGreg Roach 202323788f4SGreg Roach /** 203323788f4SGreg Roach * Test new father names 20417d74f3aSGreg Roach * 20515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 20615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 20752348eb8SGreg Roach * 20852348eb8SGreg Roach * @return void 209323788f4SGreg Roach */ 2109b802b22SGreg Roach public function testNewFatherNamesInflected(): void 211c1010edaSGreg Roach { 2125e933c21SGreg Roach self::assertSame( 213c1010edaSGreg Roach [ 214c1010edaSGreg Roach 'NAME' => '/Whitecki/', 215c1010edaSGreg Roach 'SURN' => 'Whitecki', 216c1010edaSGreg Roach ], 217323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whitecka/', 'M') 218323788f4SGreg Roach ); 2195e933c21SGreg Roach self::assertSame( 220c1010edaSGreg Roach [ 221c1010edaSGreg Roach 'NAME' => '/Whitedzki/', 222c1010edaSGreg Roach 'SURN' => 'Whitedzki', 223c1010edaSGreg Roach ], 224323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whitedzka/', 'M') 225323788f4SGreg Roach ); 2265e933c21SGreg Roach self::assertSame( 227c1010edaSGreg Roach [ 228c1010edaSGreg Roach 'NAME' => '/Whiteski/', 229c1010edaSGreg Roach 'SURN' => 'Whiteski', 230c1010edaSGreg Roach ], 231323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whiteska/', 'M') 232323788f4SGreg Roach ); 2335e933c21SGreg Roach self::assertSame( 234c1010edaSGreg Roach [ 235c1010edaSGreg Roach 'NAME' => '/Whiteżki/', 236c1010edaSGreg Roach 'SURN' => 'Whiteżki', 237c1010edaSGreg Roach ], 238323788f4SGreg Roach $this->surname_tradition->newParentNames('Mary /Whiteżka/', 'M') 239323788f4SGreg Roach ); 240323788f4SGreg Roach } 241323788f4SGreg Roach 242323788f4SGreg Roach /** 243323788f4SGreg Roach * Test new mother names 24417d74f3aSGreg Roach * 24515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 24615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 24752348eb8SGreg Roach * 24852348eb8SGreg Roach * @return void 249323788f4SGreg Roach */ 2509b802b22SGreg Roach public function testNewMotherNames(): void 251c1010edaSGreg Roach { 2525e933c21SGreg Roach self::assertSame( 25313abd6f3SGreg Roach ['NAME' => '//'], 254323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 255323788f4SGreg Roach ); 256323788f4SGreg Roach } 257323788f4SGreg Roach 258323788f4SGreg Roach /** 259323788f4SGreg Roach * Test new parent names 26017d74f3aSGreg Roach * 26115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 26215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 26352348eb8SGreg Roach * 26452348eb8SGreg Roach * @return void 265323788f4SGreg Roach */ 2669b802b22SGreg Roach public function testNewParentNames(): void 267c1010edaSGreg Roach { 2685e933c21SGreg Roach self::assertSame( 26913abd6f3SGreg Roach ['NAME' => '//'], 270323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 271323788f4SGreg Roach ); 272323788f4SGreg Roach } 273323788f4SGreg Roach 274323788f4SGreg Roach /** 275323788f4SGreg Roach * Test new husband names 27617d74f3aSGreg Roach * 27715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 27815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 27952348eb8SGreg Roach * 28052348eb8SGreg Roach * @return void 281323788f4SGreg Roach */ 2829b802b22SGreg Roach public function testNewHusbandNames(): void 283c1010edaSGreg Roach { 2845e933c21SGreg Roach self::assertSame( 28513abd6f3SGreg Roach ['NAME' => '//'], 286323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 287323788f4SGreg Roach ); 288323788f4SGreg Roach } 289323788f4SGreg Roach 290323788f4SGreg Roach /** 291323788f4SGreg Roach * Test new wife names 29217d74f3aSGreg Roach * 29315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 29415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 29552348eb8SGreg Roach * 29652348eb8SGreg Roach * @return void 297323788f4SGreg Roach */ 2989b802b22SGreg Roach public function testNewWifeNames(): void 299c1010edaSGreg Roach { 3005e933c21SGreg Roach self::assertSame( 301c1010edaSGreg Roach [ 302c1010edaSGreg Roach 'NAME' => '//', 303c1010edaSGreg Roach '_MARNM' => '/White/', 304c1010edaSGreg Roach ], 305323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 306323788f4SGreg Roach ); 307323788f4SGreg Roach } 308323788f4SGreg Roach 309323788f4SGreg Roach /** 310323788f4SGreg Roach * Test new spouse names 31117d74f3aSGreg Roach * 31215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 31315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 31452348eb8SGreg Roach * 31552348eb8SGreg Roach * @return void 316323788f4SGreg Roach */ 3179b802b22SGreg Roach public function testNewSpouseNames(): void 318c1010edaSGreg Roach { 3195e933c21SGreg Roach self::assertSame( 32013abd6f3SGreg Roach ['NAME' => '//'], 321323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 322323788f4SGreg Roach ); 323323788f4SGreg Roach } 324323788f4SGreg Roach} 325