1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2018 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 */ 16namespace Fisharebest\Webtrees\SurnameTradition; 17 18use Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition; 19use Fisharebest\Webtrees\SurnameTradition\SurnameTraditionInterface; 20 21/** 22 * Test harness for the class PatrilinenalSurnameTradition 23 */ 24class PatrilinealSurnameTraditionTest extends \Fisharebest\Webtrees\TestCase 25{ 26 /** @var SurnameTraditionInterface */ 27 private $surname_tradition; 28 29 /** 30 * Prepare the environment for these tests 31 */ 32 public function setUp() 33 { 34 $this->surname_tradition = new PatrilinealSurnameTradition; 35 } 36 37 /** 38 * Test whether married surnames are used 39 * 40 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 41 */ 42 public function testMarriedSurnames() 43 { 44 $this->assertSame(false, $this->surname_tradition->hasMarriedNames()); 45 } 46 47 /** 48 * Test whether surnames are used 49 * 50 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 51 */ 52 public function testSurnames() 53 { 54 $this->assertSame(true, $this->surname_tradition->hasSurnames()); 55 } 56 57 /** 58 * Test new son names 59 * 60 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 61 */ 62 public function testNewSonNames() 63 { 64 $this->assertSame( 65 [ 66 'NAME' => '/White/', 67 'SURN' => 'White', 68 ], 69 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'M') 70 ); 71 } 72 73 /** 74 * Test new daughter names 75 * 76 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 77 */ 78 public function testNewDaughterNames() 79 { 80 $this->assertSame( 81 [ 82 'NAME' => '/White/', 83 'SURN' => 'White', 84 ], 85 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'F') 86 ); 87 } 88 89 /** 90 * Test new child names 91 * 92 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 93 */ 94 public function testNewChildNames() 95 { 96 $this->assertSame( 97 [ 98 'NAME' => '/White/', 99 'SURN' => 'White', 100 ], 101 $this->surname_tradition->newChildNames('John /White/', 'Mary /Black/', 'U') 102 ); 103 } 104 105 /** 106 * Test new child names 107 * 108 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 109 */ 110 public function testNewChildNamesWithSpfx() 111 { 112 $this->assertSame( 113 [ 114 'NAME' => '/de White/', 115 'SPFX' => 'de', 116 'SURN' => 'White', 117 ], 118 $this->surname_tradition->newChildNames('John /de White/', 'Mary /van Black/', 'U') 119 ); 120 } 121 122 /** 123 * Test new child names 124 * 125 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 126 */ 127 public function testNewChildNamesWithNoParentsNames() 128 { 129 $this->assertSame( 130 ['NAME' => '//'], 131 $this->surname_tradition->newChildNames('', '', 'U') 132 ); 133 } 134 135 /** 136 * Test new father names 137 * 138 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 139 */ 140 public function testNewFatherNames() 141 { 142 $this->assertSame( 143 [ 144 'NAME' => '/White/', 145 'SURN' => 'White', 146 ], 147 $this->surname_tradition->newParentNames('John /White/', 'M') 148 ); 149 } 150 151 /** 152 * Test new mother names 153 * 154 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 155 */ 156 public function testNewMotherNames() 157 { 158 $this->assertSame( 159 ['NAME' => '//'], 160 $this->surname_tradition->newParentNames('John /White/', 'F') 161 ); 162 } 163 164 /** 165 * Test new parent names 166 * 167 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 168 */ 169 public function testNewParentNames() 170 { 171 $this->assertSame( 172 ['NAME' => '//'], 173 $this->surname_tradition->newParentNames('John /White/', 'U') 174 ); 175 } 176 177 /** 178 * Test new husband names 179 * 180 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 181 */ 182 public function testNewHusbandNames() 183 { 184 $this->assertSame( 185 ['NAME' => '//'], 186 $this->surname_tradition->newSpouseNames('Mary /Black/', 'M') 187 ); 188 } 189 190 /** 191 * Test new wife names 192 * 193 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 194 */ 195 public function testNewWifeNames() 196 { 197 $this->assertSame( 198 ['NAME' => '//'], 199 $this->surname_tradition->newSpouseNames('John /White/', 'F') 200 ); 201 } 202 203 /** 204 * Test new spouse names 205 * 206 * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 207 */ 208 public function testNewSpouseNames() 209 { 210 $this->assertSame( 211 ['NAME' => '//'], 212 $this->surname_tradition->newSpouseNames('Chris /Green/', 'U') 213 ); 214 } 215} 216