1323788f4SGreg Roach<?php 23976b470SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 589f7189bSGreg Roach * Copyright (C) 2021 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 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16323788f4SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 2084e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 21c1010edaSGreg Roach 223cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase; 233cfcc809SGreg Roach 24323788f4SGreg Roach/** 25*c4943cffSGreg Roach * Test harness for the class MatrilinenalSurnameTradition 26323788f4SGreg Roach */ 273cfcc809SGreg Roachclass MatrilinealSurnameTraditionTest extends TestCase 28c1010edaSGreg Roach{ 29*c4943cffSGreg Roach private SurnameTraditionInterface $surname_tradition; 30323788f4SGreg Roach 31323788f4SGreg Roach /** 32323788f4SGreg Roach * Prepare the environment for these tests 3352348eb8SGreg Roach * 3452348eb8SGreg Roach * @return void 35323788f4SGreg Roach */ 365c48bcd6SGreg Roach protected function setUp(): void 37c1010edaSGreg Roach { 380115bc16SGreg Roach parent::setUp(); 390115bc16SGreg Roach 4074d6dc0eSGreg Roach $this->surname_tradition = new MatrilinealSurnameTradition(); 41323788f4SGreg Roach } 42323788f4SGreg Roach 43323788f4SGreg Roach /** 44323788f4SGreg Roach * Test whether married surnames are used 4517d74f3aSGreg Roach * 4615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 4752348eb8SGreg Roach * 4852348eb8SGreg Roach * @return void 49323788f4SGreg Roach */ 509b802b22SGreg Roach public function testMarriedSurnames(): void 51c1010edaSGreg Roach { 525e933c21SGreg Roach self::assertFalse($this->surname_tradition->hasMarriedNames()); 53323788f4SGreg Roach } 54323788f4SGreg Roach 55323788f4SGreg Roach /** 56c1ec7145SGreg Roach * Test whether surnames are used 5717d74f3aSGreg Roach * 5815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 5952348eb8SGreg Roach * 6052348eb8SGreg Roach * @return void 61c1ec7145SGreg Roach */ 629b802b22SGreg Roach public function testSurnames(): void 63c1010edaSGreg Roach { 645e933c21SGreg Roach self::assertTrue($this->surname_tradition->hasSurnames()); 65c1ec7145SGreg Roach } 66c1ec7145SGreg Roach 67c1ec7145SGreg Roach /** 68323788f4SGreg Roach * Test new son names 6917d74f3aSGreg Roach * 7015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 7152348eb8SGreg Roach * 7252348eb8SGreg Roach * @return void 73323788f4SGreg Roach */ 749b802b22SGreg Roach public function testNewSonNames(): void 75c1010edaSGreg Roach { 765e933c21SGreg Roach self::assertSame( 77c1010edaSGreg Roach [ 78c1010edaSGreg Roach 'NAME' => '/Black/', 79c1010edaSGreg Roach 'SURN' => 'Black', 80c1010edaSGreg Roach ], 81323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 82323788f4SGreg Roach ); 83323788f4SGreg Roach } 84323788f4SGreg Roach 85323788f4SGreg Roach /** 86323788f4SGreg Roach * Test new daughter names 8717d74f3aSGreg Roach * 8815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 8952348eb8SGreg Roach * 9052348eb8SGreg Roach * @return void 91323788f4SGreg Roach */ 929b802b22SGreg Roach public function testNewDaughterNames(): void 93c1010edaSGreg Roach { 945e933c21SGreg Roach self::assertSame( 95c1010edaSGreg Roach [ 96c1010edaSGreg Roach 'NAME' => '/Black/', 97c1010edaSGreg Roach 'SURN' => 'Black', 98c1010edaSGreg Roach ], 99323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 100323788f4SGreg Roach ); 101323788f4SGreg Roach } 102323788f4SGreg Roach 103323788f4SGreg Roach /** 104323788f4SGreg Roach * Test new child names 10517d74f3aSGreg Roach * 10615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 10752348eb8SGreg Roach * 10852348eb8SGreg Roach * @return void 109323788f4SGreg Roach */ 1109b802b22SGreg Roach public function testNewChildNames(): void 111c1010edaSGreg Roach { 1125e933c21SGreg Roach self::assertSame( 113c1010edaSGreg Roach [ 114c1010edaSGreg Roach 'NAME' => '/Black/', 115c1010edaSGreg Roach 'SURN' => 'Black', 116c1010edaSGreg Roach ], 117323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 118323788f4SGreg Roach ); 119323788f4SGreg Roach } 120323788f4SGreg Roach 121323788f4SGreg Roach /** 122323788f4SGreg Roach * Test new child names 12317d74f3aSGreg Roach * 12415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 12552348eb8SGreg Roach * 12652348eb8SGreg Roach * @return void 127323788f4SGreg Roach */ 1289b802b22SGreg Roach public function testNewChildNamesWithSpfx(): void 129c1010edaSGreg Roach { 1305e933c21SGreg Roach self::assertSame( 131c1010edaSGreg Roach [ 132c1010edaSGreg Roach 'NAME' => '/van Black/', 133c1010edaSGreg Roach 'SPFX' => 'van', 134c1010edaSGreg Roach 'SURN' => 'Black', 135c1010edaSGreg Roach ], 136323788f4SGreg Roach $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U') 137323788f4SGreg Roach ); 138323788f4SGreg Roach } 139323788f4SGreg Roach 140323788f4SGreg Roach /** 1411677a03aSGreg Roach * Test new child names 14217d74f3aSGreg Roach * 14315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 14452348eb8SGreg Roach * 14552348eb8SGreg Roach * @return void 1461677a03aSGreg Roach */ 1479b802b22SGreg Roach public function testNewChildNamesWithNoParentsNames(): void 148c1010edaSGreg Roach { 1495e933c21SGreg Roach self::assertSame( 15013abd6f3SGreg Roach ['NAME' => '//'], 1511677a03aSGreg Roach $this->surname_tradition->newChildNames('', '', 'U') 1521677a03aSGreg Roach ); 1531677a03aSGreg Roach } 1541677a03aSGreg Roach 1551677a03aSGreg Roach /** 156323788f4SGreg Roach * Test new father names 15717d74f3aSGreg Roach * 15815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 15952348eb8SGreg Roach * 16052348eb8SGreg Roach * @return void 161323788f4SGreg Roach */ 1629b802b22SGreg Roach public function testNewFatherNames(): void 163c1010edaSGreg Roach { 1645e933c21SGreg Roach self::assertSame( 16513abd6f3SGreg Roach ['NAME' => '//'], 166323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 167323788f4SGreg Roach ); 168323788f4SGreg Roach } 169323788f4SGreg Roach 170323788f4SGreg Roach /** 171323788f4SGreg Roach * Test new mother names 17217d74f3aSGreg Roach * 17315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 17452348eb8SGreg Roach * 17552348eb8SGreg Roach * @return void 176323788f4SGreg Roach */ 1779b802b22SGreg Roach public function testNewMotherNames(): void 178c1010edaSGreg Roach { 1795e933c21SGreg Roach self::assertSame( 180c1010edaSGreg Roach [ 181c1010edaSGreg Roach 'NAME' => '/White/', 182c1010edaSGreg Roach 'SURN' => 'White', 183c1010edaSGreg Roach ], 184323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 185323788f4SGreg Roach ); 186323788f4SGreg Roach } 187323788f4SGreg Roach 188323788f4SGreg Roach /** 189323788f4SGreg Roach * Test new parent names 19017d74f3aSGreg Roach * 19115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 19252348eb8SGreg Roach * 19352348eb8SGreg Roach * @return void 194323788f4SGreg Roach */ 1959b802b22SGreg Roach public function testNewParentNames(): void 196c1010edaSGreg Roach { 1975e933c21SGreg Roach self::assertSame( 19813abd6f3SGreg Roach ['NAME' => '//'], 199323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 200323788f4SGreg Roach ); 201323788f4SGreg Roach } 202323788f4SGreg Roach 203323788f4SGreg Roach /** 204323788f4SGreg Roach * Test new husband names 20517d74f3aSGreg Roach * 20615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 20752348eb8SGreg Roach * 20852348eb8SGreg Roach * @return void 209323788f4SGreg Roach */ 2109b802b22SGreg Roach public function testNewHusbandNames(): void 211c1010edaSGreg Roach { 2125e933c21SGreg Roach self::assertSame( 21313abd6f3SGreg Roach ['NAME' => '//'], 214323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 215323788f4SGreg Roach ); 216323788f4SGreg Roach } 217323788f4SGreg Roach 218323788f4SGreg Roach /** 219323788f4SGreg Roach * Test new wife names 22017d74f3aSGreg Roach * 22115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 22252348eb8SGreg Roach * 22352348eb8SGreg Roach * @return void 224323788f4SGreg Roach */ 2259b802b22SGreg Roach public function testNewWifeNames(): void 226c1010edaSGreg Roach { 2275e933c21SGreg Roach self::assertSame( 22813abd6f3SGreg Roach ['NAME' => '//'], 229323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 230323788f4SGreg Roach ); 231323788f4SGreg Roach } 232323788f4SGreg Roach 233323788f4SGreg Roach /** 234323788f4SGreg Roach * Test new spouse names 23517d74f3aSGreg Roach * 23615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 23752348eb8SGreg Roach * 23852348eb8SGreg Roach * @return void 239323788f4SGreg Roach */ 2409b802b22SGreg Roach public function testNewSpouseNames(): void 241c1010edaSGreg Roach { 2425e933c21SGreg Roach self::assertSame( 24313abd6f3SGreg Roach ['NAME' => '//'], 244323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 245323788f4SGreg Roach ); 246323788f4SGreg Roach } 247323788f4SGreg Roach} 248