1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2019 webtrees development team 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16declare(strict_types=1); 17 18namespace Fisharebest\Webtrees\SurnameTradition; 19 20/** 21 * Test harness for the class PatrilinenalSurnameTradition 22 */ 23class MatrilinealSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase 24{ 25 /** @var SurnameTraditionInterface */ 26 private $surname_tradition; 27 28 /** 29 * Prepare the environment for these tests 30 * 31 * @return void 32 */ 33 protected function setUp() 34 { 35 parent::setUp(); 36 37 $this->surname_tradition = new MatrilinealSurnameTradition(); 38 } 39 40 /** 41 * Test whether married surnames are used 42 * 43 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 44 * 45 * @return void 46 */ 47 public function testMarriedSurnames(): void 48 { 49 $this->assertSame(false, $this->surname_tradition->hasMarriedNames()); 50 } 51 52 /** 53 * Test whether surnames are used 54 * 55 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 56 * 57 * @return void 58 */ 59 public function testSurnames(): void 60 { 61 $this->assertSame(true, $this->surname_tradition->hasSurnames()); 62 } 63 64 /** 65 * Test new son names 66 * 67 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 68 * 69 * @return void 70 */ 71 public function testNewSonNames(): void 72 { 73 $this->assertSame( 74 [ 75 'NAME' => '/Black/', 76 'SURN' => 'Black', 77 ], 78 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 79 ); 80 } 81 82 /** 83 * Test new daughter names 84 * 85 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 86 * 87 * @return void 88 */ 89 public function testNewDaughterNames(): void 90 { 91 $this->assertSame( 92 [ 93 'NAME' => '/Black/', 94 'SURN' => 'Black', 95 ], 96 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 97 ); 98 } 99 100 /** 101 * Test new child names 102 * 103 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 104 * 105 * @return void 106 */ 107 public function testNewChildNames(): void 108 { 109 $this->assertSame( 110 [ 111 'NAME' => '/Black/', 112 'SURN' => 'Black', 113 ], 114 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 115 ); 116 } 117 118 /** 119 * Test new child names 120 * 121 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 122 * 123 * @return void 124 */ 125 public function testNewChildNamesWithSpfx(): void 126 { 127 $this->assertSame( 128 [ 129 'NAME' => '/van Black/', 130 'SPFX' => 'van', 131 'SURN' => 'Black', 132 ], 133 $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U') 134 ); 135 } 136 137 /** 138 * Test new child names 139 * 140 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 141 * 142 * @return void 143 */ 144 public function testNewChildNamesWithNoParentsNames(): void 145 { 146 $this->assertSame( 147 ['NAME' => '//'], 148 $this->surname_tradition->newChildNames('', '', 'U') 149 ); 150 } 151 152 /** 153 * Test new father names 154 * 155 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 156 * 157 * @return void 158 */ 159 public function testNewFatherNames(): void 160 { 161 $this->assertSame( 162 ['NAME' => '//'], 163 $this->surname_tradition->newParentNames('John /White/', 'M') 164 ); 165 } 166 167 /** 168 * Test new mother names 169 * 170 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 171 * 172 * @return void 173 */ 174 public function testNewMotherNames(): void 175 { 176 $this->assertSame( 177 [ 178 'NAME' => '/White/', 179 'SURN' => 'White', 180 ], 181 $this->surname_tradition->newParentNames('John /White/', 'F') 182 ); 183 } 184 185 /** 186 * Test new parent names 187 * 188 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 189 * 190 * @return void 191 */ 192 public function testNewParentNames(): void 193 { 194 $this->assertSame( 195 ['NAME' => '//'], 196 $this->surname_tradition->newParentNames('John /White/', 'U') 197 ); 198 } 199 200 /** 201 * Test new husband names 202 * 203 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 204 * 205 * @return void 206 */ 207 public function testNewHusbandNames(): void 208 { 209 $this->assertSame( 210 ['NAME' => '//'], 211 $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 212 ); 213 } 214 215 /** 216 * Test new wife names 217 * 218 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 219 * 220 * @return void 221 */ 222 public function testNewWifeNames(): void 223 { 224 $this->assertSame( 225 ['NAME' => '//'], 226 $this->surname_tradition->newSpouseNames('John /White/', 'F') 227 ); 228 } 229 230 /** 231 * Test new spouse names 232 * 233 * @covers \Fisharebest\Webtrees\SurnameTradition\MatrilinealSurnameTradition 234 * 235 * @return void 236 */ 237 public function testNewSpouseNames(): void 238 { 239 $this->assertSame( 240 ['NAME' => '//'], 241 $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 242 ); 243 } 244} 245