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 PolishSurnameTradition 29323788f4SGreg Roach */ 303cfcc809SGreg Roachclass PolishSurnameTraditionTest extends TestCase 31c1010edaSGreg Roach{ 32c4943cffSGreg Roach private SurnameTraditionInterface $surname_tradition; 33323788f4SGreg Roach 34323788f4SGreg Roach /** 35323788f4SGreg Roach * Test whether married surnames are used 3617d74f3aSGreg Roach * 3715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 3815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 3952348eb8SGreg Roach * 4052348eb8SGreg Roach * @return void 41323788f4SGreg Roach */ 429b802b22SGreg Roach public function testMarriedSurnames(): void 43c1010edaSGreg Roach { 445e933c21SGreg Roach self::assertTrue($this->surname_tradition->hasMarriedNames()); 45323788f4SGreg Roach } 46323788f4SGreg Roach 47323788f4SGreg Roach /** 48c1ec7145SGreg Roach * Test whether surnames are used 4917d74f3aSGreg Roach * 5015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 5115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 5252348eb8SGreg Roach * 5352348eb8SGreg Roach * @return void 54c1ec7145SGreg Roach */ 559b802b22SGreg Roach public function testSurnames(): void 56c1010edaSGreg Roach { 575e933c21SGreg Roach self::assertTrue($this->surname_tradition->hasSurnames()); 58c1ec7145SGreg Roach } 59c1ec7145SGreg Roach 60c1ec7145SGreg Roach /** 61323788f4SGreg Roach * Test new son names 6217d74f3aSGreg Roach * 6315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 6415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 6552348eb8SGreg Roach * 6652348eb8SGreg Roach * @return void 67323788f4SGreg Roach */ 689b802b22SGreg Roach public function testNewSonNames(): void 69c1010edaSGreg Roach { 70*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 71*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /White/'); 72*cb7a42eaSGreg Roach 73*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 74*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 75*cb7a42eaSGreg Roach 76*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 77*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 78*cb7a42eaSGreg Roach 79*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 80*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 81*cb7a42eaSGreg Roach 825e933c21SGreg Roach self::assertSame( 83*cb7a42eaSGreg Roach ["1 NAME /White/\n2 TYPE birth\n2 SURN White"], 84*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'M') 85323788f4SGreg Roach ); 86323788f4SGreg Roach } 87323788f4SGreg Roach 88323788f4SGreg Roach /** 89323788f4SGreg Roach * Test new daughter names 9017d74f3aSGreg Roach * 9115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 9215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 9352348eb8SGreg Roach * 9452348eb8SGreg Roach * @return void 95323788f4SGreg Roach */ 969b802b22SGreg Roach public function testNewDaughterNames(): void 97c1010edaSGreg Roach { 98*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 99*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /White/'); 100*cb7a42eaSGreg Roach 101*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 102*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 103*cb7a42eaSGreg Roach 104*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 105*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 106*cb7a42eaSGreg Roach 107*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 108*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 109*cb7a42eaSGreg Roach 1105e933c21SGreg Roach self::assertSame( 111*cb7a42eaSGreg Roach ["1 NAME /White/\n2 TYPE birth\n2 SURN White"], 112*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 113323788f4SGreg Roach ); 114323788f4SGreg Roach } 115323788f4SGreg Roach 116323788f4SGreg Roach /** 117323788f4SGreg Roach * Test new daughter names 11817d74f3aSGreg Roach * 11915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 12015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 12152348eb8SGreg Roach * 12252348eb8SGreg Roach * @return void 123323788f4SGreg Roach */ 1249b802b22SGreg Roach public function testNewDaughterNamesInflected(): void 125c1010edaSGreg Roach { 126*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 127*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whitecki/'); 128*cb7a42eaSGreg Roach 129*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 130*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 131*cb7a42eaSGreg Roach 132*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 133*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 134*cb7a42eaSGreg Roach 135*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 136*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 137*cb7a42eaSGreg Roach 1385e933c21SGreg Roach self::assertSame( 139*cb7a42eaSGreg Roach ["1 NAME /Whitecka/\n2 TYPE birth\n2 SURN Whitecki"], 140*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 141323788f4SGreg Roach ); 142*cb7a42eaSGreg Roach 143*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 144*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whitedzki/'); 145*cb7a42eaSGreg Roach 146*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 147*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 148*cb7a42eaSGreg Roach 149*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 150*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 151*cb7a42eaSGreg Roach 152*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 153*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 154*cb7a42eaSGreg Roach 1555e933c21SGreg Roach self::assertSame( 156*cb7a42eaSGreg Roach ["1 NAME /Whitedzka/\n2 TYPE birth\n2 SURN Whitedzki"], 157*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 158323788f4SGreg Roach ); 159*cb7a42eaSGreg Roach 160*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 161*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /Whiteski/'); 162*cb7a42eaSGreg Roach 163*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 164*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 165*cb7a42eaSGreg Roach 166*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 167*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 168*cb7a42eaSGreg Roach 169*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 170*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 171*cb7a42eaSGreg Roach 1725e933c21SGreg Roach self::assertSame( 173*cb7a42eaSGreg Roach ["1 NAME /Whiteska/\n2 TYPE birth\n2 SURN Whiteski"], 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 /Whiteżki/'); 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 183*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 184*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 185*cb7a42eaSGreg Roach 186*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 187*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 188*cb7a42eaSGreg Roach 1895e933c21SGreg Roach self::assertSame( 190*cb7a42eaSGreg Roach ["1 NAME /Whiteżka/\n2 TYPE birth\n2 SURN Whiteżki"], 191*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'F') 192323788f4SGreg Roach ); 193323788f4SGreg Roach } 194323788f4SGreg Roach 195323788f4SGreg Roach /** 196323788f4SGreg Roach * Test new child names 19717d74f3aSGreg Roach * 19815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 19915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 20052348eb8SGreg Roach * 20152348eb8SGreg Roach * @return void 202323788f4SGreg Roach */ 2039b802b22SGreg Roach public function testNewChildNames(): void 204c1010edaSGreg Roach { 205*cb7a42eaSGreg Roach $father_fact = $this->createStub(Fact::class); 206*cb7a42eaSGreg Roach $father_fact->expects(self::any())->method('value')->willReturn('John /White/'); 207*cb7a42eaSGreg Roach 208*cb7a42eaSGreg Roach $father = $this->createStub(Individual::class); 209*cb7a42eaSGreg Roach $father->expects(self::any())->method('facts')->willReturn(new Collection([$father_fact])); 210*cb7a42eaSGreg Roach 211*cb7a42eaSGreg Roach $mother_fact = $this->createStub(Fact::class); 212*cb7a42eaSGreg Roach $mother_fact->expects(self::any())->method('value')->willReturn('Mary /Black/'); 213*cb7a42eaSGreg Roach 214*cb7a42eaSGreg Roach $mother = $this->createStub(Individual::class); 215*cb7a42eaSGreg Roach $mother->expects(self::any())->method('facts')->willReturn(new Collection([$mother_fact])); 216*cb7a42eaSGreg Roach 2175e933c21SGreg Roach self::assertSame( 218*cb7a42eaSGreg Roach ["1 NAME /White/\n2 TYPE birth\n2 SURN White"], 219*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames($father, $mother, 'U') 220323788f4SGreg Roach ); 221323788f4SGreg Roach } 222323788f4SGreg Roach 223323788f4SGreg Roach /** 2241677a03aSGreg Roach * Test new child names 22517d74f3aSGreg Roach * 22615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 22715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 22852348eb8SGreg Roach * 22952348eb8SGreg Roach * @return void 2301677a03aSGreg Roach */ 2319b802b22SGreg Roach public function testNewChildNamesWithNoParentsNames(): void 232c1010edaSGreg Roach { 2335e933c21SGreg Roach self::assertSame( 234*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 235*cb7a42eaSGreg Roach $this->surname_tradition->newChildNames(null, null, 'U') 2361677a03aSGreg Roach ); 2371677a03aSGreg Roach } 2381677a03aSGreg Roach 2391677a03aSGreg Roach /** 240323788f4SGreg Roach * Test new father names 24117d74f3aSGreg Roach * 24215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 24315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 24452348eb8SGreg Roach * 24552348eb8SGreg Roach * @return void 246323788f4SGreg Roach */ 2479b802b22SGreg Roach public function testNewFatherNames(): void 248c1010edaSGreg Roach { 249*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 250*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Chris /White/'); 251*cb7a42eaSGreg Roach 252*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 253*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 254*cb7a42eaSGreg Roach 2555e933c21SGreg Roach self::assertSame( 256*cb7a42eaSGreg Roach ["1 NAME /White/\n2 TYPE birth\n2 SURN White"], 257*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 258323788f4SGreg Roach ); 259323788f4SGreg Roach } 260323788f4SGreg Roach 261323788f4SGreg Roach /** 262323788f4SGreg Roach * Test new father names 26317d74f3aSGreg Roach * 26415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 26515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 26652348eb8SGreg Roach * 26752348eb8SGreg Roach * @return void 268323788f4SGreg Roach */ 2699b802b22SGreg Roach public function testNewFatherNamesInflected(): void 270c1010edaSGreg Roach { 271*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 272*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Chris /Whitecka/'); 273*cb7a42eaSGreg Roach 274*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 275*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 276*cb7a42eaSGreg Roach 2775e933c21SGreg Roach self::assertSame( 278*cb7a42eaSGreg Roach ["1 NAME /Whitecki/\n2 TYPE birth\n2 SURN Whitecki"], 279*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 280323788f4SGreg Roach ); 281*cb7a42eaSGreg Roach 282*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 283*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Chris /Whitedzka/'); 284*cb7a42eaSGreg Roach 285*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 286*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 287*cb7a42eaSGreg Roach 2885e933c21SGreg Roach self::assertSame( 289*cb7a42eaSGreg Roach ["1 NAME /Whitedzki/\n2 TYPE birth\n2 SURN Whitedzki"], 290*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 291323788f4SGreg Roach ); 292*cb7a42eaSGreg Roach 293*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 294*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Chris /Whiteska/'); 295*cb7a42eaSGreg Roach 296*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 297*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 298*cb7a42eaSGreg Roach 2995e933c21SGreg Roach self::assertSame( 300*cb7a42eaSGreg Roach ["1 NAME /Whiteski/\n2 TYPE birth\n2 SURN Whiteski"], 301*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 302323788f4SGreg Roach ); 303*cb7a42eaSGreg Roach 304*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 305*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Chris /Whiteżka/'); 306*cb7a42eaSGreg Roach 307*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 308*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 309*cb7a42eaSGreg Roach 3105e933c21SGreg Roach self::assertSame( 311*cb7a42eaSGreg Roach ["1 NAME /Whiteżki/\n2 TYPE birth\n2 SURN Whiteżki"], 312*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'M') 313323788f4SGreg Roach ); 314323788f4SGreg Roach } 315323788f4SGreg Roach 316323788f4SGreg Roach /** 317323788f4SGreg Roach * Test new mother names 31817d74f3aSGreg Roach * 31915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 32015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 32152348eb8SGreg Roach * 32252348eb8SGreg Roach * @return void 323323788f4SGreg Roach */ 3249b802b22SGreg Roach public function testNewMotherNames(): void 325c1010edaSGreg Roach { 326*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 327*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Chris /White/'); 328*cb7a42eaSGreg Roach 329*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 330*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 331*cb7a42eaSGreg Roach 3325e933c21SGreg Roach self::assertSame( 333*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 334*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'F') 335323788f4SGreg Roach ); 336323788f4SGreg Roach } 337323788f4SGreg Roach 338323788f4SGreg Roach /** 339323788f4SGreg Roach * Test new parent names 34017d74f3aSGreg Roach * 34115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 34215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 34352348eb8SGreg Roach * 34452348eb8SGreg Roach * @return void 345323788f4SGreg Roach */ 3469b802b22SGreg Roach public function testNewParentNames(): void 347c1010edaSGreg Roach { 348*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 349*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Chris /White/'); 350323788f4SGreg Roach 351*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 352*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 353323788f4SGreg Roach 3545e933c21SGreg Roach self::assertSame( 355*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 356*cb7a42eaSGreg Roach $this->surname_tradition->newParentNames($individual, 'U') 357323788f4SGreg Roach ); 358323788f4SGreg Roach } 359323788f4SGreg Roach 360323788f4SGreg Roach /** 361323788f4SGreg Roach * Test new spouse names 36217d74f3aSGreg Roach * 36315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition 36415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition 36552348eb8SGreg Roach * 36652348eb8SGreg Roach * @return void 367323788f4SGreg Roach */ 3689b802b22SGreg Roach public function testNewSpouseNames(): void 369c1010edaSGreg Roach { 370*cb7a42eaSGreg Roach $fact = $this->createStub(Fact::class); 371*cb7a42eaSGreg Roach $fact->expects(self::any())->method('value')->willReturn('Chris /White/'); 372*cb7a42eaSGreg Roach 373*cb7a42eaSGreg Roach $individual = $this->createStub(Individual::class); 374*cb7a42eaSGreg Roach $individual->expects(self::any())->method('facts')->willReturn(new Collection([$fact])); 375*cb7a42eaSGreg Roach 3765e933c21SGreg Roach self::assertSame( 377*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 378*cb7a42eaSGreg Roach $this->surname_tradition->newSpouseNames($individual, 'M') 379323788f4SGreg Roach ); 380*cb7a42eaSGreg Roach 381*cb7a42eaSGreg Roach self::assertSame( 382*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth", "1 NAME /White/\n2 TYPE married\n2 SURN White"], 383*cb7a42eaSGreg Roach $this->surname_tradition->newSpouseNames($individual, 'F') 384*cb7a42eaSGreg Roach ); 385*cb7a42eaSGreg Roach 386*cb7a42eaSGreg Roach self::assertSame( 387*cb7a42eaSGreg Roach ["1 NAME //\n2 TYPE birth"], 388*cb7a42eaSGreg Roach $this->surname_tradition->newSpouseNames($individual, 'U') 389*cb7a42eaSGreg Roach ); 390*cb7a42eaSGreg Roach } 391*cb7a42eaSGreg Roach 392*cb7a42eaSGreg Roach /** 393*cb7a42eaSGreg Roach * Prepare the environment for these tests 394*cb7a42eaSGreg Roach * 395*cb7a42eaSGreg Roach * @return void 396*cb7a42eaSGreg Roach */ 397*cb7a42eaSGreg Roach protected function setUp(): void 398*cb7a42eaSGreg Roach { 399*cb7a42eaSGreg Roach parent::setUp(); 400*cb7a42eaSGreg Roach 401*cb7a42eaSGreg Roach $this->surname_tradition = new PolishSurnameTradition(); 402323788f4SGreg Roach } 403323788f4SGreg Roach} 404