1323788f4SGreg Roach<?php 23976b470SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 5*5e933c21SGreg Roach * Copyright (C) 2020 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 */ 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/** 2517d74f3aSGreg Roach * Test harness for the class DefaultSurnameTradition 26323788f4SGreg Roach */ 273cfcc809SGreg Roachclass DefaultSurnameTraditionTest extends TestCase 28c1010edaSGreg Roach{ 29323788f4SGreg Roach /** @var SurnameTraditionInterface */ 30323788f4SGreg Roach private $surname_tradition; 31323788f4SGreg Roach 32323788f4SGreg Roach /** 33323788f4SGreg Roach * Prepare the environment for these tests 3452348eb8SGreg Roach * 3552348eb8SGreg Roach * @return void 36323788f4SGreg Roach */ 375c48bcd6SGreg Roach protected function setUp(): void 38c1010edaSGreg Roach { 390115bc16SGreg Roach parent::setUp(); 400115bc16SGreg Roach 4174d6dc0eSGreg Roach $this->surname_tradition = new DefaultSurnameTradition(); 42323788f4SGreg Roach } 43323788f4SGreg Roach 44323788f4SGreg Roach /** 45323788f4SGreg Roach * Test whether married surnames are used 4617d74f3aSGreg Roach * 4715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 4852348eb8SGreg Roach * 4952348eb8SGreg Roach * @return void 50323788f4SGreg Roach */ 519b802b22SGreg Roach public function testMarriedSurnames(): void 52c1010edaSGreg Roach { 53*5e933c21SGreg Roach self::assertFalse($this->surname_tradition->hasMarriedNames()); 54323788f4SGreg Roach } 55323788f4SGreg Roach 56323788f4SGreg Roach /** 57c1ec7145SGreg Roach * Test whether surnames are used 5817d74f3aSGreg Roach * 5915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 6052348eb8SGreg Roach * 6152348eb8SGreg Roach * @return void 62c1ec7145SGreg Roach */ 639b802b22SGreg Roach public function testSurnames(): void 64c1010edaSGreg Roach { 65*5e933c21SGreg Roach self::assertTrue($this->surname_tradition->hasSurnames()); 66c1ec7145SGreg Roach } 67c1ec7145SGreg Roach 68c1ec7145SGreg Roach /** 69323788f4SGreg Roach * Test new son names 7017d74f3aSGreg Roach * 7115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 7252348eb8SGreg Roach * 7352348eb8SGreg Roach * @return void 74323788f4SGreg Roach */ 759b802b22SGreg Roach public function testNewSonNames(): void 76c1010edaSGreg Roach { 77*5e933c21SGreg Roach self::assertSame( 7813abd6f3SGreg Roach ['NAME' => '//'], 79323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 80323788f4SGreg Roach ); 81323788f4SGreg Roach } 82323788f4SGreg Roach 83323788f4SGreg Roach /** 84323788f4SGreg Roach * Test new daughter names 8517d74f3aSGreg Roach * 8615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 8752348eb8SGreg Roach * 8852348eb8SGreg Roach * @return void 89323788f4SGreg Roach */ 909b802b22SGreg Roach public function testNewDaughterNames(): void 91c1010edaSGreg Roach { 92*5e933c21SGreg Roach self::assertSame( 9313abd6f3SGreg Roach ['NAME' => '//'], 94323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 95323788f4SGreg Roach ); 96323788f4SGreg Roach } 97323788f4SGreg Roach 98323788f4SGreg Roach /** 99323788f4SGreg Roach * Test new child names 10017d74f3aSGreg Roach * 10115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 10252348eb8SGreg Roach * 10352348eb8SGreg Roach * @return void 104323788f4SGreg Roach */ 1059b802b22SGreg Roach public function testNewChildNames(): void 106c1010edaSGreg Roach { 107*5e933c21SGreg Roach self::assertSame( 10813abd6f3SGreg Roach ['NAME' => '//'], 109323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 110323788f4SGreg Roach ); 111323788f4SGreg Roach } 112323788f4SGreg Roach 113323788f4SGreg Roach /** 114323788f4SGreg Roach * Test new father names 11517d74f3aSGreg Roach * 11615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 11752348eb8SGreg Roach * 11852348eb8SGreg Roach * @return void 119323788f4SGreg Roach */ 1209b802b22SGreg Roach public function testNewFatherNames(): void 121c1010edaSGreg Roach { 122*5e933c21SGreg Roach self::assertSame( 12313abd6f3SGreg Roach ['NAME' => '//'], 124323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 125323788f4SGreg Roach ); 126323788f4SGreg Roach } 127323788f4SGreg Roach 128323788f4SGreg Roach /** 129323788f4SGreg Roach * Test new mother names 13017d74f3aSGreg Roach * 13115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 13252348eb8SGreg Roach * 13352348eb8SGreg Roach * @return void 134323788f4SGreg Roach */ 1359b802b22SGreg Roach public function testNewMotherNames(): void 136c1010edaSGreg Roach { 137*5e933c21SGreg Roach self::assertSame( 13813abd6f3SGreg Roach ['NAME' => '//'], 139323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 140323788f4SGreg Roach ); 141323788f4SGreg Roach } 142323788f4SGreg Roach 143323788f4SGreg Roach /** 144323788f4SGreg Roach * Test new parent names 14517d74f3aSGreg Roach * 14615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 14752348eb8SGreg Roach * 14852348eb8SGreg Roach * @return void 149323788f4SGreg Roach */ 1509b802b22SGreg Roach public function testNewParentNames(): void 151c1010edaSGreg Roach { 152*5e933c21SGreg Roach self::assertSame( 15313abd6f3SGreg Roach ['NAME' => '//'], 154323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 155323788f4SGreg Roach ); 156323788f4SGreg Roach } 157323788f4SGreg Roach 158323788f4SGreg Roach /** 159323788f4SGreg Roach * Test new husband names 16017d74f3aSGreg Roach * 16115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 16252348eb8SGreg Roach * 16352348eb8SGreg Roach * @return void 164323788f4SGreg Roach */ 1659b802b22SGreg Roach public function testNewHusbandNames(): void 166c1010edaSGreg Roach { 167*5e933c21SGreg Roach self::assertSame( 16813abd6f3SGreg Roach ['NAME' => '//'], 169323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 170323788f4SGreg Roach ); 171323788f4SGreg Roach } 172323788f4SGreg Roach 173323788f4SGreg Roach /** 174323788f4SGreg Roach * Test new wife names 17517d74f3aSGreg Roach * 17615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 17752348eb8SGreg Roach * 17852348eb8SGreg Roach * @return void 179323788f4SGreg Roach */ 1809b802b22SGreg Roach public function testNewWifeNames(): void 181c1010edaSGreg Roach { 182*5e933c21SGreg Roach self::assertSame( 18313abd6f3SGreg Roach ['NAME' => '//'], 184323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 185323788f4SGreg Roach ); 186323788f4SGreg Roach } 187323788f4SGreg Roach 188323788f4SGreg Roach /** 189323788f4SGreg Roach * Test new spouse names 19017d74f3aSGreg Roach * 19115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 19252348eb8SGreg Roach * 19352348eb8SGreg Roach * @return void 194323788f4SGreg Roach */ 1959b802b22SGreg Roach public function testNewSpouseNames(): void 196c1010edaSGreg Roach { 197*5e933c21SGreg Roach self::assertSame( 19813abd6f3SGreg Roach ['NAME' => '//'], 199323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 200323788f4SGreg Roach ); 201323788f4SGreg Roach } 202323788f4SGreg Roach} 203