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*84e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 17c1010edaSGreg Roach 18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition; 19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 20323788f4SGreg Roach 21323788f4SGreg Roach/** 22323788f4SGreg Roach * Test harness for the class PatrilinenalSurnameTradition 23323788f4SGreg Roach */ 24*84e2cf4eSGreg Roachclass PatrilinealSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase 25c1010edaSGreg Roach{ 26323788f4SGreg Roach /** @var SurnameTraditionInterface */ 27323788f4SGreg Roach private $surname_tradition; 28323788f4SGreg Roach 29323788f4SGreg Roach /** 30323788f4SGreg Roach * Prepare the environment for these tests 31323788f4SGreg Roach */ 32c1010edaSGreg Roach public function setUp() 33c1010edaSGreg Roach { 34323788f4SGreg Roach $this->surname_tradition = new PatrilinealSurnameTradition; 35323788f4SGreg Roach } 36323788f4SGreg Roach 37323788f4SGreg Roach /** 38323788f4SGreg Roach * Test whether married surnames are used 3917d74f3aSGreg Roach * 4015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 41323788f4SGreg Roach */ 42c1010edaSGreg Roach public function testMarriedSurnames() 43c1010edaSGreg Roach { 44323788f4SGreg Roach $this->assertSame(false, $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\PatrilinealSurnameTradition 51c1ec7145SGreg Roach */ 52c1010edaSGreg Roach public function testSurnames() 53c1010edaSGreg 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\PatrilinealSurnameTradition 61323788f4SGreg Roach */ 62c1010edaSGreg Roach public function testNewSonNames() 63c1010edaSGreg Roach { 64323788f4SGreg Roach $this->assertSame( 65c1010edaSGreg Roach [ 66c1010edaSGreg Roach 'NAME' => '/White/', 67c1010edaSGreg Roach 'SURN' => 'White', 68c1010edaSGreg 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\PatrilinealSurnameTradition 77323788f4SGreg Roach */ 78c1010edaSGreg Roach public function testNewDaughterNames() 79c1010edaSGreg Roach { 80323788f4SGreg Roach $this->assertSame( 81c1010edaSGreg Roach [ 82c1010edaSGreg Roach 'NAME' => '/White/', 83c1010edaSGreg Roach 'SURN' => 'White', 84c1010edaSGreg 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\PatrilinealSurnameTradition 93323788f4SGreg Roach */ 94c1010edaSGreg Roach public function testNewChildNames() 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/', 'U') 102323788f4SGreg Roach ); 103323788f4SGreg Roach } 104323788f4SGreg Roach 105323788f4SGreg Roach /** 106323788f4SGreg Roach * Test new child names 10717d74f3aSGreg Roach * 10815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 109323788f4SGreg Roach */ 110c1010edaSGreg Roach public function testNewChildNamesWithSpfx() 111c1010edaSGreg Roach { 112323788f4SGreg Roach $this->assertSame( 113c1010edaSGreg Roach [ 114c1010edaSGreg Roach 'NAME' => '/de White/', 115c1010edaSGreg Roach 'SPFX' => 'de', 116c1010edaSGreg Roach 'SURN' => 'White', 117c1010edaSGreg Roach ], 118323788f4SGreg Roach $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U') 119323788f4SGreg Roach ); 120323788f4SGreg Roach } 121323788f4SGreg Roach 122323788f4SGreg Roach /** 1231677a03aSGreg Roach * Test new child names 12417d74f3aSGreg Roach * 12515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 1261677a03aSGreg Roach */ 127c1010edaSGreg Roach public function testNewChildNamesWithNoParentsNames() 128c1010edaSGreg Roach { 1291677a03aSGreg Roach $this->assertSame( 13013abd6f3SGreg Roach ['NAME' => '//'], 1311677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 1321677a03aSGreg Roach ); 1331677a03aSGreg Roach } 1341677a03aSGreg Roach 1351677a03aSGreg Roach /** 136323788f4SGreg Roach * Test new father names 13717d74f3aSGreg Roach * 13815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 139323788f4SGreg Roach */ 140c1010edaSGreg Roach public function testNewFatherNames() 141c1010edaSGreg Roach { 142323788f4SGreg Roach $this->assertSame( 143c1010edaSGreg Roach [ 144c1010edaSGreg Roach 'NAME' => '/White/', 145c1010edaSGreg Roach 'SURN' => 'White', 146c1010edaSGreg Roach ], 147323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 148323788f4SGreg Roach ); 149323788f4SGreg Roach } 150323788f4SGreg Roach 151323788f4SGreg Roach /** 152323788f4SGreg Roach * Test new mother names 15317d74f3aSGreg Roach * 15415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 155323788f4SGreg Roach */ 156c1010edaSGreg Roach public function testNewMotherNames() 157c1010edaSGreg Roach { 158323788f4SGreg Roach $this->assertSame( 15913abd6f3SGreg Roach ['NAME' => '//'], 160323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 161323788f4SGreg Roach ); 162323788f4SGreg Roach } 163323788f4SGreg Roach 164323788f4SGreg Roach /** 165323788f4SGreg Roach * Test new parent names 16617d74f3aSGreg Roach * 16715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 168323788f4SGreg Roach */ 169c1010edaSGreg Roach public function testNewParentNames() 170c1010edaSGreg Roach { 171323788f4SGreg Roach $this->assertSame( 17213abd6f3SGreg Roach ['NAME' => '//'], 173323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 174323788f4SGreg Roach ); 175323788f4SGreg Roach } 176323788f4SGreg Roach 177323788f4SGreg Roach /** 178323788f4SGreg Roach * Test new husband names 17917d74f3aSGreg Roach * 18015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 181323788f4SGreg Roach */ 182c1010edaSGreg Roach public function testNewHusbandNames() 183c1010edaSGreg Roach { 184323788f4SGreg Roach $this->assertSame( 18513abd6f3SGreg Roach ['NAME' => '//'], 186323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 187323788f4SGreg Roach ); 188323788f4SGreg Roach } 189323788f4SGreg Roach 190323788f4SGreg Roach /** 191323788f4SGreg Roach * Test new wife names 19217d74f3aSGreg Roach * 19315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 194323788f4SGreg Roach */ 195c1010edaSGreg Roach public function testNewWifeNames() 196c1010edaSGreg Roach { 197323788f4SGreg Roach $this->assertSame( 19813abd6f3SGreg Roach ['NAME' => '//'], 199323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 200323788f4SGreg Roach ); 201323788f4SGreg Roach } 202323788f4SGreg Roach 203323788f4SGreg Roach /** 204323788f4SGreg Roach * Test new spouse names 20517d74f3aSGreg Roach * 20615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 207323788f4SGreg Roach */ 208c1010edaSGreg Roach public function testNewSpouseNames() 209c1010edaSGreg Roach { 210323788f4SGreg Roach $this->assertSame( 21113abd6f3SGreg Roach ['NAME' => '//'], 212323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 213323788f4SGreg Roach ); 214323788f4SGreg Roach } 215323788f4SGreg Roach} 216