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*e7f56f2aSGreg Roachdeclare(strict_types=1); 17*e7f56f2aSGreg Roach 1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 19c1010edaSGreg Roach 20323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition; 21323788f4SGreg Roachuse Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 22323788f4SGreg Roach 23323788f4SGreg Roach/** 24323788f4SGreg Roach * Test harness for the class SpanishSurnameTradition 25323788f4SGreg Roach */ 2684e2cf4eSGreg Roachclass PortugueseSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase 27c1010edaSGreg Roach{ 28323788f4SGreg Roach /** @var SurnameTraditionInterface */ 29323788f4SGreg Roach private $surname_tradition; 30323788f4SGreg Roach 31323788f4SGreg Roach /** 32323788f4SGreg Roach * Prepare the environment for these tests 3352348eb8SGreg Roach * 3452348eb8SGreg Roach * @return void 35323788f4SGreg Roach */ 36c1010edaSGreg Roach public function setUp() 37c1010edaSGreg Roach { 38323788f4SGreg Roach $this->surname_tradition = new PortugueseSurnameTradition; 39323788f4SGreg Roach } 40323788f4SGreg Roach 41323788f4SGreg Roach /** 42323788f4SGreg Roach * Test whether married surnames are used 4317d74f3aSGreg Roach * 4415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 4552348eb8SGreg Roach * 4652348eb8SGreg Roach * @return void 47323788f4SGreg Roach */ 48c1010edaSGreg Roach public function testMarriedSurnames() 49c1010edaSGreg Roach { 50323788f4SGreg Roach $this->assertSame(false, $this->surname_tradition->hasMarriedNames()); 51323788f4SGreg Roach } 52323788f4SGreg Roach 53323788f4SGreg Roach /** 54c1ec7145SGreg Roach * Test whether surnames are used 5517d74f3aSGreg Roach * 5615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 5752348eb8SGreg Roach * 5852348eb8SGreg Roach * @return void 59c1ec7145SGreg Roach */ 60c1010edaSGreg Roach public function testSurnames() 61c1010edaSGreg Roach { 62c1ec7145SGreg Roach $this->assertSame(true, $this->surname_tradition->hasSurnames()); 63c1ec7145SGreg Roach } 64c1ec7145SGreg Roach 65c1ec7145SGreg Roach /** 66323788f4SGreg Roach * Test new son names 6717d74f3aSGreg Roach * 6815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 6952348eb8SGreg Roach * 7052348eb8SGreg Roach * @return void 71323788f4SGreg Roach */ 72c1010edaSGreg Roach public function testNewSonNames() 73c1010edaSGreg Roach { 74323788f4SGreg Roach $this->assertSame( 75c1010edaSGreg Roach [ 76c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 77c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 78c1010edaSGreg Roach ], 79323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 80323788f4SGreg Roach ); 81323788f4SGreg Roach } 82323788f4SGreg Roach 83323788f4SGreg Roach /** 84323788f4SGreg Roach * Test new daughter names 8517d74f3aSGreg Roach * 8615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 8752348eb8SGreg Roach * 8852348eb8SGreg Roach * @return void 89323788f4SGreg Roach */ 90c1010edaSGreg Roach public function testNewDaughterNames() 91c1010edaSGreg Roach { 92323788f4SGreg Roach $this->assertSame( 93c1010edaSGreg Roach [ 94c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 95c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 96c1010edaSGreg Roach ], 97323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 98323788f4SGreg Roach ); 99323788f4SGreg Roach } 100323788f4SGreg Roach 101323788f4SGreg Roach /** 102323788f4SGreg Roach * Test new child names 10317d74f3aSGreg Roach * 10415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 10552348eb8SGreg Roach * 10652348eb8SGreg Roach * @return void 107323788f4SGreg Roach */ 108c1010edaSGreg Roach public function testNewChildNames() 109c1010edaSGreg Roach { 110323788f4SGreg Roach $this->assertSame( 111c1010edaSGreg Roach [ 112c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 113c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 114c1010edaSGreg Roach ], 115323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia/ /Iglesias/', 'Maria /Ruiz/ /Lorca/', 'M') 116323788f4SGreg Roach ); 117323788f4SGreg Roach } 118323788f4SGreg Roach 119323788f4SGreg Roach /** 120323788f4SGreg Roach * Test new child names 12117d74f3aSGreg Roach * 12215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 12352348eb8SGreg Roach * 12452348eb8SGreg Roach * @return void 125323788f4SGreg Roach */ 126c1010edaSGreg Roach public function testNewChildNamesWithNoParentsNames() 127c1010edaSGreg Roach { 1281677a03aSGreg Roach $this->assertSame( 129c1010edaSGreg Roach [ 130c1010edaSGreg Roach 'NAME' => '// //', 131c1010edaSGreg Roach 'SURN' => '', 132c1010edaSGreg Roach ], 1331677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 1341677a03aSGreg Roach ); 1351677a03aSGreg Roach } 1361677a03aSGreg Roach 1371677a03aSGreg Roach /** 1381677a03aSGreg Roach * Test new child names 13917d74f3aSGreg Roach * 14015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 14152348eb8SGreg Roach * 14252348eb8SGreg Roach * @return void 1431677a03aSGreg Roach */ 144c1010edaSGreg Roach public function testNewChildNamesCompunds() 145c1010edaSGreg Roach { 146323788f4SGreg Roach $this->assertSame( 147c1010edaSGreg Roach [ 148c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 149c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 150c1010edaSGreg Roach ], 151323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia Iglesias/', 'Maria /Ruiz Lorca/', 'M') 152323788f4SGreg Roach ); 153323788f4SGreg Roach $this->assertSame( 154c1010edaSGreg Roach [ 155c1010edaSGreg Roach 'NAME' => '/Iglesias/ /Lorca/', 156c1010edaSGreg Roach 'SURN' => 'Iglesias,Lorca', 157c1010edaSGreg Roach ], 158323788f4SGreg Roach $this->surname_tradition->newChildNames('Gabriel /Garcia y Iglesias/', 'Maria /Ruiz y Lorca/', 'M') 159323788f4SGreg Roach ); 160323788f4SGreg Roach } 161323788f4SGreg Roach 162323788f4SGreg Roach /** 163323788f4SGreg Roach * Test new father names 16417d74f3aSGreg Roach * 16515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 16652348eb8SGreg Roach * 16752348eb8SGreg Roach * @return void 168323788f4SGreg Roach */ 169c1010edaSGreg Roach public function testNewFatherNames() 170c1010edaSGreg Roach { 171323788f4SGreg Roach $this->assertSame( 172c1010edaSGreg Roach [ 173c1010edaSGreg Roach 'NAME' => '// /Garcia/', 174c1010edaSGreg Roach 'SURN' => 'Garcia', 175c1010edaSGreg Roach ], 176323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'M') 177323788f4SGreg Roach ); 178323788f4SGreg Roach } 179323788f4SGreg Roach 180323788f4SGreg Roach /** 181323788f4SGreg Roach * Test new mother names 18217d74f3aSGreg Roach * 18315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 18452348eb8SGreg Roach * 18552348eb8SGreg Roach * @return void 186323788f4SGreg Roach */ 187c1010edaSGreg Roach public function testNewMotherNames() 188c1010edaSGreg Roach { 189323788f4SGreg Roach $this->assertSame( 190c1010edaSGreg Roach [ 191c1010edaSGreg Roach 'NAME' => '// /Iglesias/', 192c1010edaSGreg Roach 'SURN' => 'Iglesias', 193c1010edaSGreg Roach ], 194323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'F') 195323788f4SGreg Roach ); 196323788f4SGreg Roach } 197323788f4SGreg Roach 198323788f4SGreg Roach /** 199323788f4SGreg Roach * Test new parent names 20017d74f3aSGreg Roach * 20115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 20252348eb8SGreg Roach * 20352348eb8SGreg Roach * @return void 204323788f4SGreg Roach */ 205c1010edaSGreg Roach public function testNewParentNames() 206c1010edaSGreg Roach { 207323788f4SGreg Roach $this->assertSame( 20813abd6f3SGreg Roach ['NAME' => '// //'], 209323788f4SGreg Roach $this->surname_tradition->newParentNames('Gabriel /Garcia/ /Iglesias/', 'U') 210323788f4SGreg Roach ); 211323788f4SGreg Roach } 212323788f4SGreg Roach 213323788f4SGreg Roach /** 214323788f4SGreg Roach * Test new husband names 21517d74f3aSGreg Roach * 21615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 21752348eb8SGreg Roach * 21852348eb8SGreg Roach * @return void 219323788f4SGreg Roach */ 220c1010edaSGreg Roach public function testNewHusbandNames() 221c1010edaSGreg Roach { 222323788f4SGreg Roach $this->assertSame( 22313abd6f3SGreg Roach ['NAME' => '// //'], 224323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Maria /Ruiz/ /Lorca/', 'M') 225323788f4SGreg Roach ); 226323788f4SGreg Roach } 227323788f4SGreg Roach 228323788f4SGreg Roach /** 229323788f4SGreg Roach * Test new wife names 23017d74f3aSGreg Roach * 23115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 23252348eb8SGreg Roach * 23352348eb8SGreg Roach * @return void 234323788f4SGreg Roach */ 235c1010edaSGreg Roach public function testNewWifeNames() 236c1010edaSGreg Roach { 237323788f4SGreg Roach $this->assertSame( 23813abd6f3SGreg Roach ['NAME' => '// //'], 239323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'F') 240323788f4SGreg Roach ); 241323788f4SGreg Roach } 242323788f4SGreg Roach 243323788f4SGreg Roach /** 244323788f4SGreg Roach * Test new spouse names 24517d74f3aSGreg Roach * 24615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PortugueseSurnameTradition 24752348eb8SGreg Roach * 24852348eb8SGreg Roach * @return void 249323788f4SGreg Roach */ 250c1010edaSGreg Roach public function testNewSpouseNames() 251c1010edaSGreg Roach { 252323788f4SGreg Roach $this->assertSame( 25313abd6f3SGreg Roach ['NAME' => '// //'], 254323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Gabriel /Garcia/ /Iglesias/', 'U') 255323788f4SGreg Roach ); 256323788f4SGreg Roach } 257323788f4SGreg Roach} 258