xref: /webtrees/tests/feature/RelationshipNamesTest.php (revision 202c018b592d5a516e4a465dc6dc515f3be37399)
16fcafd02SGreg Roach<?php
26fcafd02SGreg Roach
36fcafd02SGreg Roach/**
46fcafd02SGreg Roach * webtrees: online genealogy
5d11be702SGreg Roach * Copyright (C) 2023 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;
30*202c018bSGreg Roachuse Fisharebest\Webtrees\Module\ModuleLanguageTrait;
316fcafd02SGreg Roachuse Fisharebest\Webtrees\Services\RelationshipService;
326fcafd02SGreg Roach
33*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass;
34*202c018bSGreg Roach
35a004d330SGreg Roachuse function array_reverse;
36a004d330SGreg Roach
37*202c018bSGreg Roach
38*202c018bSGreg Roach#[CoversClass(Relationship::class)]
39*202c018bSGreg Roach#[CoversClass(RelationshipService::class)]
40*202c018bSGreg Roach#[CoversClass(LanguageEnglishGreatBritain::class)]
41*202c018bSGreg Roach#[CoversClass(LanguageEnglishUnitedStates::class)]
42*202c018bSGreg Roach#[CoversClass(LanguageFrench::class)]
43*202c018bSGreg Roach#[CoversClass(ModuleLanguageTrait::class)]
446fcafd02SGreg Roachclass RelationshipNamesTest extends TestCase
456fcafd02SGreg Roach{
467573bc3dSGreg Roach    protected static bool $uses_database = true;
477573bc3dSGreg Roach
486fcafd02SGreg Roach    public function testRelationshipNames(): void
496fcafd02SGreg Roach    {
506fcafd02SGreg Roach        //                                                   i22m===f10===i23f
516fcafd02SGreg Roach        //                                                           |
526fcafd02SGreg Roach        //                                                     +-----+-----+
536fcafd02SGreg Roach        //                                                     |           |
54d8a5ab6eSJonathan Jaubart        //                                       i20m===f9===i21f         i24m===f11m===i25f
55d8a5ab6eSJonathan Jaubart        //                                           |                            |
56d8a5ab6eSJonathan Jaubart        //                              i19f===f8===i18m                         i26f===f12===i27m
576fcafd02SGreg Roach        //                                      |                                        |
58c2a86322SGreg Roach        //                                  +---+---+-----+                          +---+---+
59c2a86322SGreg Roach        //                                  |       |     |                          |       |
60c2a86322SGreg Roach        //                    i16m===f7===i17f     i30m  i37f                       i28u    i29m===f15
61d8a5ab6eSJonathan Jaubart        //                            |                                                             |
62c2a86322SGreg Roach        //          +-----------------+                                                             |
63c2a86322SGreg Roach        //          |                 |                                                             |
64c2a86322SGreg Roach        //         i38f i12f===f4m===i11m  i13m===f5m===i14f                                       i34f===f16
65d8a5ab6eSJonathan Jaubart        //                      |                  |                                                       |
6641e0cd5cSGreg Roach        //                     i1m===f1m==========i2f===f2d===i6m=====f13m===i31m===f14d===i32f           i35m===f17
6741e0cd5cSGreg Roach        //                            |                  |                           |                            |
683d9e70a5SJonathan Jaubart        //                        +---+---+          +---+---+                 +-----+                            |
693d9e70a5SJonathan Jaubart        //                        |   |   |          |   |   |                 |     |                            |
703d9e70a5SJonathan Jaubart        //          i10f===f3e===i3m i4f i5u       i7ma i8f i9u===f6===i15u   i33f  i39mo                        i36f
716fcafd02SGreg Roach        //
723d9e70a5SJonathan Jaubart        // Individual suffixes - m(ale), f(emale), u(nknown), a(dopted), o(foster)
736fcafd02SGreg Roach        // Family suffixes - m(arried), d(ivorced), e(ngaged)
746fcafd02SGreg Roach        //
756fcafd02SGreg Roach        $tree = $this->createMock(Tree::class);
766fcafd02SGreg Roach
776fcafd02SGreg Roach        $individual_factory = $this->createStub(IndividualFactory::class);
786fcafd02SGreg Roach        $family_factory     = $this->createStub(FamilyFactory::class);
796fcafd02SGreg Roach
806fcafd02SGreg Roach        Registry::familyFactory($family_factory);
816fcafd02SGreg Roach        Registry::individualFactory($individual_factory);
826fcafd02SGreg Roach
836fcafd02SGreg Roach        $i1m  = new Individual('i1m', "0 @i1m@ INDI\n1 SEX M\n1 FAMS @f1m@\n1 FAMC @f4m@", null, $tree);
846fcafd02SGreg Roach        $i2f  = new Individual('i2f', "0 @i2f@ INDI\n1 SEX F\n1 FAMS @f1m@\n1 FAMS @f2d@\n2 FAMC @f5m@", null, $tree);
856fcafd02SGreg Roach        $i3m  = new Individual('i3m', "0 @i3m@ INDI\n1 SEX M\n1 FAMC @f1m@\n1 FAMS @f3e@\n1 BIRT\n2 DATE 2000", null, $tree);
866fcafd02SGreg Roach        $i4f  = new Individual('i4f', "0 @i4f@ INDI\n1 SEX F\n1 FAMC @f1m@\n1 BIRT\n2 DATE 2001", null, $tree);
876fcafd02SGreg Roach        $i5u  = new Individual('i5u', "0 @i5u@ INDI\n1 SEX U\n1 FAMC @f1m@\n1 BIRT\n2 DATE 2002", null, $tree);
886fcafd02SGreg Roach        $i6m  = new Individual('i6m', "0 @i6m@ INDI\n1 SEX M\n1 FAMS @f2d@", null, $tree);
896fcafd02SGreg Roach        $i7ma = new Individual('i7ma', "0 @i7ma@ INDI\n1 SEX M\n1 FAMC @f2d@\n2 PEDI adopted", null, $tree);
906fcafd02SGreg Roach        $i8f  = new Individual('i8f', "0 @i8f@ INDI\n1 SEX F\n1 FAMC @f2d@", null, $tree);
916fcafd02SGreg Roach        $i9u  = new Individual('i9u', "0 @i9u@ INDI\n1 SEX U\n1 FAMC @f2d@\n1 FAMS @f6@", null, $tree);
926fcafd02SGreg Roach        $i10f = new Individual('i10f', "0 @i10f@ INDI\n1 SEX F\n1 FAMS @f3e@", null, $tree);
936fcafd02SGreg Roach        $i11m = new Individual('i11m', "0 @i11f@ INDI\n1 SEX M\n1 FAMS @f4m@\n1 FAMC @f7@", null, $tree);
946fcafd02SGreg Roach        $i12f = new Individual('i12f', "0 @i12f@ INDI\n1 SEX F\n1 FAMS @f4m@", null, $tree);
956fcafd02SGreg Roach        $i13m = new Individual('i13m', "0 @i13f@ INDI\n1 SEX M\n1 FAMS @f5m@", null, $tree);
966fcafd02SGreg Roach        $i14f = new Individual('i14f', "0 @i14f@ INDI\n1 SEX F\n1 FAMS @f5m@", null, $tree);
976fcafd02SGreg Roach        $i15u = new Individual('i15u', "0 @i15u@ INDI\n1 SEX U\n1 FAMS @f6@", null, $tree);
986fcafd02SGreg Roach        $i16m = new Individual('i16m', "0 @i16m@ INDI\n1 SEX M\n1 FAMS @f7@", null, $tree);
996fcafd02SGreg Roach        $i17f = new Individual('i17f', "0 @i17f@ INDI\n1 SEX F\n1 FAMS @f7@\n1 FAMC @f8@", null, $tree);
1006fcafd02SGreg Roach        $i18m = new Individual('i18m', "0 @i18m@ INDI\n1 SEX M\n1 FAMS @f8@\n1 FAMC @f9@", null, $tree);
1016fcafd02SGreg Roach        $i19f = new Individual('i19f', "0 @i19f@ INDI\n1 SEX F\n1 FAMS @f8@", null, $tree);
1026fcafd02SGreg Roach        $i20m = new Individual('i20m', "0 @i20m@ INDI\n1 SEX M\n1 FAMS @f9@", null, $tree);
1036fcafd02SGreg Roach        $i21f = new Individual('i21f', "0 @i21f@ INDI\n1 SEX F\n1 FAMS @f9@\n1 FAMC @f10@", null, $tree);
1046fcafd02SGreg Roach        $i22m = new Individual('i22m', "0 @i22m@ INDI\n1 SEX M\n1 FAMS @f10@", null, $tree);
1056fcafd02SGreg Roach        $i23f = new Individual('i23f', "0 @i23f@ INDI\n1 SEX F\n1 FAMS @f10@", null, $tree);
106d8a5ab6eSJonathan Jaubart        $i24m = new Individual('i24m', "0 @i24m@ INDI\n1 SEX M\n1 FAMS @f11@\n1 FAMC @f10@", null, $tree);
107d8a5ab6eSJonathan Jaubart        $i25f = new Individual('i25f', "0 @i25f@ INDI\n1 SEX F\n1 FAMS @f11@", null, $tree);
108d8a5ab6eSJonathan Jaubart        $i26f = new Individual('i26f', "0 @i26f@ INDI\n1 SEX F\n1 FAMS @f12@\n1 FAMC @f11@", null, $tree);
109d8a5ab6eSJonathan Jaubart        $i27m = new Individual('i27m', "0 @i27m@ INDI\n1 SEX M\n1 FAMS @f12@", null, $tree);
110d8a5ab6eSJonathan Jaubart        $i28u = new Individual('i28u', "0 @i28u@ INDI\n1 SEX U\n1 FAMC @f12@", null, $tree);
111d8a5ab6eSJonathan Jaubart        $i29m = new Individual('i29m', "0 @i29m@ INDI\n1 SEX M\n1 FAMC @f12@", null, $tree);
112d8a5ab6eSJonathan Jaubart        $i30m = new Individual('i30m', "0 @i30m@ INDI\n1 SEX M\n1 FAMC @f8@", null, $tree);
113d8a5ab6eSJonathan Jaubart        $i31m = new Individual('i31m', "0 @i31m@ INDI\n1 SEX M\n1 FAMS @f13m@\n1 FAMS @f14d@", null, $tree);
114d8a5ab6eSJonathan Jaubart        $i32f = new Individual('i32f', "0 @i32f@ INDI\n1 SEX F\n1 FAMS @f14d@", null, $tree);
115d8a5ab6eSJonathan Jaubart        $i33f = new Individual('i33f', "0 @i33f@ INDI\n1 SEX F\n1 FAMC @f14d@", null, $tree);
116d8a5ab6eSJonathan Jaubart        $i34f = new Individual('i34f', "0 @i34f@ INDI\n1 SEX F\n1 FAMC @f15@", null, $tree);
11741e0cd5cSGreg Roach        $i35m = new Individual('i35m', "0 @i35m@ INDI\n1 SEX M\n1 FAMS @f17@\n1 FAMC @f16@", null, $tree);
118c2a86322SGreg Roach        $i36f = new Individual('i36f', "0 @i36f@ INDI\n1 SEX F\n1 FAMC @f17@", null, $tree);
119c2a86322SGreg Roach        $i37f = new Individual('i37f', "0 @i37f@ INDI\n1 SEX F\n1 FAMC @f8@", null, $tree);
120c2a86322SGreg Roach        $i38f = new Individual('i38f', "0 @i38f@ INDI\n1 SEX F\n1 FAMC @f7@", null, $tree);
1213d9e70a5SJonathan Jaubart        $i39mo = new Individual('i39mo', "0 @i39o@ INDI\n1 SEX M\n1 FAMC @f14d@\n2 PEDI foster", null, $tree);
1226fcafd02SGreg Roach
123246e8de0SGreg Roach        $individual_factory->method('make')->willReturnMap([
1246c026d70SGreg Roach            ['i1m', $i1m],
1256c026d70SGreg Roach            ['i2f', $i2f],
1266c026d70SGreg Roach            ['i3m', $i3m],
1276c026d70SGreg Roach            ['i4f', $i4f],
1286c026d70SGreg Roach            ['i5u', $i5u],
1296c026d70SGreg Roach            ['i6m', $i6m],
1306c026d70SGreg Roach            ['i7ma', $i7ma],
1316c026d70SGreg Roach            ['i8f', $i8f],
1326c026d70SGreg Roach            ['i9u', $i9u],
1336c026d70SGreg Roach            ['i10f', $i10f],
1346c026d70SGreg Roach            ['i11m', $i11m],
1356c026d70SGreg Roach            ['i12f', $i12f],
1366c026d70SGreg Roach            ['i13m', $i13m],
1376c026d70SGreg Roach            ['i14f', $i14f],
1386c026d70SGreg Roach            ['i15u', $i15u],
1396c026d70SGreg Roach            ['i16m', $i16m],
1406c026d70SGreg Roach            ['i17f', $i17f],
1416c026d70SGreg Roach            ['i18m', $i18m],
1426c026d70SGreg Roach            ['i19f', $i19f],
1436c026d70SGreg Roach            ['i20m', $i20m],
1446c026d70SGreg Roach            ['i21f', $i21f],
1456c026d70SGreg Roach            ['i22m', $i22m],
1466c026d70SGreg Roach            ['i23f', $i23f],
1476c026d70SGreg Roach            ['i24m', $i24m],
1486c026d70SGreg Roach            ['i25f', $i25f],
1496c026d70SGreg Roach            ['i26f', $i26f],
1506c026d70SGreg Roach            ['i27m', $i27m],
1516c026d70SGreg Roach            ['i28u', $i28u],
1526c026d70SGreg Roach            ['i29m', $i29m],
1536c026d70SGreg Roach            ['i30m', $i30m],
1546c026d70SGreg Roach            ['i31m', $i31m],
1556c026d70SGreg Roach            ['i32f', $i32f],
1566c026d70SGreg Roach            ['i33f', $i33f],
1576c026d70SGreg Roach            ['i34f', $i34f],
1586c026d70SGreg Roach            ['i35m', $i35m],
1596c026d70SGreg Roach            ['i36f', $i36f],
1606c026d70SGreg Roach            ['i37f', $i37f],
1616c026d70SGreg Roach            ['i38f', $i38f],
1626c026d70SGreg Roach            ['i39mo', $i39mo],
163246e8de0SGreg Roach        ]);
1646fcafd02SGreg Roach
1656fcafd02SGreg 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);
1666fcafd02SGreg 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);
1676fcafd02SGreg Roach        $f3e  = new Family('f3e', "0 @f3e@ FAM\n1 ENGA Y\n1 HUSB @i3m@\n1 WIFE @i10f@", null, $tree);
1686fcafd02SGreg Roach        $f4m  = new Family('f4m', "0 @f4m@ FAM\n1 MARR Y\n1 HUSB @i11m@\n1 WIFE @i12f@\n1 CHIL @i1m@", null, $tree);
1696fcafd02SGreg Roach        $f5m  = new Family('f5m', "0 @f5m@ FAM\n1 MARR Y\n1 HUSB @i13m@\n1 WIFE @i14f@\n1 CHIL @i2f@", null, $tree);
1706fcafd02SGreg Roach        $f6   = new Family('f6', "0 @f6@ FAM\n1 HUSB @i9u@\n1 WIFE @i15u@", null, $tree);
171c2a86322SGreg Roach        $f7   = new Family('f7', "0 @f7@ FAM\n1 HUSB @i16m@\n1 WIFE @i17f@\n1 CHIL @i11m@\n1 CHIL @i38f@", null, $tree);
172c2a86322SGreg 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);
1736fcafd02SGreg Roach        $f9   = new Family('f9', "0 @f9@ FAM\n1 HUSB @i20m@\n1 WIFE @i21f@\n1 CHIL @i18m@", null, $tree);
174d8a5ab6eSJonathan Jaubart        $f10  = new Family('f10', "0 @f10@ FAM\n1 HUSB @i22m@\n1 WIFE @i23f@\n1 CHIL @i21f@\n1 CHIL @i24m@", null, $tree);
175d8a5ab6eSJonathan Jaubart        $f11m = new Family('f11m', "0 @f11m@ FAM\n1 MARR Y\n1 HUSB @i24m@\n1 WIFE @i25f@\n1 CHIL @i26f@", null, $tree);
176d8a5ab6eSJonathan Jaubart        $f12  = new Family('f12', "0 @f12@ FAM\n1 HUSB @i27m@\n1 WIFE @i26f@\n1 CHIL @i28u@\n1 CHIL @i29m@", null, $tree);
177d8a5ab6eSJonathan Jaubart        $f13m = new Family('f13m', "0 @f13m@ FAM\n1 MARR Y\n1 HUSB @i6m@\n1 WIFE @i31m@", null, $tree);
1783d9e70a5SJonathan 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);
1793d9e70a5SJonathan Jaubart        $f15  = new Family('f15', "0 @f15@ FAM\n1 HUSB @i29m@\n1 CHIL @i34f@", null, $tree);
1803d9e70a5SJonathan Jaubart        $f16  = new Family('f16', "0 @f16@ FAM\n1 WIFE @i34f@\n1 CHIL @i35m@", null, $tree);
1813d9e70a5SJonathan Jaubart        $f17  = new Family('f17', "0 @f17@ FAM\n1 HUSB @i35m@\n1 CHIL @i36f@", null, $tree);
1826fcafd02SGreg Roach
183246e8de0SGreg Roach        $family_factory->method('make')->willReturnMap([
1846c026d70SGreg Roach            ['f1m', $f1m],
1856c026d70SGreg Roach            ['f2d', $f2d],
1866c026d70SGreg Roach            ['f3e', $f3e],
1876c026d70SGreg Roach            ['f4m', $f4m],
1886c026d70SGreg Roach            ['f5m', $f5m],
1896c026d70SGreg Roach            ['f6', $f6],
1906c026d70SGreg Roach            ['f7', $f7],
1916c026d70SGreg Roach            ['f8', $f8],
1926c026d70SGreg Roach            ['f9', $f9],
1936c026d70SGreg Roach            ['f10', $f10],
1946c026d70SGreg Roach            ['f11m', $f11m],
1956c026d70SGreg Roach            ['f12', $f12],
1966c026d70SGreg Roach            ['f13m', $f13m],
1976c026d70SGreg Roach            ['f14d', $f14d],
1986c026d70SGreg Roach            ['f15', $f15],
1996c026d70SGreg Roach            ['f16', $f16],
2006c026d70SGreg Roach            ['f17', $f17],
201246e8de0SGreg Roach        ]);
2026fcafd02SGreg Roach
203a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
2046fcafd02SGreg Roach        // ENGLISH
205a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
206a004d330SGreg Roach
207a004d330SGreg Roach        $en_au = new LanguageEnglishAustralia();
208d8a5ab6eSJonathan Jaubart        $en_gb = new LanguageEnglishGreatBritain();
209a004d330SGreg Roach        $en_us = new LanguageEnglishUnitedStates();
2106fcafd02SGreg Roach
211a004d330SGreg Roach        foreach ([$en_us, $en_gb, $en_au] as $en) {
212a004d330SGreg Roach            self::assertRelationships('wife', 'husband', [$i1m, $f1m, $i2f], $en);
213a004d330SGreg Roach            self::assertRelationships('partner', 'partner', [$i9u, $f6, $i15u], $en);
214a004d330SGreg Roach            self::assertRelationships('ex-husband', 'ex-wife', [$i2f, $f2d, $i6m], $en);
215a004d330SGreg Roach            self::assertRelationships('fiancé', 'fiancée', [$i10f, $f3e, $i3m], $en);
216a004d330SGreg Roach            self::assertRelationships('son', 'father', [$i1m, $f1m, $i3m], $en);
217a004d330SGreg Roach            self::assertRelationships('daughter', 'mother', [$i2f, $f1m, $i4f], $en);
218a004d330SGreg Roach            self::assertRelationships('child', 'father', [$i1m, $f1m, $i5u], $en);
219a004d330SGreg Roach            self::assertRelationships('elder brother', 'younger sister', [$i4f, $f1m, $i3m], $en);
220a004d330SGreg Roach            self::assertRelationships('younger sibling', 'elder brother', [$i3m, $f1m, $i5u], $en);
221a004d330SGreg Roach            self::assertRelationships('brother', 'sister', [$i8f, $f2d, $i7ma], $en);
222a004d330SGreg Roach            self::assertRelationships('sibling', 'brother', [$i7ma, $f2d, $i9u], $en);
223a004d330SGreg Roach            self::assertRelationships('adoptive-mother', 'adopted-son', [$i7ma, $f2d, $i2f], $en);
224a004d330SGreg Roach            self::assertRelationships('stepfather', 'stepchild', [$i9u, $f2d, $i2f, $f1m, $i1m], $en);
225a004d330SGreg Roach            self::assertRelationships('stepdaughter', 'stepmother', [$i2f, $f1m, $i2f, $f2d, $i8f], $en);
226a004d330SGreg Roach            self::assertRelationships('stepsister', 'stepsibling', [$i9u, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $en);
227a004d330SGreg Roach            self::assertRelationships('half-brother', 'half-sister', [$i8f, $f2d, $i2f, $f1m, $i3m], $en);
228a004d330SGreg Roach            self::assertRelationships('mother-in-law', 'daughter-in-law', [$i2f, $f1m, $i1m, $f4m, $i12f], $en);
229a004d330SGreg Roach            self::assertRelationships('paternal-grandfather', 'grandson', [$i3m, $f1m, $i1m, $f4m, $i11m], $en);
230a004d330SGreg Roach            self::assertRelationships('paternal-grandmother', 'granddaughter', [$i4f, $f1m, $i1m, $f4m, $i12f], $en);
231a004d330SGreg Roach            self::assertRelationships('maternal-grandfather', 'grandson', [$i3m, $f1m, $i2f, $f5m, $i13m], $en);
232a004d330SGreg Roach            self::assertRelationships('maternal-grandmother', 'grandchild', [$i5u, $f1m, $i2f, $f5m, $i14f], $en);
233c2a86322SGreg Roach            self::assertRelationships('paternal great-grandfather', 'great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $en);
234c2a86322SGreg Roach            self::assertRelationships('paternal great-grandmother', 'great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $en);
235c2a86322SGreg Roach            self::assertRelationships('paternal great-great-grandfather', 'great-great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $en);
236c2a86322SGreg Roach            self::assertRelationships('paternal great-great-grandmother', 'great-great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $en);
237c2a86322SGreg Roach            self::assertRelationships('paternal great-great-great-grandfather', 'great-great-great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i20m], $en);
238c2a86322SGreg Roach            self::assertRelationships('paternal great-great-great-grandmother', 'great-great-great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f], $en);
239c2a86322SGreg Roach            self::assertRelationships('paternal great ×4 grandfather', 'great ×4 grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i22m], $en);
240c2a86322SGreg Roach            self::assertRelationships('paternal great ×4 grandmother', 'great ×4 granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i23f], $en);
241c2a86322SGreg Roach            self::assertRelationships('aunt', 'niece', [$i38f, $f7, $i17f, $f8, $i37f], $en);
242c2a86322SGreg Roach            self::assertRelationships('great-uncle', 'great-nephew', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m], $en);
243c2a86322SGreg Roach            self::assertRelationships('great-great-uncle', 'great-great-nephew', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $en);
244c2a86322SGreg Roach            self::assertRelationships('nephew', 'uncle', [$i24m, $f10, $i21f, $f9, $i18m], $en);
245c2a86322SGreg Roach            self::assertRelationships('great-niece', 'great-uncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f], $en);
246c2a86322SGreg Roach            self::assertRelationships('great-great-nephew', 'great-great-uncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m], $en);
24741e0cd5cSGreg Roach            self::assertRelationships('first cousin', 'first cousin', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en);
24841e0cd5cSGreg Roach            self::assertRelationships('second cousin', 'second cousin', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $en);
24941e0cd5cSGreg Roach            self::assertRelationships('first cousin once removed ascending', 'first cousin once removed descending', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en);
25041e0cd5cSGreg Roach            self::assertRelationships('third cousin', 'third cousin', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $en);
25141e0cd5cSGreg 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);
25241e0cd5cSGreg 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);
25341e0cd5cSGreg 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);
25441e0cd5cSGreg 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);
25541e0cd5cSGreg 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);
256a004d330SGreg Roach            // Compound relationships
257c2a86322SGreg Roach            self::assertRelationships('wife’s ex-husband', 'ex-wife’s husband', [$i1m, $f1m, $i2f, $f2d, $i6m], $en);
258a004d330SGreg Roach        }
259a004d330SGreg Roach
260f1de4d34SGreg Roach        // This relationship has a different name in different variants of English.
26141e0cd5cSGreg 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);
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_gb);
26341e0cd5cSGreg 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);
26441e0cd5cSGreg Roach
265a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
266d8a5ab6eSJonathan Jaubart        // FRENCH
267a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
268d8a5ab6eSJonathan Jaubart
269a004d330SGreg Roach        $fr_fr = new LanguageFrench();
270a004d330SGreg Roach        $fr_ca = new LanguageFrench();
271a004d330SGreg Roach
272a004d330SGreg Roach        foreach ([$fr_fr, $fr_ca] as $fr) {
273f1de4d34SGreg Roach            self::assertRelationships('épouse', 'époux', [$i1m, $f1m, $i2f], $fr);
274f1de4d34SGreg Roach            self::assertRelationships('conjoint', 'conjoint', [$i9u, $f6, $i15u], $fr);
275f1de4d34SGreg Roach            self::assertRelationships('ex-époux', 'ex-épouse', [$i2f, $f2d, $i6m], $fr);
276f1de4d34SGreg Roach            self::assertRelationships('fiancé', 'fiancée', [$i10f, $f3e, $i3m], $fr);
277f1de4d34SGreg Roach            self::assertRelationships('fils', 'père', [$i1m, $f1m, $i3m], $fr);
278f1de4d34SGreg Roach            self::assertRelationships('fille', 'mère', [$i2f, $f1m, $i4f], $fr);
279f1de4d34SGreg Roach            self::assertRelationships('enfant', 'père', [$i1m, $f1m, $i5u], $fr);
280f1de4d34SGreg Roach            self::assertRelationships('grand frère', 'petite sœur', [$i4f, $f1m, $i3m], $fr);
281f1de4d34SGreg Roach            self::assertRelationships('petit frère/sœur', 'grand frère', [$i3m, $f1m, $i5u], $fr);
2823d9e70a5SJonathan Jaubart            self::assertRelationships('frère', 'sœur', [$i38f, $f7, $i11m], $fr);
2833d9e70a5SJonathan Jaubart            self::assertRelationships('frère/sœur', 'sœur', [$i8f, $f2d, $i9u], $fr);
2843d9e70a5SJonathan Jaubart            self::assertRelationships('mère adoptive', 'fils adoptif', [$i7ma, $f2d, $i2f], $fr);
2853d9e70a5SJonathan Jaubart            self::assertRelationships('père adoptif', 'fils adoptif', [$i7ma, $f2d, $i6m], $fr);
2863d9e70a5SJonathan Jaubart            self::assertRelationships('sœur adoptive', 'frère adoptif', [$i7ma, $f2d, $i8f], $fr);
2873d9e70a5SJonathan Jaubart            self::assertRelationships('mère d’accueil', 'fils accueilli', [$i39mo, $f14d, $i32f], $fr);
2883d9e70a5SJonathan Jaubart            self::assertRelationships('père d’accueil', 'fils accueilli', [$i39mo, $f14d, $i31m], $fr);
2893d9e70a5SJonathan Jaubart            self::assertRelationships('sœur d’accueil', 'frère accueilli', [$i39mo, $f14d, $i33f], $fr);
2903d9e70a5SJonathan Jaubart            self::assertRelationships('beau-père', 'belle-fille', [$i8f, $f2d, $i2f, $f1m, $i1m], $fr);
2913d9e70a5SJonathan Jaubart            self::assertRelationships('demi-frère', 'demi-frère/sœur', [$i9u, $f2d, $i2f, $f1m, $i3m], $fr);
292a004d330SGreg Roach            self::assertRelationship('quasi-sœur', [$i8f, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $fr);
2933d9e70a5SJonathan Jaubart            self::assertRelationships('beau-père', 'gendre', [$i1m, $f1m, $i2f, $f5m, $i13m], $fr);
2943d9e70a5SJonathan Jaubart            self::assertRelationships('belle-mère', 'bru', [$i2f, $f1m, $i1m, $f4m, $i12f], $fr);
295f1de4d34SGreg Roach            self::assertRelationships('grand-père paternel', 'petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m], $fr);
296f1de4d34SGreg Roach            self::assertRelationships('grand-mère paternelle', 'petite-fille', [$i4f, $f1m, $i1m, $f4m, $i12f], $fr);
297f1de4d34SGreg Roach            self::assertRelationships('grand-père maternel', 'petit-fils', [$i3m, $f1m, $i2f, $f5m, $i13m], $fr);
298f1de4d34SGreg Roach            self::assertRelationships('grand-mère maternelle', 'petite-fille', [$i4f, $f1m, $i2f, $f5m, $i14f], $fr);
299f1de4d34SGreg Roach            self::assertRelationships('arrière-grand-père paternel', 'arrière-petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $fr);
300f1de4d34SGreg Roach            self::assertRelationships('arrière-grand-mère paternelle', 'arrière-petite-fille', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $fr);
3013d9e70a5SJonathan Jaubart            self::assertRelationships('trisaïeul paternel', 'petit-fils au 3<sup>e</sup> degré', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $fr);
3023d9e70a5SJonathan Jaubart            self::assertRelationships('trisaïeule paternelle', 'petite-fille au 3<sup>e</sup> degré', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $fr);
3033d9e70a5SJonathan 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);
3043d9e70a5SJonathan 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);
305f1de4d34SGreg Roach            self::assertRelationships('oncle', 'neveu', [$i18m, $f9, $i21f, $f10, $i24m], $fr);
3063d9e70a5SJonathan Jaubart            self::assertRelationships('grand-oncle', 'petite-nièce', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $fr);
307f1de4d34SGreg Roach            self::assertRelationships('arrière-grand-oncle', 'arrière-petit-neveu', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $fr);
3083d9e70a5SJonathan 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);
3093d9e70a5SJonathan 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);
310f1de4d34SGreg Roach            self::assertRelationships('cousine germaine', 'cousin germain', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $fr);
311f1de4d34SGreg Roach            self::assertRelationships('cousin issu de germain', 'cousin issu de germain', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $fr);
312f1de4d34SGreg 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);
313f1de4d34SGreg Roach            self::assertRelationships('grand-cousine', 'petit-cousin', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $fr);
314f1de4d34SGreg Roach            self::assertRelationships('petit-cousin', 'grand-cousine', [$i26f, $f11m, $i24m, $f10, $i21f, $f9, $i18m, $f8, $i30m], $fr);
315f1de4d34SGreg 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);
316f1de4d34SGreg 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);
317d8a5ab6eSJonathan Jaubart            // Compound relationships
318f1de4d34SGreg Roach            self::assertRelationships('ex-époux de l’épouse', 'époux de l’ex-épouse', [$i1m, $f1m, $i2f, $f2d, $i6m], $fr);
3193d9e70a5SJonathan 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);
3203d9e70a5SJonathan Jaubart            self::assertRelationship('épouse de l’arrière-petit-neveu', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m, $f4m, $i12f], $fr);
3213d9e70a5SJonathan Jaubart            self::assertRelationship('conjoint de la petite-nièce', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i16m], $fr);
3223d9e70a5SJonathan Jaubart            self::assertRelationship('conjointe du neveu', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i19f], $fr);
32396c67f5bSJonathan Jaubart            self::assertRelationships('cousine germaine du conjoint', 'conjointe du cousin germain', [$i19f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $fr);
324a004d330SGreg Roach        }
325d8a5ab6eSJonathan Jaubart
326a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
3276fcafd02SGreg Roach        // SLOVAK
328a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
329696d9d5cSGreg Roach
3302c927a63SGreg Roach        $sk = new LanguageSlovakian();
331696d9d5cSGreg Roach
3322c927a63SGreg Roach        self::assertRelationships('manželka', 'manžel', [$i1m, $f1m, $i2f], $sk);
3332c927a63SGreg Roach        self::assertRelationships('partner', 'partner', [$i9u, $f6, $i15u], $sk);
3342c927a63SGreg Roach        self::assertRelationships('exmanžel', 'exmanželka', [$i2f, $f2d, $i6m], $sk);
3352c927a63SGreg Roach        self::assertRelationships('snúbenica', 'snúbenec', [$i10f, $f3e, $i3m], $sk);
3362c927a63SGreg Roach        self::assertRelationships('syn', 'otec', [$i1m, $f1m, $i3m], $sk);
3372c927a63SGreg Roach        self::assertRelationships('dcéra', 'matka', [$i2f, $f1m, $i4f], $sk);
3382c927a63SGreg Roach        self::assertRelationships('dieťa', 'otec', [$i1m, $f1m, $i5u], $sk);
3392c927a63SGreg Roach        self::assertRelationships('brat', 'sestra', [$i4f, $f1m, $i3m], $sk);
3402c927a63SGreg Roach        self::assertRelationships('súrodenec', 'brat', [$i3m, $f1m, $i5u], $sk);
3412c927a63SGreg Roach        self::assertRelationships('brat', 'sestra', [$i8f, $f2d, $i7ma], $sk);
3422c927a63SGreg Roach        self::assertRelationships('súrodenec', 'brat', [$i7ma, $f2d, $i9u], $sk);
3432c927a63SGreg Roach        self::assertRelationships('matka', 'syn', [$i7ma, $f2d, $i2f], $sk);
3442c927a63SGreg Roach        self::assertRelationships('manžel matky', 'dieťa manželky', [$i9u, $f2d, $i2f, $f1m, $i1m], $sk);
3452c927a63SGreg Roach        self::assertRelationships('dcéra manželky', 'manželka matky', [$i2f, $f1m, $i2f, $f2d, $i8f], $sk);
3462c927a63SGreg Roach        self::assertRelationships('dcéra manžela otca', 'dieťa manžela otca', [$i9u, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $sk);
3472c927a63SGreg Roach        self::assertRelationships('nevlastný brat', 'nevlastná sestra', [$i8f, $f2d, $i2f, $f1m, $i3m], $sk);
3482c927a63SGreg Roach        self::assertRelationships('svokra', 'nevesta', [$i2f, $f1m, $i1m, $f4m, $i12f], $sk);
3492c927a63SGreg Roach        self::assertRelationships('starý otec', 'vnuk', [$i3m, $f1m, $i1m, $f4m, $i11m], $sk);
3502c927a63SGreg Roach        self::assertRelationships('stará matka', 'vnučka', [$i4f, $f1m, $i1m, $f4m, $i12f], $sk);
3512c927a63SGreg Roach        self::assertRelationships('starý otec', 'vnuk', [$i3m, $f1m, $i2f, $f5m, $i13m], $sk);
3522c927a63SGreg Roach        self::assertRelationships('stará matka', 'vnúča', [$i5u, $f1m, $i2f, $f5m, $i14f], $sk);
3532c927a63SGreg Roach        self::assertRelationships('prastarý otec', 'pravnuk', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $sk);
3542c927a63SGreg Roach        self::assertRelationships('prastarý otec', 'pravnučka', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $sk);
3552c927a63SGreg Roach        self::assertRelationships('pra-pra-pra-prastarý otec', 'pravnuk dcéry', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $sk);
3562c927a63SGreg Roach        self::assertRelationships('pra-pra-pra-prastará matka', 'pravnučka dcéry', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $sk);
3572c927a63SGreg Roach        self::assertRelationships('pra ×4 prastarý otec', 'pravnuk vnučky', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i20m], $sk);
3582c927a63SGreg Roach        self::assertRelationships('pra ×4 prastará matka', 'pravnučka vnučky', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f], $sk);
3592c927a63SGreg Roach        self::assertRelationships('pra ×5 prastarý otec', 'pravnuk pravnučky', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i22m], $sk);
3602c927a63SGreg 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);
3612c927a63SGreg Roach        self::assertRelationships('teta', 'neter', [$i38f, $f7, $i17f, $f8, $i37f], $sk);
3622c927a63SGreg Roach        self::assertRelationships('prastrýko', 'prasynovec', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m], $sk);
3632c927a63SGreg Roach        self::assertRelationships('pra-prastrýko', 'pravnuk sestry', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $sk);
3642c927a63SGreg Roach        self::assertRelationships('synovec', 'ujo', [$i24m, $f10, $i21f, $f9, $i18m], $sk);
3652c927a63SGreg Roach        self::assertRelationships('praneter', 'prastrýko', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f], $sk);
3662c927a63SGreg Roach        self::assertRelationships('pravnuk sestry', 'pra-prastrýko', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m], $sk);
3672c927a63SGreg Roach        self::assertRelationships('sesternica', 'bratranec', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $sk);
3682c927a63SGreg Roach        self::assertRelationships('druhostupňový bratranec', 'druhostupňová sesternica', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $sk);
3692c927a63SGreg Roach        self::assertRelationships('sesternica otca', 'praneter otca', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $sk);
3702c927a63SGreg 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);
3712c927a63SGreg 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);
3722c927a63SGreg Roach        self::assertRelationships('pra-dcéra prastrýka', 'pravnuk tety', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $sk);
3732c927a63SGreg 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);
3742c927a63SGreg 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);
3752c927a63SGreg 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);
3762c927a63SGreg 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
3772c927a63SGreg Roach        self::assertRelationships('exmanžel manželky', 'manžel exmanželky', [$i1m, $f1m, $i2f, $f2d, $i6m], $sk);
378a004d330SGreg Roach    }
379a004d330SGreg Roach
380a004d330SGreg Roach    /**
38109482a55SGreg Roach     * @param array<Individual|Family> $nodes
382a004d330SGreg Roach     */
383a004d330SGreg Roach    private static function assertRelationship(string $expected, array $nodes, ModuleLanguageInterface $language): void
384a004d330SGreg Roach    {
385a004d330SGreg Roach        $service = new RelationshipService();
386a004d330SGreg Roach        $actual  = $service->nameFromPath($nodes, $language);
38705babb96SGreg Roach        $path    = implode('-', array_map(static fn (GedcomRecord $record): string => $record->xref(), $nodes));
388a004d330SGreg Roach        $english = $service->nameFromPath($nodes, new LanguageEnglishUnitedStates());
389a004d330SGreg Roach        $message = 'Language: ' . $language->title() . PHP_EOL . 'Path: ' . $path . ' (' . $english . ')';
390a004d330SGreg Roach
391a004d330SGreg Roach        self::assertSame($expected, $actual, $message);
392a004d330SGreg Roach    }
393a004d330SGreg Roach
394a004d330SGreg Roach    /**
395a004d330SGreg Roach     * Test a relationship name in both directions
396a004d330SGreg Roach     *
39709482a55SGreg Roach     * @param array<Individual|Family> $nodes
398a004d330SGreg Roach     */
399a004d330SGreg Roach    private static function assertRelationships(string $fwd, string $rev, array $nodes, ModuleLanguageInterface $language): void
400a004d330SGreg Roach    {
401a004d330SGreg Roach        self::assertRelationship($fwd, $nodes, $language);
402a004d330SGreg Roach        self::assertRelationship($rev, array_reverse($nodes), $language);
4036fcafd02SGreg Roach    }
4046fcafd02SGreg Roach}
405