1323788f4SGreg Roach<?php 2323788f4SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 5369c0ce6SGreg Roach * Copyright (C) 2016 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 */ 17323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition; 18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 19323788f4SGreg Roach 20323788f4SGreg Roach/** 21323788f4SGreg Roach * Test harness for the class PaternalSurnameTradition 22323788f4SGreg Roach */ 23db7d25eeSGreg Roachclass PaternalSurnameTraditionTest extends \PHPUnit_Framework_TestCase { 24323788f4SGreg Roach /** @var SurnameTraditionInterface */ 25323788f4SGreg Roach private $surname_tradition; 26323788f4SGreg Roach 27323788f4SGreg Roach /** 28323788f4SGreg Roach * Prepare the environment for these tests 29323788f4SGreg Roach */ 30323788f4SGreg Roach public function setUp() { 31323788f4SGreg Roach $this->surname_tradition = new PaternalSurnameTradition; 32323788f4SGreg Roach } 33323788f4SGreg Roach 34323788f4SGreg Roach /** 35323788f4SGreg Roach * Test whether married surnames are used 3617d74f3aSGreg Roach * 3717d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 38323788f4SGreg Roach */ 39323788f4SGreg Roach public function testMarriedSurnames() { 40323788f4SGreg Roach $this->assertSame(true, $this->surname_tradition->hasMarriedNames()); 41323788f4SGreg Roach } 42323788f4SGreg Roach 43323788f4SGreg Roach /** 44c1ec7145SGreg Roach * Test whether surnames are used 4517d74f3aSGreg Roach * 4617d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 47c1ec7145SGreg Roach */ 48c1ec7145SGreg Roach public function testSurnames() { 49c1ec7145SGreg Roach $this->assertSame(true, $this->surname_tradition->hasSurnames()); 50c1ec7145SGreg Roach } 51c1ec7145SGreg Roach 52c1ec7145SGreg Roach /** 53323788f4SGreg Roach * Test new son names 5417d74f3aSGreg Roach * 5517d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 56323788f4SGreg Roach */ 57323788f4SGreg Roach public function testNewSonNames() { 58323788f4SGreg Roach $this->assertSame( 59323788f4SGreg Roach array('NAME' => '/White/', 'SURN' => 'White'), 60323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 61323788f4SGreg Roach ); 62323788f4SGreg Roach } 63323788f4SGreg Roach 64323788f4SGreg Roach /** 65323788f4SGreg Roach * Test new daughter names 6617d74f3aSGreg Roach * 6717d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 68323788f4SGreg Roach */ 69323788f4SGreg Roach public function testNewDaughterNames() { 70323788f4SGreg Roach $this->assertSame( 71323788f4SGreg Roach array('NAME' => '/White/', 'SURN' => 'White'), 72323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 73323788f4SGreg Roach ); 74323788f4SGreg Roach } 75323788f4SGreg Roach 76323788f4SGreg Roach /** 77323788f4SGreg Roach * Test new child names 7817d74f3aSGreg Roach * 7917d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 80323788f4SGreg Roach */ 81323788f4SGreg Roach public function testNewChildNames() { 82323788f4SGreg Roach $this->assertSame( 83323788f4SGreg Roach array('NAME' => '/White/', 'SURN' => 'White'), 84323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 85323788f4SGreg Roach ); 86323788f4SGreg Roach } 87323788f4SGreg Roach 88323788f4SGreg Roach /** 89323788f4SGreg Roach * Test new child names 9017d74f3aSGreg Roach * 9117d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 92323788f4SGreg Roach */ 93323788f4SGreg Roach public function testNewChildNamesWithSpfx() { 94323788f4SGreg Roach $this->assertSame( 95323788f4SGreg Roach array('NAME' => '/de White/', 'SPFX' => 'de', 'SURN' => 'White'), 96323788f4SGreg Roach $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U') 97323788f4SGreg Roach ); 98323788f4SGreg Roach } 99323788f4SGreg Roach 100323788f4SGreg Roach /** 1018caf8226SGreg Roach * Test new child names 1028caf8226SGreg Roach * 1038caf8226SGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 1048caf8226SGreg Roach */ 1058caf8226SGreg Roach public function testNewChildNamesWithMultipleSpfx() { 1068caf8226SGreg Roach $this->assertSame( 1078caf8226SGreg Roach array('NAME' => '/van der White/', 'SPFX' => 'van der', 'SURN' => 'White'), 1088caf8226SGreg Roach $this->surname_tradition->newChildNames('John /van der White/', 'Mary /van Black/', 'U') 1098caf8226SGreg Roach ); 1108caf8226SGreg Roach } 1118caf8226SGreg Roach 1128caf8226SGreg Roach /** 113*9797fe2eSGreg Roach * Test new child names 114*9797fe2eSGreg Roach * 115*9797fe2eSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 116*9797fe2eSGreg Roach */ 117*9797fe2eSGreg Roach public function testNewChildNamesWithDutchSpfx() { 118*9797fe2eSGreg Roach $this->assertSame( 119*9797fe2eSGreg Roach array('NAME' => '/\'t White/', 'SPFX' => '\'t', 'SURN' => 'White'), 120*9797fe2eSGreg Roach $this->surname_tradition->newChildNames('John /\'t White/', 'Mary /van Black/', 'U') 121*9797fe2eSGreg Roach ); 122*9797fe2eSGreg Roach $this->assertSame( 123*9797fe2eSGreg Roach array('NAME' => '/’t White/', 'SPFX' => '’t', 'SURN' => 'White'), 124*9797fe2eSGreg Roach $this->surname_tradition->newChildNames('John /’t White/', 'Mary /van Black/', 'U') 125*9797fe2eSGreg Roach ); 126*9797fe2eSGreg Roach } 127*9797fe2eSGreg Roach 128*9797fe2eSGreg Roach /** 129*9797fe2eSGreg Roach * Test new child names 130*9797fe2eSGreg Roach * 131*9797fe2eSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 132*9797fe2eSGreg Roach */ 133*9797fe2eSGreg Roach public function testNewChildNamesWithMultipleDutchSpfx() { 134*9797fe2eSGreg Roach $this->assertSame( 135*9797fe2eSGreg Roach array('NAME' => '/van \'t White/', 'SPFX' => 'van \'t', 'SURN' => 'White'), 136*9797fe2eSGreg Roach $this->surname_tradition->newChildNames('John /van \'t White/', 'Mary /van Black/', 'U') 137*9797fe2eSGreg Roach ); 138*9797fe2eSGreg Roach $this->assertSame( 139*9797fe2eSGreg Roach array('NAME' => '/van ’t White/', 'SPFX' => 'van ’t', 'SURN' => 'White'), 140*9797fe2eSGreg Roach $this->surname_tradition->newChildNames('John /van ’t White/', 'Mary /van Black/', 'U') 141*9797fe2eSGreg Roach ); 142*9797fe2eSGreg Roach } 143*9797fe2eSGreg Roach 144*9797fe2eSGreg Roach /** 145323788f4SGreg Roach * Test new father names 14617d74f3aSGreg Roach * 14717d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 148323788f4SGreg Roach */ 149323788f4SGreg Roach public function testNewFatherNames() { 150323788f4SGreg Roach $this->assertSame( 151323788f4SGreg Roach array('NAME' => '/White/', 'SURN' => 'White'), 152323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 153323788f4SGreg Roach ); 154323788f4SGreg Roach } 155323788f4SGreg Roach 156323788f4SGreg Roach /** 157323788f4SGreg Roach * Test new mother names 15817d74f3aSGreg Roach * 15917d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 160323788f4SGreg Roach */ 161323788f4SGreg Roach public function testNewMotherNames() { 162323788f4SGreg Roach $this->assertSame( 163323788f4SGreg Roach array('NAME' => '//', '_MARNM' => '/White/'), 164323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 165323788f4SGreg Roach ); 166323788f4SGreg Roach } 167323788f4SGreg Roach 168323788f4SGreg Roach /** 169323788f4SGreg Roach * Test new parent names 17017d74f3aSGreg Roach * 17117d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 172323788f4SGreg Roach */ 173323788f4SGreg Roach public function testNewParentNames() { 174323788f4SGreg Roach $this->assertSame( 175323788f4SGreg Roach array('NAME' => '//'), 176323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 177323788f4SGreg Roach ); 178323788f4SGreg Roach } 179323788f4SGreg Roach 180323788f4SGreg Roach /** 181323788f4SGreg Roach * Test new husband names 18217d74f3aSGreg Roach * 18317d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 184323788f4SGreg Roach */ 185323788f4SGreg Roach public function testNewHusbandNames() { 186323788f4SGreg Roach $this->assertSame( 187323788f4SGreg Roach array('NAME' => '//'), 188323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 189323788f4SGreg Roach ); 190323788f4SGreg Roach } 191323788f4SGreg Roach 192323788f4SGreg Roach /** 193323788f4SGreg Roach * Test new wife names 19417d74f3aSGreg Roach * 19517d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 196323788f4SGreg Roach */ 197323788f4SGreg Roach public function testNewWifeNames() { 198323788f4SGreg Roach $this->assertSame( 199323788f4SGreg Roach array('NAME' => '//', '_MARNM' => '/White/'), 200323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 201323788f4SGreg Roach ); 202323788f4SGreg Roach } 203323788f4SGreg Roach 204323788f4SGreg Roach /** 2055b2de99fSGreg Roach * Test new wife names 2065b2de99fSGreg Roach * 2075b2de99fSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 2085b2de99fSGreg Roach */ 2095b2de99fSGreg Roach public function testNewWifeNamesWithSpfx() { 2105b2de99fSGreg Roach $this->assertSame( 2115b2de99fSGreg Roach array('NAME' => '//', '_MARNM' => '/van der White/'), 2125b2de99fSGreg Roach $this->surname_tradition->newSpouseNames('John /van der White/', 'F') 2135b2de99fSGreg Roach ); 2145b2de99fSGreg Roach } 2155b2de99fSGreg Roach 2165b2de99fSGreg Roach /** 217323788f4SGreg Roach * Test new spouse names 21817d74f3aSGreg Roach * 21917d74f3aSGreg Roach * @covers Fisharebest\Webtrees\SurnameTradition\PaternalSurnameTradition 220323788f4SGreg Roach */ 221323788f4SGreg Roach public function testNewSpouseNames() { 222323788f4SGreg Roach $this->assertSame( 223323788f4SGreg Roach array('NAME' => '//'), 224323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 225323788f4SGreg Roach ); 226323788f4SGreg Roach } 227323788f4SGreg Roach} 228