1323788f4SGreg Roach<?php 2*3976b470SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 58fcd0d32SGreg Roach * Copyright (C) 2019 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 */ 17e7f56f2aSGreg Roachdeclare(strict_types=1); 18e7f56f2aSGreg Roach 1984e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 20c1010edaSGreg Roach 21323788f4SGreg Roach/** 2217d74f3aSGreg Roach * Test harness for the class DefaultSurnameTradition 23323788f4SGreg Roach */ 2484e2cf4eSGreg Roachclass DefaultSurnameTraditionTest 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 3152348eb8SGreg Roach * 3252348eb8SGreg Roach * @return void 33323788f4SGreg Roach */ 345c48bcd6SGreg Roach protected function setUp(): void 35c1010edaSGreg Roach { 360115bc16SGreg Roach parent::setUp(); 370115bc16SGreg Roach 3874d6dc0eSGreg Roach $this->surname_tradition = new DefaultSurnameTradition(); 39323788f4SGreg Roach } 40323788f4SGreg Roach 41323788f4SGreg Roach /** 42323788f4SGreg Roach * Test whether married surnames are used 4317d74f3aSGreg Roach * 4415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 4552348eb8SGreg Roach * 4652348eb8SGreg Roach * @return void 47323788f4SGreg Roach */ 489b802b22SGreg Roach public function testMarriedSurnames(): void 49c1010edaSGreg Roach { 50a32e6421SGreg Roach $this->assertFalse($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\DefaultSurnameTradition 5752348eb8SGreg Roach * 5852348eb8SGreg Roach * @return void 59c1ec7145SGreg Roach */ 609b802b22SGreg Roach public function testSurnames(): void 61c1010edaSGreg Roach { 62a32e6421SGreg Roach $this->assertTrue($this->surname_tradition->hasSurnames()); 63c1ec7145SGreg Roach } 64c1ec7145SGreg Roach 65c1ec7145SGreg Roach /** 66323788f4SGreg Roach * Test new son names 6717d74f3aSGreg Roach * 6815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 6952348eb8SGreg Roach * 7052348eb8SGreg Roach * @return void 71323788f4SGreg Roach */ 729b802b22SGreg Roach public function testNewSonNames(): void 73c1010edaSGreg Roach { 74323788f4SGreg Roach $this->assertSame( 7513abd6f3SGreg Roach ['NAME' => '//'], 76323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 77323788f4SGreg Roach ); 78323788f4SGreg Roach } 79323788f4SGreg Roach 80323788f4SGreg Roach /** 81323788f4SGreg Roach * Test new daughter names 8217d74f3aSGreg Roach * 8315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 8452348eb8SGreg Roach * 8552348eb8SGreg Roach * @return void 86323788f4SGreg Roach */ 879b802b22SGreg Roach public function testNewDaughterNames(): void 88c1010edaSGreg Roach { 89323788f4SGreg Roach $this->assertSame( 9013abd6f3SGreg Roach ['NAME' => '//'], 91323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 92323788f4SGreg Roach ); 93323788f4SGreg Roach } 94323788f4SGreg Roach 95323788f4SGreg Roach /** 96323788f4SGreg Roach * Test new child names 9717d74f3aSGreg Roach * 9815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 9952348eb8SGreg Roach * 10052348eb8SGreg Roach * @return void 101323788f4SGreg Roach */ 1029b802b22SGreg Roach public function testNewChildNames(): void 103c1010edaSGreg Roach { 104323788f4SGreg Roach $this->assertSame( 10513abd6f3SGreg Roach ['NAME' => '//'], 106323788f4SGreg Roach $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 107323788f4SGreg Roach ); 108323788f4SGreg Roach } 109323788f4SGreg Roach 110323788f4SGreg Roach /** 111323788f4SGreg Roach * Test new father names 11217d74f3aSGreg Roach * 11315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 11452348eb8SGreg Roach * 11552348eb8SGreg Roach * @return void 116323788f4SGreg Roach */ 1179b802b22SGreg Roach public function testNewFatherNames(): void 118c1010edaSGreg Roach { 119323788f4SGreg Roach $this->assertSame( 12013abd6f3SGreg Roach ['NAME' => '//'], 121323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'M') 122323788f4SGreg Roach ); 123323788f4SGreg Roach } 124323788f4SGreg Roach 125323788f4SGreg Roach /** 126323788f4SGreg Roach * Test new mother names 12717d74f3aSGreg Roach * 12815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 12952348eb8SGreg Roach * 13052348eb8SGreg Roach * @return void 131323788f4SGreg Roach */ 1329b802b22SGreg Roach public function testNewMotherNames(): void 133c1010edaSGreg Roach { 134323788f4SGreg Roach $this->assertSame( 13513abd6f3SGreg Roach ['NAME' => '//'], 136323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'F') 137323788f4SGreg Roach ); 138323788f4SGreg Roach } 139323788f4SGreg Roach 140323788f4SGreg Roach /** 141323788f4SGreg Roach * Test new parent names 14217d74f3aSGreg Roach * 14315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 14452348eb8SGreg Roach * 14552348eb8SGreg Roach * @return void 146323788f4SGreg Roach */ 1479b802b22SGreg Roach public function testNewParentNames(): void 148c1010edaSGreg Roach { 149323788f4SGreg Roach $this->assertSame( 15013abd6f3SGreg Roach ['NAME' => '//'], 151323788f4SGreg Roach $this->surname_tradition->newParentNames('John /White/', 'U') 152323788f4SGreg Roach ); 153323788f4SGreg Roach } 154323788f4SGreg Roach 155323788f4SGreg Roach /** 156323788f4SGreg Roach * Test new husband names 15717d74f3aSGreg Roach * 15815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 15952348eb8SGreg Roach * 16052348eb8SGreg Roach * @return void 161323788f4SGreg Roach */ 1629b802b22SGreg Roach public function testNewHusbandNames(): void 163c1010edaSGreg Roach { 164323788f4SGreg Roach $this->assertSame( 16513abd6f3SGreg Roach ['NAME' => '//'], 166323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 167323788f4SGreg Roach ); 168323788f4SGreg Roach } 169323788f4SGreg Roach 170323788f4SGreg Roach /** 171323788f4SGreg Roach * Test new wife names 17217d74f3aSGreg Roach * 17315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 17452348eb8SGreg Roach * 17552348eb8SGreg Roach * @return void 176323788f4SGreg Roach */ 1779b802b22SGreg Roach public function testNewWifeNames(): void 178c1010edaSGreg Roach { 179323788f4SGreg Roach $this->assertSame( 18013abd6f3SGreg Roach ['NAME' => '//'], 181323788f4SGreg Roach $this->surname_tradition->newSpouseNames('John /White/', 'F') 182323788f4SGreg Roach ); 183323788f4SGreg Roach } 184323788f4SGreg Roach 185323788f4SGreg Roach /** 186323788f4SGreg Roach * Test new spouse names 18717d74f3aSGreg Roach * 18815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\DefaultSurnameTradition 18952348eb8SGreg Roach * 19052348eb8SGreg Roach * @return void 191323788f4SGreg Roach */ 1929b802b22SGreg Roach public function testNewSpouseNames(): void 193c1010edaSGreg Roach { 194323788f4SGreg Roach $this->assertSame( 19513abd6f3SGreg Roach ['NAME' => '//'], 196323788f4SGreg Roach $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 197323788f4SGreg Roach ); 198323788f4SGreg Roach } 199323788f4SGreg Roach} 200