1323788f4SGreg Roach<?php 2323788f4SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 51062a142SGreg Roach * Copyright (C) 2018 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 15323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 16323788f4SGreg Roach */ 17*c1010edaSGreg Roach 18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition; 19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 20323788f4SGreg Roach 21323788f4SGreg Roach/** 22323788f4SGreg Roach * Test harness for the class PaternalSurnameTradition 23323788f4SGreg Roach */ 24*c1010edaSGreg Roachclass PaternalSurnameTraditionTest extends \PHPUnit\Framework\TestCase 25*c1010edaSGreg Roach{ 26323788f4SGreg Roach /** @var SurnameTraditionInterface */ 27323788f4SGreg Roach private $surname_tradition; 28323788f4SGreg Roach 29323788f4SGreg Roach /** 30323788f4SGreg Roach * Prepare the environment for these tests 31323788f4SGreg Roach */ 32*c1010edaSGreg Roach public function setUp() 33*c1010edaSGreg Roach { 34323788f4SGreg Roach $this->surname_tradition = new PaternalSurnameTradition; 35323788f4SGreg Roach } 36323788f4SGreg Roach 37323788f4SGreg Roach /** 38323788f4SGreg Roach * Test whether married surnames are used 3917d74f3aSGreg Roach * 4015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 41323788f4SGreg Roach */ 42*c1010edaSGreg Roach public function testMarriedSurnames() 43*c1010edaSGreg Roach { 44323788f4SGreg Roach $this->assertSame(true, $this->surname_tradition->hasMarriedNames()); 45323788f4SGreg Roach } 46323788f4SGreg Roach 47323788f4SGreg Roach /** 48c1ec7145SGreg Roach * Test whether surnames are used 4917d74f3aSGreg Roach * 5015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 51c1ec7145SGreg Roach */ 52*c1010edaSGreg Roach public function testSurnames() 53*c1010edaSGreg Roach { 54c1ec7145SGreg Roach $this->assertSame(true, $this->surname_tradition->hasSurnames()); 55c1ec7145SGreg Roach } 56c1ec7145SGreg Roach 57c1ec7145SGreg Roach /** 58323788f4SGreg Roach * Test new son names 5917d74f3aSGreg Roach * 6015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 61323788f4SGreg Roach */ 62*c1010edaSGreg Roach public function testNewSonNames() 63*c1010edaSGreg Roach { 64323788f4SGreg Roach $this->assertSame( 65*c1010edaSGreg Roach [ 66*c1010edaSGreg Roach 'NAME' => '/White/', 67*c1010edaSGreg Roach 'SURN' => 'White', 68*c1010edaSGreg Roach ], 69323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 70323788f4SGreg Roach ); 71323788f4SGreg Roach } 72323788f4SGreg Roach 73323788f4SGreg Roach /** 74323788f4SGreg Roach * Test new daughter names 7517d74f3aSGreg Roach * 7615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 77323788f4SGreg Roach */ 78*c1010edaSGreg Roach public function testNewDaughterNames() 79*c1010edaSGreg Roach { 80323788f4SGreg Roach $this->assertSame( 81*c1010edaSGreg Roach [ 82*c1010edaSGreg Roach 'NAME' => '/White/', 83*c1010edaSGreg Roach 'SURN' => 'White', 84*c1010edaSGreg Roach ], 85323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 86323788f4SGreg Roach ); 87323788f4SGreg Roach } 88323788f4SGreg Roach 89323788f4SGreg Roach /** 90323788f4SGreg Roach * Test new child names 9117d74f3aSGreg Roach * 9215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 93323788f4SGreg Roach */ 94*c1010edaSGreg Roach public function testNewChildNames() 95*c1010edaSGreg Roach { 96323788f4SGreg Roach $this->assertSame( 97*c1010edaSGreg Roach [ 98*c1010edaSGreg Roach 'NAME' => '/White/', 99*c1010edaSGreg Roach 'SURN' => 'White', 100*c1010edaSGreg Roach ], 101323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 102323788f4SGreg Roach ); 103323788f4SGreg Roach } 104323788f4SGreg Roach 105323788f4SGreg Roach /** 106323788f4SGreg Roach * Test new child names 10717d74f3aSGreg Roach * 10815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 109323788f4SGreg Roach */ 110*c1010edaSGreg Roach public function testNewChildNamesWithSpfx() 111*c1010edaSGreg Roach { 112323788f4SGreg Roach $this->assertSame( 113*c1010edaSGreg Roach [ 114*c1010edaSGreg Roach 'NAME' => '/de White/', 115*c1010edaSGreg Roach 'SPFX' => 'de', 116*c1010edaSGreg Roach 'SURN' => 'White', 117*c1010edaSGreg Roach ], 118323788f4SGreg Roach $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U') 119323788f4SGreg Roach ); 120323788f4SGreg Roach } 121323788f4SGreg Roach 122323788f4SGreg Roach /** 1238caf8226SGreg Roach * Test new child names 1248caf8226SGreg Roach * 12515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 1268caf8226SGreg Roach */ 127*c1010edaSGreg Roach public function testNewChildNamesWithMultipleSpfx() 128*c1010edaSGreg Roach { 1298caf8226SGreg Roach $this->assertSame( 130*c1010edaSGreg Roach [ 131*c1010edaSGreg Roach 'NAME' => '/van der White/', 132*c1010edaSGreg Roach 'SPFX' => 'van der', 133*c1010edaSGreg Roach 'SURN' => 'White', 134*c1010edaSGreg Roach ], 1358caf8226SGreg Roach $this->surname_tradition->newChildNames('John /van der White/', 'Mary /van Black/', 'U') 1368caf8226SGreg Roach ); 1378caf8226SGreg Roach } 1388caf8226SGreg Roach 1398caf8226SGreg Roach /** 1409797fe2eSGreg Roach * Test new child names 1419797fe2eSGreg Roach * 14215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 1439797fe2eSGreg Roach */ 144*c1010edaSGreg Roach public function testNewChildNamesWithDutchSpfx() 145*c1010edaSGreg Roach { 1469797fe2eSGreg Roach $this->assertSame( 147*c1010edaSGreg Roach [ 148*c1010edaSGreg Roach 'NAME' => '/\'t White/', 149*c1010edaSGreg Roach 'SPFX' => '\'t', 150*c1010edaSGreg Roach 'SURN' => 'White', 151*c1010edaSGreg Roach ], 1529797fe2eSGreg Roach $this->surname_tradition->newChildNames('John /\'t White/', 'Mary /van Black/', 'U') 1539797fe2eSGreg Roach ); 1549797fe2eSGreg Roach $this->assertSame( 155*c1010edaSGreg Roach [ 156*c1010edaSGreg Roach 'NAME' => '/’t White/', 157*c1010edaSGreg Roach 'SPFX' => '’t', 158*c1010edaSGreg Roach 'SURN' => 'White', 159*c1010edaSGreg Roach ], 1609797fe2eSGreg Roach $this->surname_tradition->newChildNames('John /’t White/', 'Mary /van Black/', 'U') 1619797fe2eSGreg Roach ); 1629797fe2eSGreg Roach } 1639797fe2eSGreg Roach 1649797fe2eSGreg Roach /** 1659797fe2eSGreg Roach * Test new child names 1669797fe2eSGreg Roach * 16715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 1689797fe2eSGreg Roach */ 169*c1010edaSGreg Roach public function testNewChildNamesWithMultipleDutchSpfx() 170*c1010edaSGreg Roach { 1719797fe2eSGreg Roach $this->assertSame( 172*c1010edaSGreg Roach [ 173*c1010edaSGreg Roach 'NAME' => '/van \'t White/', 174*c1010edaSGreg Roach 'SPFX' => 'van \'t', 175*c1010edaSGreg Roach 'SURN' => 'White', 176*c1010edaSGreg Roach ], 1779797fe2eSGreg Roach $this->surname_tradition->newChildNames('John /van \'t White/', 'Mary /van Black/', 'U') 1789797fe2eSGreg Roach ); 1799797fe2eSGreg Roach $this->assertSame( 180*c1010edaSGreg Roach [ 181*c1010edaSGreg Roach 'NAME' => '/van ’t White/', 182*c1010edaSGreg Roach 'SPFX' => 'van ’t', 183*c1010edaSGreg Roach 'SURN' => 'White', 184*c1010edaSGreg Roach ], 1859797fe2eSGreg Roach $this->surname_tradition->newChildNames('John /van ’t White/', 'Mary /van Black/', 'U') 1869797fe2eSGreg Roach ); 1879797fe2eSGreg Roach } 1889797fe2eSGreg Roach 1899797fe2eSGreg Roach /** 190323788f4SGreg Roach * Test new father names 19117d74f3aSGreg Roach * 19215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 193323788f4SGreg Roach */ 194*c1010edaSGreg Roach public function testNewFatherNames() 195*c1010edaSGreg Roach { 196323788f4SGreg Roach $this->assertSame( 197*c1010edaSGreg Roach [ 198*c1010edaSGreg Roach 'NAME' => '/White/', 199*c1010edaSGreg Roach 'SURN' => 'White', 200*c1010edaSGreg Roach ], 201323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 202323788f4SGreg Roach ); 203323788f4SGreg Roach } 204323788f4SGreg Roach 205323788f4SGreg Roach /** 206323788f4SGreg Roach * Test new mother names 20717d74f3aSGreg Roach * 20815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 209323788f4SGreg Roach */ 210*c1010edaSGreg Roach public function testNewMotherNames() 211*c1010edaSGreg Roach { 212323788f4SGreg Roach $this->assertSame( 213*c1010edaSGreg Roach [ 214*c1010edaSGreg Roach 'NAME' => '//', 215*c1010edaSGreg Roach '_MARNM' => '/White/', 216*c1010edaSGreg Roach ], 217323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 218323788f4SGreg Roach ); 219323788f4SGreg Roach } 220323788f4SGreg Roach 221323788f4SGreg Roach /** 222323788f4SGreg Roach * Test new parent names 22317d74f3aSGreg Roach * 22415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 225323788f4SGreg Roach */ 226*c1010edaSGreg Roach public function testNewParentNames() 227*c1010edaSGreg Roach { 228323788f4SGreg Roach $this->assertSame( 22913abd6f3SGreg Roach ['NAME' => '//'], 230323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 231323788f4SGreg Roach ); 232323788f4SGreg Roach } 233323788f4SGreg Roach 234323788f4SGreg Roach /** 235323788f4SGreg Roach * Test new husband names 23617d74f3aSGreg Roach * 23715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 238323788f4SGreg Roach */ 239*c1010edaSGreg Roach public function testNewHusbandNames() 240*c1010edaSGreg Roach { 241323788f4SGreg Roach $this->assertSame( 24213abd6f3SGreg Roach ['NAME' => '//'], 243323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 244323788f4SGreg Roach ); 245323788f4SGreg Roach } 246323788f4SGreg Roach 247323788f4SGreg Roach /** 248323788f4SGreg Roach * Test new wife names 24917d74f3aSGreg Roach * 25015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 251323788f4SGreg Roach */ 252*c1010edaSGreg Roach public function testNewWifeNames() 253*c1010edaSGreg Roach { 254323788f4SGreg Roach $this->assertSame( 255*c1010edaSGreg Roach [ 256*c1010edaSGreg Roach 'NAME' => '//', 257*c1010edaSGreg Roach '_MARNM' => '/White/', 258*c1010edaSGreg Roach ], 259323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 260323788f4SGreg Roach ); 261323788f4SGreg Roach } 262323788f4SGreg Roach 263323788f4SGreg Roach /** 2645b2de99fSGreg Roach * Test new wife names 2655b2de99fSGreg Roach * 26615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 2675b2de99fSGreg Roach */ 268*c1010edaSGreg Roach public function testNewWifeNamesWithSpfx() 269*c1010edaSGreg Roach { 2705b2de99fSGreg Roach $this->assertSame( 271*c1010edaSGreg Roach [ 272*c1010edaSGreg Roach 'NAME' => '//', 273*c1010edaSGreg Roach '_MARNM' => '/van der White/', 274*c1010edaSGreg Roach ], 2755b2de99fSGreg Roach $this->surname_tradition->newSpouseNames('John /van der White/', 'F') 2765b2de99fSGreg Roach ); 2775b2de99fSGreg Roach } 2785b2de99fSGreg Roach 2795b2de99fSGreg Roach /** 280323788f4SGreg Roach * Test new spouse names 28117d74f3aSGreg Roach * 28215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 283323788f4SGreg Roach */ 284*c1010edaSGreg Roach public function testNewSpouseNames() 285*c1010edaSGreg Roach { 286323788f4SGreg Roach $this->assertSame( 28713abd6f3SGreg Roach ['NAME' => '//'], 288323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 289323788f4SGreg Roach ); 290323788f4SGreg Roach } 291323788f4SGreg Roach} 292