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 22*cb7a42eaSGreg Roachuse Fisharebest\Webtrees\Fact; 23*cb7a42eaSGreg Roachuse Fisharebest\Webtrees\Individual; 243cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase; 25*cb7a42eaSGreg Roachuse Illuminate\Support\Collection; 263cfcc809SGreg Roach 27323788f4SGreg Roach/** 28c4943cffSGreg Roach * Test harness for the class LithuanianSurnameTraditionTest 29323788f4SGreg Roach */ 303cfcc809SGreg Roachclass LithuanianSurnameTraditionTest extends TestCase 31c1010edaSGreg Roach{ 32c4943cffSGreg Roach private SurnameTraditionInterface $surname_tradition; 33323788f4SGreg Roach 34323788f4SGreg Roach /** 35323788f4SGreg Roach * Prepare the environment for these tests 3652348eb8SGreg Roach * 3752348eb8SGreg Roach * @return void 38323788f4SGreg Roach */ 395c48bcd6SGreg Roach protected function setUp(): void 40c1010edaSGreg Roach { 410115bc16SGreg Roach parent::setUp(); 420115bc16SGreg Roach 4374d6dc0eSGreg Roach $this->surname_tradition = new LithuanianSurnameTradition(); 44323788f4SGreg Roach } 45323788f4SGreg Roach 46323788f4SGreg Roach /** 47323788f4SGreg Roach * Test whether married surnames are used 4817d74f3aSGreg Roach * 4915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 5015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 5152348eb8SGreg Roach * 5252348eb8SGreg Roach * @return void 53323788f4SGreg Roach */ 549b802b22SGreg Roach public function testMarriedSurnames(): void 55c1010edaSGreg Roach { 565e933c21SGreg Roach self::assertTrue($this->surname_tradition->hasMarriedNames()); 57323788f4SGreg Roach } 58323788f4SGreg Roach 59323788f4SGreg Roach /** 60c1ec7145SGreg Roach * Test whether surnames are used 6117d74f3aSGreg Roach * 6215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 6315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 6452348eb8SGreg Roach * 6552348eb8SGreg Roach * @return void 66c1ec7145SGreg Roach */ 679b802b22SGreg Roach public function testSurnames(): void 68c1010edaSGreg Roach { 695e933c21SGreg Roach self::assertTrue($this->surname_tradition->hasSurnames()); 70c1ec7145SGreg Roach } 71c1ec7145SGreg Roach 72c1ec7145SGreg Roach /** 73323788f4SGreg Roach * Test new son names 7417d74f3aSGreg Roach * 7515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 7615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 7752348eb8SGreg Roach * 7852348eb8SGreg Roach * @return void 79323788f4SGreg Roach */ 809b802b22SGreg Roach public function testNewSonNames(): void 81c1010edaSGreg Roach { 82*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 83*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /White/'); 84*cb7a42eaSGreg Roach 85*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 86*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 87*cb7a42eaSGreg Roach 88*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 89*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 90*cb7a42eaSGreg Roach 91*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 92*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 93*cb7a42eaSGreg Roach 945e933c21SGreg Roach self::assertSame( 95*cb7a42eaSGreg Roach ["1 NAME /White/\n2 TYPE birth\n2 SURN White"], 96*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'M') 97323788f4SGreg Roach ); 98323788f4SGreg Roach } 99323788f4SGreg Roach 100323788f4SGreg Roach /** 101323788f4SGreg Roach * Test new daughter names 10217d74f3aSGreg Roach * 10315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 10415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 10552348eb8SGreg Roach * 10652348eb8SGreg Roach * @return void 107323788f4SGreg Roach */ 1089b802b22SGreg Roach public function testNewDaughterNames(): void 109c1010edaSGreg Roach { 110*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 111*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /White/'); 112*cb7a42eaSGreg Roach 113*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 114*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 115*cb7a42eaSGreg Roach 116*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 117*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 118*cb7a42eaSGreg Roach 119*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 120*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 121*cb7a42eaSGreg Roach 1225e933c21SGreg Roach self::assertSame( 123*cb7a42eaSGreg Roach ["1 NAME /White/\n2 TYPE birth\n2 SURN White"], 124*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 125323788f4SGreg Roach ); 126323788f4SGreg Roach } 127323788f4SGreg Roach 128323788f4SGreg Roach /** 129323788f4SGreg Roach * Test new daughter names 13017d74f3aSGreg Roach * 13115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 13215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 13352348eb8SGreg Roach * 13452348eb8SGreg Roach * @return void 135323788f4SGreg Roach */ 1369b802b22SGreg Roach public function testNewDaughterNamesInflected(): void 137c1010edaSGreg Roach { 138*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 139*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whita/'); 140*cb7a42eaSGreg Roach 141*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 142*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 143*cb7a42eaSGreg Roach 144*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 145*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 146*cb7a42eaSGreg Roach 147*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 148*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 149*cb7a42eaSGreg Roach 1505e933c21SGreg Roach self::assertSame( 151*cb7a42eaSGreg Roach ["1 NAME /Whitaitė/\n2 TYPE birth\n2 SURN Whita"], 152*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 153323788f4SGreg Roach ); 154*cb7a42eaSGreg Roach 155*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 156*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whitas/'); 157*cb7a42eaSGreg Roach 158*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 159*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 160*cb7a42eaSGreg Roach 1615e933c21SGreg Roach self::assertSame( 162*cb7a42eaSGreg Roach ["1 NAME /Whitaitė/\n2 TYPE birth\n2 SURN Whitas"], 163*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 164323788f4SGreg Roach ); 165*cb7a42eaSGreg Roach 166*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 167*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whitis/'); 168*cb7a42eaSGreg Roach 169*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 170*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 171*cb7a42eaSGreg Roach 1725e933c21SGreg Roach self::assertSame( 173*cb7a42eaSGreg Roach ["1 NAME /Whitytė/\n2 TYPE birth\n2 SURN Whitis"], 174*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 175323788f4SGreg Roach ); 176*cb7a42eaSGreg Roach 177*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 178*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whitys/'); 179*cb7a42eaSGreg Roach 180*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 181*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 182*cb7a42eaSGreg Roach 1835e933c21SGreg Roach self::assertSame( 184*cb7a42eaSGreg Roach ["1 NAME /Whitytė/\n2 TYPE birth\n2 SURN Whitys"], 185*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 186323788f4SGreg Roach ); 187*cb7a42eaSGreg Roach 188*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 189*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whitius/'); 190*cb7a42eaSGreg Roach 191*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 192*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 193*cb7a42eaSGreg Roach 1945e933c21SGreg Roach self::assertSame( 195*cb7a42eaSGreg Roach ["1 NAME /Whitiūtė/\n2 TYPE birth\n2 SURN Whitius"], 196*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 197323788f4SGreg Roach ); 198*cb7a42eaSGreg Roach 199*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 200*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whitus/'); 201*cb7a42eaSGreg Roach 202*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 203*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 204*cb7a42eaSGreg Roach 2055e933c21SGreg Roach self::assertSame( 206*cb7a42eaSGreg Roach ["1 NAME /Whitutė/\n2 TYPE birth\n2 SURN Whitus"], 207*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 208323788f4SGreg Roach ); 209323788f4SGreg Roach } 210323788f4SGreg Roach 211323788f4SGreg Roach /** 212323788f4SGreg Roach * Test new child names 21317d74f3aSGreg Roach * 21415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 21515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 21652348eb8SGreg Roach * 21752348eb8SGreg Roach * @return void 218323788f4SGreg Roach */ 2199b802b22SGreg Roach public function testNewChildNames(): void 220c1010edaSGreg Roach { 221*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 222*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /White/'); 223*cb7a42eaSGreg Roach 224*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 225*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 226*cb7a42eaSGreg Roach 227*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 228*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 229*cb7a42eaSGreg Roach 230*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 231*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 232*cb7a42eaSGreg Roach 2335e933c21SGreg Roach self::assertSame( 234*cb7a42eaSGreg Roach ["1 NAME /White/\n2 TYPE birth\n2 SURN White"], 235*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'U') 236323788f4SGreg Roach ); 237323788f4SGreg Roach } 238323788f4SGreg Roach 239323788f4SGreg Roach /** 2401677a03aSGreg Roach * Test new child names 24117d74f3aSGreg Roach * 24215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 24315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 24452348eb8SGreg Roach * 24552348eb8SGreg Roach * @return void 2461677a03aSGreg Roach */ 2479b802b22SGreg Roach public function testNewChildNamesWithNoParentsNames(): void 248c1010edaSGreg Roach { 2495e933c21SGreg Roach self::assertSame( 250*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 251*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames(null, null, 'U') 2521677a03aSGreg Roach ); 2531677a03aSGreg Roach } 2541677a03aSGreg Roach 2551677a03aSGreg Roach /** 256323788f4SGreg Roach * Test new father names 25717d74f3aSGreg Roach * 25815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 25915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 26052348eb8SGreg Roach * 26152348eb8SGreg Roach * @return void 262323788f4SGreg Roach */ 2639b802b22SGreg Roach public function testNewFatherNames(): void 264c1010edaSGreg Roach { 265*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 266*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('John /White/'); 267*cb7a42eaSGreg Roach 268*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 269*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 270*cb7a42eaSGreg Roach 2715e933c21SGreg Roach self::assertSame( 272*cb7a42eaSGreg Roach ["1 NAME /White/\n2 TYPE birth\n2 SURN White"], 273*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 274323788f4SGreg Roach ); 275323788f4SGreg Roach } 276323788f4SGreg Roach 277323788f4SGreg Roach /** 278323788f4SGreg Roach * Test new father names 27917d74f3aSGreg Roach * 28015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 28115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 28252348eb8SGreg Roach * 28352348eb8SGreg Roach * @return void 284323788f4SGreg Roach */ 2859b802b22SGreg Roach public function testNewFatherNamesInflected(): void 286c1010edaSGreg Roach { 287*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 288*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Mary /Whitaitė/'); 289*cb7a42eaSGreg Roach 290*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 291*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 292*cb7a42eaSGreg Roach 2935e933c21SGreg Roach self::assertSame( 294*cb7a42eaSGreg Roach ["1 NAME /Whitas/\n2 TYPE birth\n2 SURN Whitas"], 295*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 296323788f4SGreg Roach ); 297*cb7a42eaSGreg Roach 298*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 299*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Mary /Whitytė/'); 300*cb7a42eaSGreg Roach 301*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 302*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 303*cb7a42eaSGreg Roach 3045e933c21SGreg Roach self::assertSame( 305*cb7a42eaSGreg Roach ["1 NAME /Whitis/\n2 TYPE birth\n2 SURN Whitis"], 306*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 307323788f4SGreg Roach ); 308*cb7a42eaSGreg Roach 309*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 310*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Mary /Whitiūtė/'); 311*cb7a42eaSGreg Roach 312*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 313*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 314*cb7a42eaSGreg Roach 3155e933c21SGreg Roach self::assertSame( 316*cb7a42eaSGreg Roach ["1 NAME /Whitius/\n2 TYPE birth\n2 SURN Whitius"], 317*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 318323788f4SGreg Roach ); 319*cb7a42eaSGreg Roach 320*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 321*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Mary /Whitutė/'); 322*cb7a42eaSGreg Roach 323*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 324*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 325*cb7a42eaSGreg Roach 3265e933c21SGreg Roach self::assertSame( 327*cb7a42eaSGreg Roach ["1 NAME /Whitus/\n2 TYPE birth\n2 SURN Whitus"], 328*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 329323788f4SGreg Roach ); 330323788f4SGreg Roach } 331323788f4SGreg Roach 332323788f4SGreg Roach /** 333323788f4SGreg Roach * Test new mother names 33417d74f3aSGreg Roach * 33515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 33615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 33752348eb8SGreg Roach * 33852348eb8SGreg Roach * @return void 339323788f4SGreg Roach */ 3409b802b22SGreg Roach public function testNewMotherNames(): void 341c1010edaSGreg Roach { 342*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 343*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('John /White/'); 344*cb7a42eaSGreg Roach 345*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 346*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 347*cb7a42eaSGreg Roach 3485e933c21SGreg Roach self::assertSame( 349*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 350*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'F') 351323788f4SGreg Roach ); 352323788f4SGreg Roach } 353323788f4SGreg Roach 354323788f4SGreg Roach /** 355323788f4SGreg Roach * Test new parent names 35617d74f3aSGreg Roach * 35715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 35815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 35952348eb8SGreg Roach * 36052348eb8SGreg Roach * @return void 361323788f4SGreg Roach */ 3629b802b22SGreg Roach public function testNewParentNames(): void 363c1010edaSGreg Roach { 364*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 365*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('John /White/'); 366*cb7a42eaSGreg Roach 367*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 368*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 369*cb7a42eaSGreg Roach 3705e933c21SGreg Roach self::assertSame( 371*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 372*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'U') 373323788f4SGreg Roach ); 374323788f4SGreg Roach } 375323788f4SGreg Roach 376323788f4SGreg Roach /** 377323788f4SGreg Roach * Test new husband names 37817d74f3aSGreg Roach * 37915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 38015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 38152348eb8SGreg Roach * 38252348eb8SGreg Roach * @return void 383323788f4SGreg Roach */ 3849b802b22SGreg Roach public function testNewHusbandNames(): void 385c1010edaSGreg Roach { 386*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 387*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 388*cb7a42eaSGreg Roach 389*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 390*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 391*cb7a42eaSGreg Roach 3925e933c21SGreg Roach self::assertSame( 393*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 394*cb7a42eaSGreg Roach $this->surname_tradition->newSpouseNames($individual, 'M') 395323788f4SGreg Roach ); 396323788f4SGreg Roach } 397323788f4SGreg Roach 398323788f4SGreg Roach /** 399323788f4SGreg Roach * Test new wife names 40017d74f3aSGreg Roach * 40115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 40215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 40352348eb8SGreg Roach * 40452348eb8SGreg Roach * @return void 405323788f4SGreg Roach */ 4069b802b22SGreg Roach public function testNewWifeNames(): void 407c1010edaSGreg Roach { 408*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 409*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('John /White/'); 410*cb7a42eaSGreg Roach 411*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 412*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 413*cb7a42eaSGreg Roach 4145e933c21SGreg Roach self::assertSame( 415*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth", "1 NAME /White/\n2 TYPE married\n2 SURN White"], 416*cb7a42eaSGreg Roach $this->surname_tradition->newSpouseNames($individual, 'F') 417323788f4SGreg Roach ); 418323788f4SGreg Roach } 419323788f4SGreg Roach 420323788f4SGreg Roach /** 421323788f4SGreg Roach * Test new spouse names 42217d74f3aSGreg Roach * 42315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\LithuanianSurnameTradition 42415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 42552348eb8SGreg Roach * 42652348eb8SGreg Roach * @return void 427323788f4SGreg Roach */ 4289b802b22SGreg Roach public function testNewSpouseNames(): void 429c1010edaSGreg Roach { 430*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 431*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('John /White/'); 432*cb7a42eaSGreg Roach 433*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 434*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 435*cb7a42eaSGreg Roach 4365e933c21SGreg Roach self::assertSame( 437*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 438*cb7a42eaSGreg Roach $this->surname_tradition->newSpouseNames($individual, 'U') 439323788f4SGreg Roach ); 440323788f4SGreg Roach } 441323788f4SGreg Roach} 442