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\PortugueseSurnameTradition; 19323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 20323788f4SGreg Roach 21323788f4SGreg Roach/** 22323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition 23323788f4SGreg Roach */ 24*84e2cf4eSGreg Roachclass PortugueseSurnameTraditionTest 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 PortugueseSurnameTradition; 35323788f4SGreg Roach } 36323788f4SGreg Roach 37323788f4SGreg Roach /** 38323788f4SGreg Roach * Test whether married surnames are used 3917d74f3aSGreg Roach * 4015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 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\PortugueseSurnameTradition 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\PortugueseSurnameTradition 61323788f4SGreg Roach */ 62c1010edaSGreg Roach public function testNewSonNames() 63c1010edaSGreg Roach { 64323788f4SGreg Roach $this->assertSame( 65c1010edaSGreg Roach [ 66c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 67c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 68c1010edaSGreg Roach ], 69323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 70323788f4SGreg Roach ); 71323788f4SGreg Roach } 72323788f4SGreg Roach 73323788f4SGreg Roach /** 74323788f4SGreg Roach * Test new daughter names 7517d74f3aSGreg Roach * 7615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 77323788f4SGreg Roach */ 78c1010edaSGreg Roach public function testNewDaughterNames() 79c1010edaSGreg Roach { 80323788f4SGreg Roach $this->assertSame( 81c1010edaSGreg Roach [ 82c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 83c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 84c1010edaSGreg Roach ], 85323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 86323788f4SGreg Roach ); 87323788f4SGreg Roach } 88323788f4SGreg Roach 89323788f4SGreg Roach /** 90323788f4SGreg Roach * Test new child names 9117d74f3aSGreg Roach * 9215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 93323788f4SGreg Roach */ 94c1010edaSGreg Roach public function testNewChildNames() 95c1010edaSGreg Roach { 96323788f4SGreg Roach $this->assertSame( 97c1010edaSGreg Roach [ 98c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 99c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 100c1010edaSGreg Roach ], 101323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 102323788f4SGreg Roach ); 103323788f4SGreg Roach } 104323788f4SGreg Roach 105323788f4SGreg Roach /** 106323788f4SGreg Roach * Test new child names 10717d74f3aSGreg Roach * 10815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 109323788f4SGreg Roach */ 110c1010edaSGreg Roach public function testNewChildNamesWithNoParentsNames() 111c1010edaSGreg Roach { 1121677a03aSGreg Roach $this->assertSame( 113c1010edaSGreg Roach [ 114c1010edaSGreg Roach 'NAME' => '// //', 115c1010edaSGreg Roach 'SURN' => '', 116c1010edaSGreg Roach ], 1171677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 1181677a03aSGreg Roach ); 1191677a03aSGreg Roach } 1201677a03aSGreg Roach 1211677a03aSGreg Roach /** 1221677a03aSGreg Roach * Test new child names 12317d74f3aSGreg Roach * 12415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 1251677a03aSGreg Roach */ 126c1010edaSGreg Roach public function testNewChildNamesCompunds() 127c1010edaSGreg Roach { 128323788f4SGreg Roach $this->assertSame( 129c1010edaSGreg Roach [ 130c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 131c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 132c1010edaSGreg Roach ], 133323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M') 134323788f4SGreg Roach ); 135323788f4SGreg Roach $this->assertSame( 136c1010edaSGreg Roach [ 137c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 138c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 139c1010edaSGreg Roach ], 140323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M') 141323788f4SGreg Roach ); 142323788f4SGreg Roach } 143323788f4SGreg Roach 144323788f4SGreg Roach /** 145323788f4SGreg Roach * Test new father names 14617d74f3aSGreg Roach * 14715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 148323788f4SGreg Roach */ 149c1010edaSGreg Roach public function testNewFatherNames() 150c1010edaSGreg Roach { 151323788f4SGreg Roach $this->assertSame( 152c1010edaSGreg Roach [ 153c1010edaSGreg Roach 'NAME' => '// /Garcia/', 154c1010edaSGreg Roach 'SURN' => 'Garcia', 155c1010edaSGreg Roach ], 156323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M') 157323788f4SGreg Roach ); 158323788f4SGreg Roach } 159323788f4SGreg Roach 160323788f4SGreg Roach /** 161323788f4SGreg Roach * Test new mother names 16217d74f3aSGreg Roach * 16315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 164323788f4SGreg Roach */ 165c1010edaSGreg Roach public function testNewMotherNames() 166c1010edaSGreg Roach { 167323788f4SGreg Roach $this->assertSame( 168c1010edaSGreg Roach [ 169c1010edaSGreg Roach 'NAME' => '// /Iglesias/', 170c1010edaSGreg Roach 'SURN' => 'Iglesias', 171c1010edaSGreg Roach ], 172323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F') 173323788f4SGreg Roach ); 174323788f4SGreg Roach } 175323788f4SGreg Roach 176323788f4SGreg Roach /** 177323788f4SGreg Roach * Test new parent names 17817d74f3aSGreg Roach * 17915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 180323788f4SGreg Roach */ 181c1010edaSGreg Roach public function testNewParentNames() 182c1010edaSGreg Roach { 183323788f4SGreg Roach $this->assertSame( 18413abd6f3SGreg Roach ['NAME' => '// //'], 185323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U') 186323788f4SGreg Roach ); 187323788f4SGreg Roach } 188323788f4SGreg Roach 189323788f4SGreg Roach /** 190323788f4SGreg Roach * Test new husband names 19117d74f3aSGreg Roach * 19215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 193323788f4SGreg Roach */ 194c1010edaSGreg Roach public function testNewHusbandNames() 195c1010edaSGreg Roach { 196323788f4SGreg Roach $this->assertSame( 19713abd6f3SGreg Roach ['NAME' => '// //'], 198323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M') 199323788f4SGreg Roach ); 200323788f4SGreg Roach } 201323788f4SGreg Roach 202323788f4SGreg Roach /** 203323788f4SGreg Roach * Test new wife names 20417d74f3aSGreg Roach * 20515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 206323788f4SGreg Roach */ 207c1010edaSGreg Roach public function testNewWifeNames() 208c1010edaSGreg Roach { 209323788f4SGreg Roach $this->assertSame( 21013abd6f3SGreg Roach ['NAME' => '// //'], 211323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F') 212323788f4SGreg Roach ); 213323788f4SGreg Roach } 214323788f4SGreg Roach 215323788f4SGreg Roach /** 216323788f4SGreg Roach * Test new spouse names 21717d74f3aSGreg Roach * 21815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 219323788f4SGreg Roach */ 220c1010edaSGreg Roach public function testNewSpouseNames() 221c1010edaSGreg Roach { 222323788f4SGreg Roach $this->assertSame( 22313abd6f3SGreg Roach ['NAME' => '// //'], 224323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U') 225323788f4SGreg Roach ); 226323788f4SGreg Roach } 227323788f4SGreg Roach} 228