1323788f4SGreg Roach<?php 2323788f4SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 5*1062a142SGreg 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 */ 17323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition; 18323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 19323788f4SGreg Roach 20323788f4SGreg Roach/** 21323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition 22323788f4SGreg Roach */ 233e983931SGreg Roachclass SpanishSurnameTraditionTest 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 SpanishSurnameTradition; 32323788f4SGreg Roach } 33323788f4SGreg Roach 34323788f4SGreg Roach /** 35323788f4SGreg Roach * Test whether married surnames are used 3617d74f3aSGreg Roach * 3715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 38323788f4SGreg Roach */ 39323788f4SGreg Roach public function testMarriedSurnames() { 40323788f4SGreg Roach $this->assertSame(false, $this->surname_tradition->hasMarriedNames()); 41323788f4SGreg Roach } 42323788f4SGreg Roach 43323788f4SGreg Roach /** 44c1ec7145SGreg Roach * Test whether surnames are used 4517d74f3aSGreg Roach * 4615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 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 * 5515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 56323788f4SGreg Roach */ 57323788f4SGreg Roach public function testNewSonNames() { 58323788f4SGreg Roach $this->assertSame( 5913abd6f3SGreg Roach ['NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'], 60323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 61323788f4SGreg Roach ); 62323788f4SGreg Roach } 63323788f4SGreg Roach 64323788f4SGreg Roach /** 65323788f4SGreg Roach * Test new daughter names 6617d74f3aSGreg Roach * 6715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 68323788f4SGreg Roach */ 69323788f4SGreg Roach public function testNewDaughterNames() { 70323788f4SGreg Roach $this->assertSame( 7113abd6f3SGreg Roach ['NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'], 72323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 73323788f4SGreg Roach ); 74323788f4SGreg Roach } 75323788f4SGreg Roach 76323788f4SGreg Roach /** 77323788f4SGreg Roach * Test new child names 7817d74f3aSGreg Roach * 7915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 80323788f4SGreg Roach */ 81323788f4SGreg Roach public function testNewChildNames() { 82323788f4SGreg Roach $this->assertSame( 8313abd6f3SGreg Roach ['NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'], 84323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 85323788f4SGreg Roach ); 86323788f4SGreg Roach } 87323788f4SGreg Roach 88323788f4SGreg Roach /** 89323788f4SGreg Roach * Test new child names 9017d74f3aSGreg Roach * 9115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 92323788f4SGreg Roach */ 931677a03aSGreg Roach public function testNewChildNamesWithNoParentsNames() { 941677a03aSGreg Roach $this->assertSame( 9513abd6f3SGreg Roach ['NAME' => '// //', 'SURN' => ''], 961677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 971677a03aSGreg Roach ); 981677a03aSGreg Roach } 991677a03aSGreg Roach 1001677a03aSGreg Roach /** 1011677a03aSGreg Roach * Test new child names 10217d74f3aSGreg Roach * 10315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 1041677a03aSGreg Roach */ 105323788f4SGreg Roach public function testNewChildNamesCompunds() { 106323788f4SGreg Roach $this->assertSame( 10713abd6f3SGreg Roach ['NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'], 108323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M') 109323788f4SGreg Roach ); 110323788f4SGreg Roach $this->assertSame( 11113abd6f3SGreg Roach ['NAME' => '/Garcia/ /Ruiz/', 'SURN' => 'Garcia,Ruiz'], 112323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M') 113323788f4SGreg Roach ); 114323788f4SGreg Roach } 115323788f4SGreg Roach 116323788f4SGreg Roach /** 117323788f4SGreg Roach * Test new father names 11817d74f3aSGreg Roach * 11915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 120323788f4SGreg Roach */ 121323788f4SGreg Roach public function testNewFatherNames() { 122323788f4SGreg Roach $this->assertSame( 12313abd6f3SGreg Roach ['NAME' => '/Garcia/ //', 'SURN' => 'Garcia'], 124323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M') 125323788f4SGreg Roach ); 126323788f4SGreg Roach } 127323788f4SGreg Roach 128323788f4SGreg Roach /** 129323788f4SGreg Roach * Test new mother names 13017d74f3aSGreg Roach * 13115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 132323788f4SGreg Roach */ 133323788f4SGreg Roach public function testNewMotherNames() { 134323788f4SGreg Roach $this->assertSame( 13513abd6f3SGreg Roach ['NAME' => '/Iglesias/ //', 'SURN' => 'Iglesias'], 136323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F') 137323788f4SGreg Roach ); 138323788f4SGreg Roach } 139323788f4SGreg Roach 140323788f4SGreg Roach /** 141323788f4SGreg Roach * Test new parent names 14217d74f3aSGreg Roach * 14315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 144323788f4SGreg Roach */ 145323788f4SGreg Roach public function testNewParentNames() { 146323788f4SGreg Roach $this->assertSame( 14713abd6f3SGreg Roach ['NAME' => '// //'], 148323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U') 149323788f4SGreg Roach ); 150323788f4SGreg Roach } 151323788f4SGreg Roach 152323788f4SGreg Roach /** 153323788f4SGreg Roach * Test new husband names 15417d74f3aSGreg Roach * 15515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 156323788f4SGreg Roach */ 157323788f4SGreg Roach public function testNewHusbandNames() { 158323788f4SGreg Roach $this->assertSame( 15913abd6f3SGreg Roach ['NAME' => '// //'], 160323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M') 161323788f4SGreg Roach ); 162323788f4SGreg Roach } 163323788f4SGreg Roach 164323788f4SGreg Roach /** 165323788f4SGreg Roach * Test new wife names 16617d74f3aSGreg Roach * 16715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 168323788f4SGreg Roach */ 169323788f4SGreg Roach public function testNewWifeNames() { 170323788f4SGreg Roach $this->assertSame( 17113abd6f3SGreg Roach ['NAME' => '// //'], 172323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F') 173323788f4SGreg Roach ); 174323788f4SGreg Roach } 175323788f4SGreg Roach 176323788f4SGreg Roach /** 177323788f4SGreg Roach * Test new spouse names 17817d74f3aSGreg Roach * 17915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\SpanishSurnameTradition 180323788f4SGreg Roach */ 181323788f4SGreg Roach public function testNewSpouseNames() { 182323788f4SGreg Roach $this->assertSame( 18313abd6f3SGreg Roach ['NAME' => '// //'], 184323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U') 185323788f4SGreg Roach ); 186323788f4SGreg Roach } 187323788f4SGreg Roach} 188