16fcafd02SGreg Roach<?php 26fcafd02SGreg Roach 36fcafd02SGreg Roach/** 46fcafd02SGreg Roach * webtrees: online genealogy 56fcafd02SGreg Roach * Copyright (C) 2021 webtrees development team 66fcafd02SGreg Roach * This program is free software: you can redistribute it and/or modify 76fcafd02SGreg Roach * it under the terms of the GNU General Public License as published by 86fcafd02SGreg Roach * the Free Software Foundation, either version 3 of the License, or 96fcafd02SGreg Roach * (at your option) any later version. 106fcafd02SGreg Roach * This program is distributed in the hope that it will be useful, 116fcafd02SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 126fcafd02SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 136fcafd02SGreg Roach * GNU General Public License for more details. 146fcafd02SGreg Roach * You should have received a copy of the GNU General Public License 156fcafd02SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 166fcafd02SGreg Roach */ 176fcafd02SGreg Roach 186fcafd02SGreg Roachdeclare(strict_types=1); 196fcafd02SGreg Roach 206fcafd02SGreg Roachnamespace Fisharebest\Webtrees; 216fcafd02SGreg Roach 226fcafd02SGreg Roachuse Fisharebest\Webtrees\Factories\FamilyFactory; 236fcafd02SGreg Roachuse Fisharebest\Webtrees\Factories\IndividualFactory; 24a004d330SGreg Roachuse Fisharebest\Webtrees\Module\LanguageEnglishAustralia; 25d8a5ab6eSJonathan Jaubartuse Fisharebest\Webtrees\Module\LanguageEnglishGreatBritain; 26a004d330SGreg Roachuse Fisharebest\Webtrees\Module\LanguageEnglishUnitedStates; 27d8a5ab6eSJonathan Jaubartuse Fisharebest\Webtrees\Module\LanguageFrench; 282c927a63SGreg Roachuse Fisharebest\Webtrees\Module\LanguageSlovakian; 29a004d330SGreg Roachuse Fisharebest\Webtrees\Module\ModuleLanguageInterface; 306fcafd02SGreg Roachuse Fisharebest\Webtrees\Services\RelationshipService; 316fcafd02SGreg Roach 32a004d330SGreg Roachuse function array_reverse; 33a004d330SGreg Roach 346fcafd02SGreg Roach/** 356fcafd02SGreg Roach * Test the user functions 366fcafd02SGreg Roach * 376fcafd02SGreg Roach * @covers \Fisharebest\Webtrees\Relationship 386fcafd02SGreg Roach * @covers \Fisharebest\Webtrees\Services\RelationshipService 396fcafd02SGreg Roach * @covers \Fisharebest\Webtrees\Module\LanguageEnglishGreatBritain 40d8a5ab6eSJonathan Jaubart * @covers \Fisharebest\Webtrees\Module\LanguageEnglishUnitedStates 41d8a5ab6eSJonathan Jaubart * @covers \Fisharebest\Webtrees\Module\LanguageFrench 42b72623feSGreg Roach * @covers \Fisharebest\Webtrees\Module\ModuleLanguageTrait 436fcafd02SGreg Roach */ 446fcafd02SGreg Roachclass RelationshipNamesTest extends TestCase 456fcafd02SGreg Roach{ 466fcafd02SGreg Roach /** 476fcafd02SGreg Roach * @return void 486fcafd02SGreg Roach */ 496fcafd02SGreg Roach public function testRelationshipNames(): void 506fcafd02SGreg Roach { 516fcafd02SGreg Roach // i22m===f10===i23f 526fcafd02SGreg Roach // | 536fcafd02SGreg Roach // +-----+-----+ 546fcafd02SGreg Roach // | | 55d8a5ab6eSJonathan Jaubart // i20m===f9===i21f i24m===f11m===i25f 56d8a5ab6eSJonathan Jaubart // | | 57d8a5ab6eSJonathan Jaubart // i19f===f8===i18m i26f===f12===i27m 586fcafd02SGreg Roach // | | 59c2a86322SGreg Roach // +---+---+-----+ +---+---+ 60c2a86322SGreg Roach // | | | | | 61c2a86322SGreg Roach // i16m===f7===i17f i30m i37f i28u i29m===f15 62d8a5ab6eSJonathan Jaubart // | | 63c2a86322SGreg Roach // +-----------------+ | 64c2a86322SGreg Roach // | | | 65c2a86322SGreg Roach // i38f i12f===f4m===i11m i13m===f5m===i14f i34f===f16 66d8a5ab6eSJonathan Jaubart // | | | 6741e0cd5cSGreg Roach // i1m===f1m==========i2f===f2d===i6m=====f13m===i31m===f14d===i32f i35m===f17 6841e0cd5cSGreg Roach // | | | | 693d9e70a5SJonathan Jaubart // +---+---+ +---+---+ +-----+ | 703d9e70a5SJonathan Jaubart // | | | | | | | | | 713d9e70a5SJonathan Jaubart // i10f===f3e===i3m i4f i5u i7ma i8f i9u===f6===i15u i33f i39mo i36f 726fcafd02SGreg Roach // 733d9e70a5SJonathan Jaubart // Individual suffixes - m(ale), f(emale), u(nknown), a(dopted), o(foster) 746fcafd02SGreg Roach // Family suffixes - m(arried), d(ivorced), e(ngaged) 756fcafd02SGreg Roach // 766fcafd02SGreg Roach $tree = $this->createMock(Tree::class); 776fcafd02SGreg Roach 786fcafd02SGreg Roach $individual_factory = $this->createStub(IndividualFactory::class); 796fcafd02SGreg Roach $family_factory = $this->createStub(FamilyFactory::class); 806fcafd02SGreg Roach 816fcafd02SGreg Roach Registry::familyFactory($family_factory); 826fcafd02SGreg Roach Registry::individualFactory($individual_factory); 836fcafd02SGreg Roach 846fcafd02SGreg Roach $i1m = new Individual('i1m', "0 @i1m@ INDI\n1 SEX M\n1 FAMS @f1m@\n1 FAMC @f4m@", null, $tree); 856fcafd02SGreg Roach $i2f = new Individual('i2f', "0 @i2f@ INDI\n1 SEX F\n1 FAMS @f1m@\n1 FAMS @f2d@\n2 FAMC @f5m@", null, $tree); 866fcafd02SGreg Roach $i3m = new Individual('i3m', "0 @i3m@ INDI\n1 SEX M\n1 FAMC @f1m@\n1 FAMS @f3e@\n1 BIRT\n2 DATE 2000", null, $tree); 876fcafd02SGreg Roach $i4f = new Individual('i4f', "0 @i4f@ INDI\n1 SEX F\n1 FAMC @f1m@\n1 BIRT\n2 DATE 2001", null, $tree); 886fcafd02SGreg Roach $i5u = new Individual('i5u', "0 @i5u@ INDI\n1 SEX U\n1 FAMC @f1m@\n1 BIRT\n2 DATE 2002", null, $tree); 896fcafd02SGreg Roach $i6m = new Individual('i6m', "0 @i6m@ INDI\n1 SEX M\n1 FAMS @f2d@", null, $tree); 906fcafd02SGreg Roach $i7ma = new Individual('i7ma', "0 @i7ma@ INDI\n1 SEX M\n1 FAMC @f2d@\n2 PEDI adopted", null, $tree); 916fcafd02SGreg Roach $i8f = new Individual('i8f', "0 @i8f@ INDI\n1 SEX F\n1 FAMC @f2d@", null, $tree); 926fcafd02SGreg Roach $i9u = new Individual('i9u', "0 @i9u@ INDI\n1 SEX U\n1 FAMC @f2d@\n1 FAMS @f6@", null, $tree); 936fcafd02SGreg Roach $i10f = new Individual('i10f', "0 @i10f@ INDI\n1 SEX F\n1 FAMS @f3e@", null, $tree); 946fcafd02SGreg Roach $i11m = new Individual('i11m', "0 @i11f@ INDI\n1 SEX M\n1 FAMS @f4m@\n1 FAMC @f7@", null, $tree); 956fcafd02SGreg Roach $i12f = new Individual('i12f', "0 @i12f@ INDI\n1 SEX F\n1 FAMS @f4m@", null, $tree); 966fcafd02SGreg Roach $i13m = new Individual('i13m', "0 @i13f@ INDI\n1 SEX M\n1 FAMS @f5m@", null, $tree); 976fcafd02SGreg Roach $i14f = new Individual('i14f', "0 @i14f@ INDI\n1 SEX F\n1 FAMS @f5m@", null, $tree); 986fcafd02SGreg Roach $i15u = new Individual('i15u', "0 @i15u@ INDI\n1 SEX U\n1 FAMS @f6@", null, $tree); 996fcafd02SGreg Roach $i16m = new Individual('i16m', "0 @i16m@ INDI\n1 SEX M\n1 FAMS @f7@", null, $tree); 1006fcafd02SGreg Roach $i17f = new Individual('i17f', "0 @i17f@ INDI\n1 SEX F\n1 FAMS @f7@\n1 FAMC @f8@", null, $tree); 1016fcafd02SGreg Roach $i18m = new Individual('i18m', "0 @i18m@ INDI\n1 SEX M\n1 FAMS @f8@\n1 FAMC @f9@", null, $tree); 1026fcafd02SGreg Roach $i19f = new Individual('i19f', "0 @i19f@ INDI\n1 SEX F\n1 FAMS @f8@", null, $tree); 1036fcafd02SGreg Roach $i20m = new Individual('i20m', "0 @i20m@ INDI\n1 SEX M\n1 FAMS @f9@", null, $tree); 1046fcafd02SGreg Roach $i21f = new Individual('i21f', "0 @i21f@ INDI\n1 SEX F\n1 FAMS @f9@\n1 FAMC @f10@", null, $tree); 1056fcafd02SGreg Roach $i22m = new Individual('i22m', "0 @i22m@ INDI\n1 SEX M\n1 FAMS @f10@", null, $tree); 1066fcafd02SGreg Roach $i23f = new Individual('i23f', "0 @i23f@ INDI\n1 SEX F\n1 FAMS @f10@", null, $tree); 107d8a5ab6eSJonathan Jaubart $i24m = new Individual('i24m', "0 @i24m@ INDI\n1 SEX M\n1 FAMS @f11@\n1 FAMC @f10@", null, $tree); 108d8a5ab6eSJonathan Jaubart $i25f = new Individual('i25f', "0 @i25f@ INDI\n1 SEX F\n1 FAMS @f11@", null, $tree); 109d8a5ab6eSJonathan Jaubart $i26f = new Individual('i26f', "0 @i26f@ INDI\n1 SEX F\n1 FAMS @f12@\n1 FAMC @f11@", null, $tree); 110d8a5ab6eSJonathan Jaubart $i27m = new Individual('i27m', "0 @i27m@ INDI\n1 SEX M\n1 FAMS @f12@", null, $tree); 111d8a5ab6eSJonathan Jaubart $i28u = new Individual('i28u', "0 @i28u@ INDI\n1 SEX U\n1 FAMC @f12@", null, $tree); 112d8a5ab6eSJonathan Jaubart $i29m = new Individual('i29m', "0 @i29m@ INDI\n1 SEX M\n1 FAMC @f12@", null, $tree); 113d8a5ab6eSJonathan Jaubart $i30m = new Individual('i30m', "0 @i30m@ INDI\n1 SEX M\n1 FAMC @f8@", null, $tree); 114d8a5ab6eSJonathan Jaubart $i31m = new Individual('i31m', "0 @i31m@ INDI\n1 SEX M\n1 FAMS @f13m@\n1 FAMS @f14d@", null, $tree); 115d8a5ab6eSJonathan Jaubart $i32f = new Individual('i32f', "0 @i32f@ INDI\n1 SEX F\n1 FAMS @f14d@", null, $tree); 116d8a5ab6eSJonathan Jaubart $i33f = new Individual('i33f', "0 @i33f@ INDI\n1 SEX F\n1 FAMC @f14d@", null, $tree); 117d8a5ab6eSJonathan Jaubart $i34f = new Individual('i34f', "0 @i34f@ INDI\n1 SEX F\n1 FAMC @f15@", null, $tree); 11841e0cd5cSGreg Roach $i35m = new Individual('i35m', "0 @i35m@ INDI\n1 SEX M\n1 FAMS @f17@\n1 FAMC @f16@", null, $tree); 119c2a86322SGreg Roach $i36f = new Individual('i36f', "0 @i36f@ INDI\n1 SEX F\n1 FAMC @f17@", null, $tree); 120c2a86322SGreg Roach $i37f = new Individual('i37f', "0 @i37f@ INDI\n1 SEX F\n1 FAMC @f8@", null, $tree); 121c2a86322SGreg Roach $i38f = new Individual('i38f', "0 @i38f@ INDI\n1 SEX F\n1 FAMC @f7@", null, $tree); 1223d9e70a5SJonathan Jaubart $i39mo = new Individual('i39mo', "0 @i39o@ INDI\n1 SEX M\n1 FAMC @f14d@\n2 PEDI foster", null, $tree); 1236fcafd02SGreg Roach 1246fcafd02SGreg Roach $individual_factory->method('make')->will($this->returnValueMap([ 1256fcafd02SGreg Roach 'i1m' => $i1m, 1266fcafd02SGreg Roach 'i2f' => $i2f, 1276fcafd02SGreg Roach 'i3m' => $i3m, 1286fcafd02SGreg Roach 'i4f' => $i4f, 1296fcafd02SGreg Roach 'i5u' => $i5u, 1306fcafd02SGreg Roach 'i6m' => $i6m, 1316fcafd02SGreg Roach 'i7ma' => $i7ma, 1326fcafd02SGreg Roach 'i8f' => $i8f, 1336fcafd02SGreg Roach 'i9u' => $i9u, 1346fcafd02SGreg Roach 'i10f' => $i10f, 1356fcafd02SGreg Roach 'i11m' => $i11m, 1366fcafd02SGreg Roach 'i12f' => $i12f, 1376fcafd02SGreg Roach 'i13m' => $i13m, 1386fcafd02SGreg Roach 'i14f' => $i14f, 1396fcafd02SGreg Roach 'i15u' => $i15u, 1406fcafd02SGreg Roach 'i16m' => $i16m, 1416fcafd02SGreg Roach 'i17f' => $i17f, 1426fcafd02SGreg Roach 'i18m' => $i18m, 1436fcafd02SGreg Roach 'i19f' => $i19f, 1446fcafd02SGreg Roach 'i20m' => $i20m, 1456fcafd02SGreg Roach 'i21f' => $i21f, 146d8a5ab6eSJonathan Jaubart 'i22m' => $i22m, 147d8a5ab6eSJonathan Jaubart 'i23f' => $i23f, 148d8a5ab6eSJonathan Jaubart 'i24m' => $i24m, 149d8a5ab6eSJonathan Jaubart 'i25f' => $i25f, 150d8a5ab6eSJonathan Jaubart 'i26f' => $i26f, 151d8a5ab6eSJonathan Jaubart 'i27m' => $i27m, 152d8a5ab6eSJonathan Jaubart 'i28u' => $i28u, 153d8a5ab6eSJonathan Jaubart 'i29m' => $i29m, 154d8a5ab6eSJonathan Jaubart 'i30m' => $i30m, 155d8a5ab6eSJonathan Jaubart 'i31m' => $i31m, 156d8a5ab6eSJonathan Jaubart 'i32f' => $i32f, 157d8a5ab6eSJonathan Jaubart 'i33f' => $i33f, 158a004d330SGreg Roach 'i34f' => $i34f, 15941e0cd5cSGreg Roach 'i35m' => $i35m, 16041e0cd5cSGreg Roach 'i36f' => $i36f, 161c2a86322SGreg Roach 'i37f' => $i37f, 162c2a86322SGreg Roach 'i38f' => $i38f, 1633d9e70a5SJonathan Jaubart 'i39mo' => $i39mo 1646fcafd02SGreg Roach ])); 1656fcafd02SGreg Roach 1666fcafd02SGreg Roach $f1m = new Family('f1m', "0 @f1m@ FAM\n1 MARR Y\n1 HUSB @i1m@\n1 WIFE @i2f@\n1 CHIL @i3m@\n1 CHIL @i4f@\n1 CHIL @i5u@", null, $tree); 1676fcafd02SGreg Roach $f2d = new Family('f2d', "0 @f2d@ FAM\n1 DIV Y\n1 HUSB @i6m@\n1 WIFE @i2f@\n1 CHIL @i7ma@\n1 CHIL @i8f@\n1 CHIL @i9u@", null, $tree); 1686fcafd02SGreg Roach $f3e = new Family('f3e', "0 @f3e@ FAM\n1 ENGA Y\n1 HUSB @i3m@\n1 WIFE @i10f@", null, $tree); 1696fcafd02SGreg Roach $f4m = new Family('f4m', "0 @f4m@ FAM\n1 MARR Y\n1 HUSB @i11m@\n1 WIFE @i12f@\n1 CHIL @i1m@", null, $tree); 1706fcafd02SGreg Roach $f5m = new Family('f5m', "0 @f5m@ FAM\n1 MARR Y\n1 HUSB @i13m@\n1 WIFE @i14f@\n1 CHIL @i2f@", null, $tree); 1716fcafd02SGreg Roach $f6 = new Family('f6', "0 @f6@ FAM\n1 HUSB @i9u@\n1 WIFE @i15u@", null, $tree); 172c2a86322SGreg Roach $f7 = new Family('f7', "0 @f7@ FAM\n1 HUSB @i16m@\n1 WIFE @i17f@\n1 CHIL @i11m@\n1 CHIL @i38f@", null, $tree); 173c2a86322SGreg Roach $f8 = new Family('f8', "0 @f8@ FAM\n1 HUSB @i18m@\n1 WIFE @i19f@\n1 CHIL @i17f@\n1 CHIL @i30m@\n1 CHIL @i37f@", null, $tree); 1746fcafd02SGreg Roach $f9 = new Family('f9', "0 @f9@ FAM\n1 HUSB @i20m@\n1 WIFE @i21f@\n1 CHIL @i18m@", null, $tree); 175d8a5ab6eSJonathan Jaubart $f10 = new Family('f10', "0 @f10@ FAM\n1 HUSB @i22m@\n1 WIFE @i23f@\n1 CHIL @i21f@\n1 CHIL @i24m@", null, $tree); 176d8a5ab6eSJonathan Jaubart $f11m = new Family('f11m', "0 @f11m@ FAM\n1 MARR Y\n1 HUSB @i24m@\n1 WIFE @i25f@\n1 CHIL @i26f@", null, $tree); 177d8a5ab6eSJonathan Jaubart $f12 = new Family('f12', "0 @f12@ FAM\n1 HUSB @i27m@\n1 WIFE @i26f@\n1 CHIL @i28u@\n1 CHIL @i29m@", null, $tree); 178d8a5ab6eSJonathan Jaubart $f13m = new Family('f13m', "0 @f13m@ FAM\n1 MARR Y\n1 HUSB @i6m@\n1 WIFE @i31m@", null, $tree); 1793d9e70a5SJonathan Jaubart $f14d = new Family('f14d', "0 @f14d@ FAM\n1 DIV Y\n1 HUSB @i31m@\n1 WIFE @i32f@\n1 CHIL @i33f@\n1 CHIL @i39mo@", null, $tree); 1803d9e70a5SJonathan Jaubart $f15 = new Family('f15', "0 @f15@ FAM\n1 HUSB @i29m@\n1 CHIL @i34f@", null, $tree); 1813d9e70a5SJonathan Jaubart $f16 = new Family('f16', "0 @f16@ FAM\n1 WIFE @i34f@\n1 CHIL @i35m@", null, $tree); 1823d9e70a5SJonathan Jaubart $f17 = new Family('f17', "0 @f17@ FAM\n1 HUSB @i35m@\n1 CHIL @i36f@", null, $tree); 1836fcafd02SGreg Roach 1846fcafd02SGreg Roach $family_factory->method('make')->will($this->returnValueMap([ 1856fcafd02SGreg Roach 'f1m' => $f1m, 1866fcafd02SGreg Roach 'f2d' => $f2d, 1876fcafd02SGreg Roach 'f3e' => $f3e, 1886fcafd02SGreg Roach 'f4m' => $f4m, 1896fcafd02SGreg Roach 'f5m' => $f5m, 1906fcafd02SGreg Roach 'f6' => $f6, 1916fcafd02SGreg Roach 'f7' => $f7, 1926fcafd02SGreg Roach 'f8' => $f8, 1936fcafd02SGreg Roach 'f9' => $f9, 1946fcafd02SGreg Roach 'f10' => $f10, 195d8a5ab6eSJonathan Jaubart 'f11m' => $f11m, 196d8a5ab6eSJonathan Jaubart 'f12' => $f12, 197d8a5ab6eSJonathan Jaubart 'f13m' => $f13m, 198d8a5ab6eSJonathan Jaubart 'f14d' => $f14d, 199a004d330SGreg Roach 'f15' => $f15, 20041e0cd5cSGreg Roach 'f16' => $f16, 2013d9e70a5SJonathan Jaubart 'f17' => $f17 2026fcafd02SGreg Roach ])); 2036fcafd02SGreg Roach 204a004d330SGreg Roach /////////////////////////////////////////////////////////////////////// 2056fcafd02SGreg Roach // ENGLISH 206a004d330SGreg Roach /////////////////////////////////////////////////////////////////////// 207a004d330SGreg Roach 208a004d330SGreg Roach $en_au = new LanguageEnglishAustralia(); 209d8a5ab6eSJonathan Jaubart $en_gb = new LanguageEnglishGreatBritain(); 210a004d330SGreg Roach $en_us = new LanguageEnglishUnitedStates(); 2116fcafd02SGreg Roach 212a004d330SGreg Roach foreach ([$en_us, $en_gb, $en_au] as $en) { 213a004d330SGreg Roach self::assertRelationships('wife', 'husband', [$i1m, $f1m, $i2f], $en); 214a004d330SGreg Roach self::assertRelationships('partner', 'partner', [$i9u, $f6, $i15u], $en); 215a004d330SGreg Roach self::assertRelationships('ex-husband', 'ex-wife', [$i2f, $f2d, $i6m], $en); 216a004d330SGreg Roach self::assertRelationships('fiancé', 'fiancée', [$i10f, $f3e, $i3m], $en); 217a004d330SGreg Roach self::assertRelationships('son', 'father', [$i1m, $f1m, $i3m], $en); 218a004d330SGreg Roach self::assertRelationships('daughter', 'mother', [$i2f, $f1m, $i4f], $en); 219a004d330SGreg Roach self::assertRelationships('child', 'father', [$i1m, $f1m, $i5u], $en); 220a004d330SGreg Roach self::assertRelationships('elder brother', 'younger sister', [$i4f, $f1m, $i3m], $en); 221a004d330SGreg Roach self::assertRelationships('younger sibling', 'elder brother', [$i3m, $f1m, $i5u], $en); 222a004d330SGreg Roach self::assertRelationships('brother', 'sister', [$i8f, $f2d, $i7ma], $en); 223a004d330SGreg Roach self::assertRelationships('sibling', 'brother', [$i7ma, $f2d, $i9u], $en); 224a004d330SGreg Roach self::assertRelationships('adoptive-mother', 'adopted-son', [$i7ma, $f2d, $i2f], $en); 225a004d330SGreg Roach self::assertRelationships('stepfather', 'stepchild', [$i9u, $f2d, $i2f, $f1m, $i1m], $en); 226a004d330SGreg Roach self::assertRelationships('stepdaughter', 'stepmother', [$i2f, $f1m, $i2f, $f2d, $i8f], $en); 227a004d330SGreg Roach self::assertRelationships('stepsister', 'stepsibling', [$i9u, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $en); 228a004d330SGreg Roach self::assertRelationships('half-brother', 'half-sister', [$i8f, $f2d, $i2f, $f1m, $i3m], $en); 229a004d330SGreg Roach self::assertRelationships('mother-in-law', 'daughter-in-law', [$i2f, $f1m, $i1m, $f4m, $i12f], $en); 230a004d330SGreg Roach self::assertRelationships('paternal-grandfather', 'grandson', [$i3m, $f1m, $i1m, $f4m, $i11m], $en); 231a004d330SGreg Roach self::assertRelationships('paternal-grandmother', 'granddaughter', [$i4f, $f1m, $i1m, $f4m, $i12f], $en); 232a004d330SGreg Roach self::assertRelationships('maternal-grandfather', 'grandson', [$i3m, $f1m, $i2f, $f5m, $i13m], $en); 233a004d330SGreg Roach self::assertRelationships('maternal-grandmother', 'grandchild', [$i5u, $f1m, $i2f, $f5m, $i14f], $en); 234c2a86322SGreg Roach self::assertRelationships('paternal great-grandfather', 'great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $en); 235c2a86322SGreg Roach self::assertRelationships('paternal great-grandmother', 'great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $en); 236c2a86322SGreg Roach self::assertRelationships('paternal great-great-grandfather', 'great-great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $en); 237c2a86322SGreg Roach self::assertRelationships('paternal great-great-grandmother', 'great-great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $en); 238c2a86322SGreg Roach self::assertRelationships('paternal great-great-great-grandfather', 'great-great-great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i20m], $en); 239c2a86322SGreg Roach self::assertRelationships('paternal great-great-great-grandmother', 'great-great-great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f], $en); 240c2a86322SGreg Roach self::assertRelationships('paternal great ×4 grandfather', 'great ×4 grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i22m], $en); 241c2a86322SGreg Roach self::assertRelationships('paternal great ×4 grandmother', 'great ×4 granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i23f], $en); 242c2a86322SGreg Roach self::assertRelationships('aunt', 'niece', [$i38f, $f7, $i17f, $f8, $i37f], $en); 243c2a86322SGreg Roach self::assertRelationships('great-uncle', 'great-nephew', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m], $en); 244c2a86322SGreg Roach self::assertRelationships('great-great-uncle', 'great-great-nephew', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $en); 245c2a86322SGreg Roach self::assertRelationships('nephew', 'uncle', [$i24m, $f10, $i21f, $f9, $i18m], $en); 246c2a86322SGreg Roach self::assertRelationships('great-niece', 'great-uncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f], $en); 247c2a86322SGreg Roach self::assertRelationships('great-great-nephew', 'great-great-uncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m], $en); 24841e0cd5cSGreg Roach self::assertRelationships('first cousin', 'first cousin', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en); 24941e0cd5cSGreg Roach self::assertRelationships('second cousin', 'second cousin', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $en); 25041e0cd5cSGreg Roach self::assertRelationships('first cousin once removed ascending', 'first cousin once removed descending', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en); 25141e0cd5cSGreg Roach self::assertRelationships('third cousin', 'third cousin', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $en); 25241e0cd5cSGreg Roach self::assertRelationships('second cousin once removed ascending', 'second cousin once removed descending', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $en); 25341e0cd5cSGreg Roach self::assertRelationships('first cousin twice removed ascending', 'first cousin twice removed descending', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en); 25441e0cd5cSGreg Roach self::assertRelationships('fourth cousin', 'fourth cousin', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f, $f16, $i35m], $en); 25541e0cd5cSGreg Roach self::assertRelationships('third cousin once removed ascending', 'third cousin once removed descending', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $en); 25641e0cd5cSGreg Roach self::assertRelationships('second cousin twice removed ascending', 'second cousin twice removed descending', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $en); 257a004d330SGreg Roach // Compound relationships 258c2a86322SGreg Roach self::assertRelationships('wife’s ex-husband', 'ex-wife’s husband', [$i1m, $f1m, $i2f, $f2d, $i6m], $en); 259a004d330SGreg Roach } 260a004d330SGreg Roach 261f1de4d34SGreg Roach // This relationship has a different name in different variants of English. 26241e0cd5cSGreg Roach self::assertRelationships('first cousin thrice removed ascending', 'first cousin thrice removed descending', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en_au); 26341e0cd5cSGreg Roach self::assertRelationships('first cousin thrice removed ascending', 'first cousin thrice removed descending', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en_gb); 26441e0cd5cSGreg Roach self::assertRelationships('first cousin three times removed ascending', 'first cousin three times removed descending', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en_us); 26541e0cd5cSGreg Roach 266a004d330SGreg Roach /////////////////////////////////////////////////////////////////////// 267d8a5ab6eSJonathan Jaubart // FRENCH 268a004d330SGreg Roach /////////////////////////////////////////////////////////////////////// 269d8a5ab6eSJonathan Jaubart 270a004d330SGreg Roach $fr_fr = new LanguageFrench(); 271a004d330SGreg Roach $fr_ca = new LanguageFrench(); 272a004d330SGreg Roach 273a004d330SGreg Roach foreach ([$fr_fr, $fr_ca] as $fr) { 274f1de4d34SGreg Roach self::assertRelationships('épouse', 'époux', [$i1m, $f1m, $i2f], $fr); 275f1de4d34SGreg Roach self::assertRelationships('conjoint', 'conjoint', [$i9u, $f6, $i15u], $fr); 276f1de4d34SGreg Roach self::assertRelationships('ex-époux', 'ex-épouse', [$i2f, $f2d, $i6m], $fr); 277f1de4d34SGreg Roach self::assertRelationships('fiancé', 'fiancée', [$i10f, $f3e, $i3m], $fr); 278f1de4d34SGreg Roach self::assertRelationships('fils', 'père', [$i1m, $f1m, $i3m], $fr); 279f1de4d34SGreg Roach self::assertRelationships('fille', 'mère', [$i2f, $f1m, $i4f], $fr); 280f1de4d34SGreg Roach self::assertRelationships('enfant', 'père', [$i1m, $f1m, $i5u], $fr); 281f1de4d34SGreg Roach self::assertRelationships('grand frère', 'petite sœur', [$i4f, $f1m, $i3m], $fr); 282f1de4d34SGreg Roach self::assertRelationships('petit frère/sœur', 'grand frère', [$i3m, $f1m, $i5u], $fr); 2833d9e70a5SJonathan Jaubart self::assertRelationships('frère', 'sœur', [$i38f, $f7, $i11m], $fr); 2843d9e70a5SJonathan Jaubart self::assertRelationships('frère/sœur', 'sœur', [$i8f, $f2d, $i9u], $fr); 2853d9e70a5SJonathan Jaubart self::assertRelationships('mère adoptive', 'fils adoptif', [$i7ma, $f2d, $i2f], $fr); 2863d9e70a5SJonathan Jaubart self::assertRelationships('père adoptif', 'fils adoptif', [$i7ma, $f2d, $i6m], $fr); 2873d9e70a5SJonathan Jaubart self::assertRelationships('sœur adoptive', 'frère adoptif', [$i7ma, $f2d, $i8f], $fr); 2883d9e70a5SJonathan Jaubart self::assertRelationships('mère d’accueil', 'fils accueilli', [$i39mo, $f14d, $i32f], $fr); 2893d9e70a5SJonathan Jaubart self::assertRelationships('père d’accueil', 'fils accueilli', [$i39mo, $f14d, $i31m], $fr); 2903d9e70a5SJonathan Jaubart self::assertRelationships('sœur d’accueil', 'frère accueilli', [$i39mo, $f14d, $i33f], $fr); 2913d9e70a5SJonathan Jaubart self::assertRelationships('beau-père', 'belle-fille', [$i8f, $f2d, $i2f, $f1m, $i1m], $fr); 2923d9e70a5SJonathan Jaubart self::assertRelationships('demi-frère', 'demi-frère/sœur', [$i9u, $f2d, $i2f, $f1m, $i3m], $fr); 293a004d330SGreg Roach self::assertRelationship('quasi-sœur', [$i8f, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $fr); 2943d9e70a5SJonathan Jaubart self::assertRelationships('beau-père', 'gendre', [$i1m, $f1m, $i2f, $f5m, $i13m], $fr); 2953d9e70a5SJonathan Jaubart self::assertRelationships('belle-mère', 'bru', [$i2f, $f1m, $i1m, $f4m, $i12f], $fr); 296f1de4d34SGreg Roach self::assertRelationships('grand-père paternel', 'petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m], $fr); 297f1de4d34SGreg Roach self::assertRelationships('grand-mère paternelle', 'petite-fille', [$i4f, $f1m, $i1m, $f4m, $i12f], $fr); 298f1de4d34SGreg Roach self::assertRelationships('grand-père maternel', 'petit-fils', [$i3m, $f1m, $i2f, $f5m, $i13m], $fr); 299f1de4d34SGreg Roach self::assertRelationships('grand-mère maternelle', 'petite-fille', [$i4f, $f1m, $i2f, $f5m, $i14f], $fr); 300f1de4d34SGreg Roach self::assertRelationships('arrière-grand-père paternel', 'arrière-petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $fr); 301f1de4d34SGreg Roach self::assertRelationships('arrière-grand-mère paternelle', 'arrière-petite-fille', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $fr); 3023d9e70a5SJonathan Jaubart self::assertRelationships('trisaïeul paternel', 'petit-fils au 3<sup>e</sup> degré', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $fr); 3033d9e70a5SJonathan Jaubart self::assertRelationships('trisaïeule paternelle', 'petite-fille au 3<sup>e</sup> degré', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $fr); 3043d9e70a5SJonathan Jaubart self::assertRelationships('grand-père paternel au 4<sup>e</sup> degré', 'petit-fils au 4<sup>e</sup> degré', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i20m], $fr); 3053d9e70a5SJonathan Jaubart self::assertRelationships('grand-mère paternelle au 4<sup>e</sup> degré', 'petite-fille au 4<sup>e</sup> degré', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f], $fr); 306f1de4d34SGreg Roach self::assertRelationships('oncle', 'neveu', [$i18m, $f9, $i21f, $f10, $i24m], $fr); 3073d9e70a5SJonathan Jaubart self::assertRelationships('grand-oncle', 'petite-nièce', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $fr); 308f1de4d34SGreg Roach self::assertRelationships('arrière-grand-oncle', 'arrière-petit-neveu', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $fr); 3093d9e70a5SJonathan Jaubart self::assertRelationships('grand-oncle au 3<sup>e</sup> degré', 'petit-neveu au 3<sup>e</sup> degré', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $fr); 3103d9e70a5SJonathan Jaubart self::assertRelationships('grand-oncle au 4<sup>e</sup> degré', 'petite-nièce au 4<sup>e</sup> degré', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $fr); 311f1de4d34SGreg Roach self::assertRelationships('cousine germaine', 'cousin germain', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $fr); 312f1de4d34SGreg Roach self::assertRelationships('cousin issu de germain', 'cousin issu de germain', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $fr); 313f1de4d34SGreg Roach self::assertRelationships('cousine au 3<sup>e</sup> degré', 'cousin au 3<sup>e</sup> degré', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $fr); 314f1de4d34SGreg Roach self::assertRelationships('grand-cousine', 'petit-cousin', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $fr); 315f1de4d34SGreg Roach self::assertRelationships('petit-cousin', 'grand-cousine', [$i26f, $f11m, $i24m, $f10, $i21f, $f9, $i18m, $f8, $i30m], $fr); 316f1de4d34SGreg Roach self::assertRelationships('cousin du 2<sup>e</sup> au 3<sup>e</sup> degré', 'cousin du 3<sup>e</sup> au 2<sup>e</sup> degré', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $fr); 317f1de4d34SGreg Roach self::assertRelationships('cousine du 3<sup>e</sup> au 2<sup>e</sup> degré', 'cousine du 2<sup>e</sup> au 3<sup>e</sup> degré', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $fr); 318d8a5ab6eSJonathan Jaubart // Compound relationships 319f1de4d34SGreg Roach self::assertRelationships('ex-époux de l’épouse', 'époux de l’ex-épouse', [$i1m, $f1m, $i2f, $f2d, $i6m], $fr); 3203d9e70a5SJonathan Jaubart self::assertRelationship('fiancée du petit-neveu au 4<sup>e</sup> degré', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m, $f4m, $i1m, $f1m, $i3m, $f3e, $i10f], $fr); 3213d9e70a5SJonathan Jaubart self::assertRelationship('épouse de l’arrière-petit-neveu', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m, $f4m, $i12f], $fr); 3223d9e70a5SJonathan Jaubart self::assertRelationship('conjoint de la petite-nièce', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i16m], $fr); 3233d9e70a5SJonathan Jaubart self::assertRelationship('conjointe du neveu', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i19f], $fr); 32496c67f5bSJonathan Jaubart self::assertRelationships('cousine germaine du conjoint', 'conjointe du cousin germain', [$i19f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $fr); 325a004d330SGreg Roach } 326d8a5ab6eSJonathan Jaubart 327a004d330SGreg Roach /////////////////////////////////////////////////////////////////////// 3286fcafd02SGreg Roach // SLOVAK 329a004d330SGreg Roach /////////////////////////////////////////////////////////////////////// 330696d9d5cSGreg Roach 3312c927a63SGreg Roach $sk = new LanguageSlovakian(); 332696d9d5cSGreg Roach 3332c927a63SGreg Roach self::assertRelationships('manželka', 'manžel', [$i1m, $f1m, $i2f], $sk); 3342c927a63SGreg Roach self::assertRelationships('partner', 'partner', [$i9u, $f6, $i15u], $sk); 3352c927a63SGreg Roach self::assertRelationships('exmanžel', 'exmanželka', [$i2f, $f2d, $i6m], $sk); 3362c927a63SGreg Roach self::assertRelationships('snúbenica', 'snúbenec', [$i10f, $f3e, $i3m], $sk); 3372c927a63SGreg Roach self::assertRelationships('syn', 'otec', [$i1m, $f1m, $i3m], $sk); 3382c927a63SGreg Roach self::assertRelationships('dcéra', 'matka', [$i2f, $f1m, $i4f], $sk); 3392c927a63SGreg Roach self::assertRelationships('dieťa', 'otec', [$i1m, $f1m, $i5u], $sk); 3402c927a63SGreg Roach self::assertRelationships('brat', 'sestra', [$i4f, $f1m, $i3m], $sk); 3412c927a63SGreg Roach self::assertRelationships('súrodenec', 'brat', [$i3m, $f1m, $i5u], $sk); 3422c927a63SGreg Roach self::assertRelationships('brat', 'sestra', [$i8f, $f2d, $i7ma], $sk); 3432c927a63SGreg Roach self::assertRelationships('súrodenec', 'brat', [$i7ma, $f2d, $i9u], $sk); 3442c927a63SGreg Roach self::assertRelationships('matka', 'syn', [$i7ma, $f2d, $i2f], $sk); 3452c927a63SGreg Roach self::assertRelationships('manžel matky', 'dieťa manželky', [$i9u, $f2d, $i2f, $f1m, $i1m], $sk); 3462c927a63SGreg Roach self::assertRelationships('dcéra manželky', 'manželka matky', [$i2f, $f1m, $i2f, $f2d, $i8f], $sk); 3472c927a63SGreg Roach self::assertRelationships('dcéra manžela otca', 'dieťa manžela otca', [$i9u, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $sk); 3482c927a63SGreg Roach self::assertRelationships('nevlastný brat', 'nevlastná sestra', [$i8f, $f2d, $i2f, $f1m, $i3m], $sk); 3492c927a63SGreg Roach self::assertRelationships('svokra', 'nevesta', [$i2f, $f1m, $i1m, $f4m, $i12f], $sk); 3502c927a63SGreg Roach self::assertRelationships('starý otec', 'vnuk', [$i3m, $f1m, $i1m, $f4m, $i11m], $sk); 3512c927a63SGreg Roach self::assertRelationships('stará matka', 'vnučka', [$i4f, $f1m, $i1m, $f4m, $i12f], $sk); 3522c927a63SGreg Roach self::assertRelationships('starý otec', 'vnuk', [$i3m, $f1m, $i2f, $f5m, $i13m], $sk); 3532c927a63SGreg Roach self::assertRelationships('stará matka', 'vnúča', [$i5u, $f1m, $i2f, $f5m, $i14f], $sk); 3542c927a63SGreg Roach self::assertRelationships('prastarý otec', 'pravnuk', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $sk); 3552c927a63SGreg Roach self::assertRelationships('prastarý otec', 'pravnučka', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $sk); 3562c927a63SGreg Roach self::assertRelationships('pra-pra-pra-prastarý otec', 'pravnuk dcéry', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $sk); 3572c927a63SGreg Roach self::assertRelationships('pra-pra-pra-prastará matka', 'pravnučka dcéry', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $sk); 3582c927a63SGreg Roach self::assertRelationships('pra ×4 prastarý otec', 'pravnuk vnučky', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i20m], $sk); 3592c927a63SGreg Roach self::assertRelationships('pra ×4 prastará matka', 'pravnučka vnučky', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f], $sk); 3602c927a63SGreg Roach self::assertRelationships('pra ×5 prastarý otec', 'pravnuk pravnučky', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i22m], $sk); 3612c927a63SGreg Roach self::assertRelationships('pra ×5 prastará matka', 'pravnučka pravnučky', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i23f], $sk); 3622c927a63SGreg Roach self::assertRelationships('teta', 'neter', [$i38f, $f7, $i17f, $f8, $i37f], $sk); 3632c927a63SGreg Roach self::assertRelationships('prastrýko', 'prasynovec', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m], $sk); 3642c927a63SGreg Roach self::assertRelationships('pra-prastrýko', 'pravnuk sestry', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $sk); 3652c927a63SGreg Roach self::assertRelationships('synovec', 'ujo', [$i24m, $f10, $i21f, $f9, $i18m], $sk); 3662c927a63SGreg Roach self::assertRelationships('praneter', 'prastrýko', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f], $sk); 3672c927a63SGreg Roach self::assertRelationships('pravnuk sestry', 'pra-prastrýko', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m], $sk); 3682c927a63SGreg Roach self::assertRelationships('sesternica', 'bratranec', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $sk); 3692c927a63SGreg Roach self::assertRelationships('druhostupňový bratranec', 'druhostupňová sesternica', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $sk); 3702c927a63SGreg Roach self::assertRelationships('sesternica otca', 'praneter otca', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $sk); 3712c927a63SGreg Roach self::assertRelationships('sesternica z 3. kolena', 'bratranec z 3. kolena', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $sk); 3722c927a63SGreg Roach self::assertRelationships('druhostupňový bratranec matky', 'syn druhostupňovej sesternice', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $sk); 3732c927a63SGreg Roach self::assertRelationships('pra-dcéra prastrýka', 'pravnuk tety', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $sk); 3742c927a63SGreg Roach self::assertRelationships('bratranec zo 4. kolena', 'bratranec zo 4. kolena', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f, $f16, $i35m], $sk); 3752c927a63SGreg Roach self::assertRelationships('sesternica z 3. kolena otca', 'syn bratranca z 3. kolena', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $sk); 3762c927a63SGreg Roach self::assertRelationships('druhostupňový bratranec starej matky', 'vnuk druhostupňovej sesternice', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $sk); 3772c927a63SGreg Roach self::assertRelationships('pra-pra-dcéra prastrýka', 'pravnuk bratranca', [$i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $sk); // Compound relationships 3782c927a63SGreg Roach self::assertRelationships('exmanžel manželky', 'manžel exmanželky', [$i1m, $f1m, $i2f, $f2d, $i6m], $sk); 379a004d330SGreg Roach } 380a004d330SGreg Roach 381a004d330SGreg Roach /** 382a004d330SGreg Roach * @param string $expected 38309482a55SGreg Roach * @param array<Individual|Family> $nodes 384a004d330SGreg Roach * @param ModuleLanguageInterface $language 385a004d330SGreg Roach */ 386a004d330SGreg Roach private static function assertRelationship(string $expected, array $nodes, ModuleLanguageInterface $language): void 387a004d330SGreg Roach { 388a004d330SGreg Roach $service = new RelationshipService(); 389a004d330SGreg Roach $actual = $service->nameFromPath($nodes, $language); 390*05babb96SGreg Roach $path = implode('-', array_map(static fn (GedcomRecord $record): string => $record->xref(), $nodes)); 391a004d330SGreg Roach $english = $service->nameFromPath($nodes, new LanguageEnglishUnitedStates()); 392a004d330SGreg Roach $message = 'Language: ' . $language->title() . PHP_EOL . 'Path: ' . $path . ' (' . $english . ')'; 393a004d330SGreg Roach 394a004d330SGreg Roach self::assertSame($expected, $actual, $message); 395a004d330SGreg Roach } 396a004d330SGreg Roach 397a004d330SGreg Roach /** 398a004d330SGreg Roach * Test a relationship name in both directions 399a004d330SGreg Roach * 400a004d330SGreg Roach * @param string $fwd 401a004d330SGreg Roach * @param string $rev 40209482a55SGreg Roach * @param array<Individual|Family> $nodes 403a004d330SGreg Roach * @param ModuleLanguageInterface $language 404a004d330SGreg Roach */ 405a004d330SGreg Roach private static function assertRelationships(string $fwd, string $rev, array $nodes, ModuleLanguageInterface $language): void 406a004d330SGreg Roach { 407a004d330SGreg Roach self::assertRelationship($fwd, $nodes, $language); 408a004d330SGreg Roach self::assertRelationship($rev, array_reverse($nodes), $language); 4096fcafd02SGreg Roach } 4106fcafd02SGreg Roach} 411