1*323788f4SGreg Roach<?php 2*323788f4SGreg Roach 3*323788f4SGreg Roach/** 4*323788f4SGreg Roach * webtrees: online genealogy 5*323788f4SGreg Roach * Copyright (C) 2015 webtrees development team 6*323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify 7*323788f4SGreg Roach * it under the terms of the GNU General Public License as published by 8*323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9*323788f4SGreg Roach * (at your option) any later version. 10*323788f4SGreg Roach * This program is distributed in the hope that it will be useful, 11*323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12*323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*323788f4SGreg Roach * GNU General Public License for more details. 14*323788f4SGreg Roach * You should have received a copy of the GNU General Public License 15*323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 16*323788f4SGreg Roach */ 17*323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition; 18*323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 19*323788f4SGreg Roach 20*323788f4SGreg Roach/** 21*323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition 22*323788f4SGreg Roach */ 23*323788f4SGreg Roachclass SpanishSurnameTraditionTest extends PHPUnit_Framework_TestCase { 24*323788f4SGreg Roach /** @var SurnameTraditionInterface */ 25*323788f4SGreg Roach private $surname_tradition; 26*323788f4SGreg Roach 27*323788f4SGreg Roach /** 28*323788f4SGreg Roach * Prepare the environment for these tests 29*323788f4SGreg Roach */ 30*323788f4SGreg Roach public function setUp() { 31*323788f4SGreg Roach $this->surname_tradition = new SpanishSurnameTradition; 32*323788f4SGreg Roach } 33*323788f4SGreg Roach 34*323788f4SGreg Roach /** 35*323788f4SGreg Roach * Test whether married surnames are used 36*323788f4SGreg Roach */ 37*323788f4SGreg Roach public function testMarriedSurnames() { 38*323788f4SGreg Roach $this->assertSame(false, $this->surname_tradition->hasMarriedNames()); 39*323788f4SGreg Roach } 40*323788f4SGreg Roach 41*323788f4SGreg Roach /** 42*323788f4SGreg Roach * Test new son names 43*323788f4SGreg Roach */ 44*323788f4SGreg Roach public function testNewSonNames() { 45*323788f4SGreg Roach $this->assertSame( 46*323788f4SGreg Roach array('NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'), 47*323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 48*323788f4SGreg Roach ); 49*323788f4SGreg Roach } 50*323788f4SGreg Roach 51*323788f4SGreg Roach /** 52*323788f4SGreg Roach * Test new daughter names 53*323788f4SGreg Roach */ 54*323788f4SGreg Roach public function testNewDaughterNames() { 55*323788f4SGreg Roach $this->assertSame( 56*323788f4SGreg Roach array('NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'), 57*323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 58*323788f4SGreg Roach ); 59*323788f4SGreg Roach } 60*323788f4SGreg Roach 61*323788f4SGreg Roach /** 62*323788f4SGreg Roach * Test new child names 63*323788f4SGreg Roach */ 64*323788f4SGreg Roach public function testNewChildNames() { 65*323788f4SGreg Roach $this->assertSame( 66*323788f4SGreg Roach array('NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'), 67*323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 68*323788f4SGreg Roach ); 69*323788f4SGreg Roach } 70*323788f4SGreg Roach 71*323788f4SGreg Roach /** 72*323788f4SGreg Roach * Test new child names 73*323788f4SGreg Roach */ 74*323788f4SGreg Roach public function testNewChildNamesCompunds() { 75*323788f4SGreg Roach $this->assertSame( 76*323788f4SGreg Roach array('NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'), 77*323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M') 78*323788f4SGreg Roach ); 79*323788f4SGreg Roach $this->assertSame( 80*323788f4SGreg Roach array('NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'), 81*323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M') 82*323788f4SGreg Roach ); 83*323788f4SGreg Roach } 84*323788f4SGreg Roach 85*323788f4SGreg Roach /** 86*323788f4SGreg Roach * Test new father names 87*323788f4SGreg Roach */ 88*323788f4SGreg Roach public function testNewFatherNames() { 89*323788f4SGreg Roach $this->assertSame( 90*323788f4SGreg Roach array('NAME' => '/Garcia/ //', 'SURN' => 'Garcia'), 91*323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M') 92*323788f4SGreg Roach ); 93*323788f4SGreg Roach } 94*323788f4SGreg Roach 95*323788f4SGreg Roach /** 96*323788f4SGreg Roach * Test new mother names 97*323788f4SGreg Roach */ 98*323788f4SGreg Roach public function testNewMotherNames() { 99*323788f4SGreg Roach $this->assertSame( 100*323788f4SGreg Roach array('NAME' => '/Iglesias/ //', 'SURN' => 'Iglesias'), 101*323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F') 102*323788f4SGreg Roach ); 103*323788f4SGreg Roach } 104*323788f4SGreg Roach 105*323788f4SGreg Roach /** 106*323788f4SGreg Roach * Test new parent names 107*323788f4SGreg Roach */ 108*323788f4SGreg Roach public function testNewParentNames() { 109*323788f4SGreg Roach $this->assertSame( 110*323788f4SGreg Roach array('NAME' => '// //'), 111*323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U') 112*323788f4SGreg Roach ); 113*323788f4SGreg Roach } 114*323788f4SGreg Roach 115*323788f4SGreg Roach /** 116*323788f4SGreg Roach * Test new husband names 117*323788f4SGreg Roach */ 118*323788f4SGreg Roach public function testNewHusbandNames() { 119*323788f4SGreg Roach $this->assertSame( 120*323788f4SGreg Roach array('NAME' => '// //'), 121*323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M') 122*323788f4SGreg Roach ); 123*323788f4SGreg Roach } 124*323788f4SGreg Roach 125*323788f4SGreg Roach /** 126*323788f4SGreg Roach * Test new wife names 127*323788f4SGreg Roach */ 128*323788f4SGreg Roach public function testNewWifeNames() { 129*323788f4SGreg Roach $this->assertSame( 130*323788f4SGreg Roach array('NAME' => '// //'), 131*323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F') 132*323788f4SGreg Roach ); 133*323788f4SGreg Roach } 134*323788f4SGreg Roach 135*323788f4SGreg Roach /** 136*323788f4SGreg Roach * Test new spouse names 137*323788f4SGreg Roach */ 138*323788f4SGreg Roach public function testNewSpouseNames() { 139*323788f4SGreg Roach $this->assertSame( 140*323788f4SGreg Roach array('NAME' => '// //'), 141*323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U') 142*323788f4SGreg Roach ); 143*323788f4SGreg Roach } 144*323788f4SGreg Roach} 145