xref: /webtrees/tests/feature/RelationshipNamesTest.php (revision 696d9d5c6f0510dab774984c5672eda0ffe7cdfd)
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;
28a004d330SGreg Roachuse Fisharebest\Webtrees\Module\ModuleLanguageInterface;
296fcafd02SGreg Roachuse Fisharebest\Webtrees\Services\RelationshipService;
306fcafd02SGreg Roach
31a004d330SGreg Roachuse function array_reverse;
32a004d330SGreg Roach
336fcafd02SGreg Roach/**
346fcafd02SGreg Roach * Test the user functions
356fcafd02SGreg Roach *
366fcafd02SGreg Roach * @covers \Fisharebest\Webtrees\Relationship
376fcafd02SGreg Roach * @covers \Fisharebest\Webtrees\Services\RelationshipService
386fcafd02SGreg Roach * @covers \Fisharebest\Webtrees\Module\LanguageEnglishGreatBritain
39d8a5ab6eSJonathan Jaubart * @covers \Fisharebest\Webtrees\Module\LanguageEnglishUnitedStates
40d8a5ab6eSJonathan Jaubart * @covers \Fisharebest\Webtrees\Module\LanguageFrench
41b72623feSGreg Roach * @covers \Fisharebest\Webtrees\Module\ModuleLanguageTrait
426fcafd02SGreg Roach */
436fcafd02SGreg Roachclass RelationshipNamesTest extends TestCase
446fcafd02SGreg Roach{
456fcafd02SGreg Roach    /**
466fcafd02SGreg Roach     * @return void
476fcafd02SGreg 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        //                            |                  |                           |                            |
68c2a86322SGreg Roach        //                        +---+---+          +---+---+                       |                            |
69c2a86322SGreg Roach        //                        |   |   |          |   |   |                       |                            |
70c2a86322SGreg Roach        //          i10f===f3e===i3m i4f i5u       i7ma i8f i9u===f6===i15u         i33f                         i36f
716fcafd02SGreg Roach        //
726fcafd02SGreg Roach        // Individual suffixes - m(ale), f(emale), u(nknown), a(dopted)
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);
1216fcafd02SGreg Roach
1226fcafd02SGreg Roach        $individual_factory->method('make')->will($this->returnValueMap([
1236fcafd02SGreg Roach            'i1m'  => $i1m,
1246fcafd02SGreg Roach            'i2f'  => $i2f,
1256fcafd02SGreg Roach            'i3m'  => $i3m,
1266fcafd02SGreg Roach            'i4f'  => $i4f,
1276fcafd02SGreg Roach            'i5u'  => $i5u,
1286fcafd02SGreg Roach            'i6m'  => $i6m,
1296fcafd02SGreg Roach            'i7ma' => $i7ma,
1306fcafd02SGreg Roach            'i8f'  => $i8f,
1316fcafd02SGreg Roach            'i9u'  => $i9u,
1326fcafd02SGreg Roach            'i10f' => $i10f,
1336fcafd02SGreg Roach            'i11m' => $i11m,
1346fcafd02SGreg Roach            'i12f' => $i12f,
1356fcafd02SGreg Roach            'i13m' => $i13m,
1366fcafd02SGreg Roach            'i14f' => $i14f,
1376fcafd02SGreg Roach            'i15u' => $i15u,
1386fcafd02SGreg Roach            'i16m' => $i16m,
1396fcafd02SGreg Roach            'i17f' => $i17f,
1406fcafd02SGreg Roach            'i18m' => $i18m,
1416fcafd02SGreg Roach            'i19f' => $i19f,
1426fcafd02SGreg Roach            'i20m' => $i20m,
1436fcafd02SGreg Roach            'i21f' => $i21f,
144d8a5ab6eSJonathan Jaubart            'i22m' => $i22m,
145d8a5ab6eSJonathan Jaubart            'i23f' => $i23f,
146d8a5ab6eSJonathan Jaubart            'i24m' => $i24m,
147d8a5ab6eSJonathan Jaubart            'i25f' => $i25f,
148d8a5ab6eSJonathan Jaubart            'i26f' => $i26f,
149d8a5ab6eSJonathan Jaubart            'i27m' => $i27m,
150d8a5ab6eSJonathan Jaubart            'i28u' => $i28u,
151d8a5ab6eSJonathan Jaubart            'i29m' => $i29m,
152d8a5ab6eSJonathan Jaubart            'i30m' => $i30m,
153d8a5ab6eSJonathan Jaubart            'i31m' => $i31m,
154d8a5ab6eSJonathan Jaubart            'i32f' => $i32f,
155d8a5ab6eSJonathan Jaubart            'i33f' => $i33f,
156a004d330SGreg Roach            'i34f' => $i34f,
15741e0cd5cSGreg Roach            'i35m' => $i35m,
15841e0cd5cSGreg Roach            'i36f' => $i36f,
159c2a86322SGreg Roach            'i37f' => $i37f,
160c2a86322SGreg Roach            'i38f' => $i38f,
1616fcafd02SGreg Roach        ]));
1626fcafd02SGreg Roach
1636fcafd02SGreg 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);
1646fcafd02SGreg 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);
1656fcafd02SGreg Roach        $f3e  = new Family('f3e', "0 @f3e@ FAM\n1 ENGA Y\n1 HUSB @i3m@\n1 WIFE @i10f@", null, $tree);
1666fcafd02SGreg Roach        $f4m  = new Family('f4m', "0 @f4m@ FAM\n1 MARR Y\n1 HUSB @i11m@\n1 WIFE @i12f@\n1 CHIL @i1m@", null, $tree);
1676fcafd02SGreg Roach        $f5m  = new Family('f5m', "0 @f5m@ FAM\n1 MARR Y\n1 HUSB @i13m@\n1 WIFE @i14f@\n1 CHIL @i2f@", null, $tree);
1686fcafd02SGreg Roach        $f6   = new Family('f6', "0 @f6@ FAM\n1 HUSB @i9u@\n1 WIFE @i15u@", null, $tree);
169c2a86322SGreg Roach        $f7   = new Family('f7', "0 @f7@ FAM\n1 HUSB @i16m@\n1 WIFE @i17f@\n1 CHIL @i11m@\n1 CHIL @i38f@", null, $tree);
170c2a86322SGreg 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);
1716fcafd02SGreg Roach        $f9   = new Family('f9', "0 @f9@ FAM\n1 HUSB @i20m@\n1 WIFE @i21f@\n1 CHIL @i18m@", null, $tree);
172d8a5ab6eSJonathan Jaubart        $f10  = new Family('f10', "0 @f10@ FAM\n1 HUSB @i22m@\n1 WIFE @i23f@\n1 CHIL @i21f@\n1 CHIL @i24m@", null, $tree);
173d8a5ab6eSJonathan Jaubart        $f11m = new Family('f11m', "0 @f11m@ FAM\n1 MARR Y\n1 HUSB @i24m@\n1 WIFE @i25f@\n1 CHIL @i26f@", null, $tree);
174d8a5ab6eSJonathan Jaubart        $f12  = new Family('f12', "0 @f12@ FAM\n1 HUSB @i27m@\n1 WIFE @i26f@\n1 CHIL @i28u@\n1 CHIL @i29m@", null, $tree);
175d8a5ab6eSJonathan Jaubart        $f13m = new Family('f13m', "0 @f13m@ FAM\n1 MARR Y\n1 HUSB @i6m@\n1 WIFE @i31m@", null, $tree);
176d8a5ab6eSJonathan Jaubart        $f14d = new Family('f14d', "0 @f14d@ FAM\n1 DIV Y\n1 HUSB @i31m@\n1 WIFE @i32f@\n1 CHIL @i33f@\n", null, $tree);
177d8a5ab6eSJonathan Jaubart        $f15  = new Family('f15', "0 @f15@ FAM\n1 HUSB @i29m@\n1 CHIL @i34f@\n", null, $tree);
17841e0cd5cSGreg Roach        $f16  = new Family('f16', "0 @f16@ FAM\n1 WIFE @i34f@\n1 CHIL @i35m@\n", null, $tree);
17941e0cd5cSGreg Roach        $f17  = new Family('f17', "0 @f17@ FAM\n1 HUSB @i35m@\n1 CHIL @i36f@\n", null, $tree);
1806fcafd02SGreg Roach
1816fcafd02SGreg Roach        $family_factory->method('make')->will($this->returnValueMap([
1826fcafd02SGreg Roach            'f1m'  => $f1m,
1836fcafd02SGreg Roach            'f2d'  => $f2d,
1846fcafd02SGreg Roach            'f3e'  => $f3e,
1856fcafd02SGreg Roach            'f4m'  => $f4m,
1866fcafd02SGreg Roach            'f5m'  => $f5m,
1876fcafd02SGreg Roach            'f6'   => $f6,
1886fcafd02SGreg Roach            'f7'   => $f7,
1896fcafd02SGreg Roach            'f8'   => $f8,
1906fcafd02SGreg Roach            'f9'   => $f9,
1916fcafd02SGreg Roach            'f10'  => $f10,
192d8a5ab6eSJonathan Jaubart            'f11m' => $f11m,
193d8a5ab6eSJonathan Jaubart            'f12'  => $f12,
194d8a5ab6eSJonathan Jaubart            'f13m' => $f13m,
195d8a5ab6eSJonathan Jaubart            'f14d' => $f14d,
196a004d330SGreg Roach            'f15'  => $f15,
19741e0cd5cSGreg Roach            'f16'  => $f16,
19841e0cd5cSGreg Roach            'f17'  => $f17,
1996fcafd02SGreg Roach        ]));
2006fcafd02SGreg Roach
201a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
2026fcafd02SGreg Roach        // ENGLISH
203a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
204a004d330SGreg Roach
205a004d330SGreg Roach        $en_au = new LanguageEnglishAustralia();
206d8a5ab6eSJonathan Jaubart        $en_gb = new LanguageEnglishGreatBritain();
207a004d330SGreg Roach        $en_us = new LanguageEnglishUnitedStates();
2086fcafd02SGreg Roach
209a004d330SGreg Roach        foreach ([$en_us, $en_gb, $en_au] as $en) {
210a004d330SGreg Roach            self::assertRelationships('wife', 'husband', [$i1m, $f1m, $i2f], $en);
211a004d330SGreg Roach            self::assertRelationships('partner', 'partner', [$i9u, $f6, $i15u], $en);
212a004d330SGreg Roach            self::assertRelationships('ex-husband', 'ex-wife', [$i2f, $f2d, $i6m], $en);
213a004d330SGreg Roach            self::assertRelationships('fiancé', 'fiancée', [$i10f, $f3e, $i3m], $en);
214a004d330SGreg Roach            self::assertRelationships('son', 'father', [$i1m, $f1m, $i3m], $en);
215a004d330SGreg Roach            self::assertRelationships('daughter', 'mother', [$i2f, $f1m, $i4f], $en);
216a004d330SGreg Roach            self::assertRelationships('child', 'father', [$i1m, $f1m, $i5u], $en);
217a004d330SGreg Roach            self::assertRelationships('elder brother', 'younger sister', [$i4f, $f1m, $i3m], $en);
218a004d330SGreg Roach            self::assertRelationships('younger sibling', 'elder brother', [$i3m, $f1m, $i5u], $en);
219a004d330SGreg Roach            self::assertRelationships('brother', 'sister', [$i8f, $f2d, $i7ma], $en);
220a004d330SGreg Roach            self::assertRelationships('sibling', 'brother', [$i7ma, $f2d, $i9u], $en);
221a004d330SGreg Roach            self::assertRelationships('adoptive-mother', 'adopted-son', [$i7ma, $f2d, $i2f], $en);
222a004d330SGreg Roach            self::assertRelationships('stepfather', 'stepchild', [$i9u, $f2d, $i2f, $f1m, $i1m], $en);
223a004d330SGreg Roach            self::assertRelationships('stepdaughter', 'stepmother', [$i2f, $f1m, $i2f, $f2d, $i8f], $en);
224a004d330SGreg Roach            self::assertRelationships('stepsister', 'stepsibling', [$i9u, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $en);
225a004d330SGreg Roach            self::assertRelationships('half-brother', 'half-sister', [$i8f, $f2d, $i2f, $f1m, $i3m], $en);
226a004d330SGreg Roach            self::assertRelationships('mother-in-law', 'daughter-in-law', [$i2f, $f1m, $i1m, $f4m, $i12f], $en);
227a004d330SGreg Roach            self::assertRelationships('paternal-grandfather', 'grandson', [$i3m, $f1m, $i1m, $f4m, $i11m], $en);
228a004d330SGreg Roach            self::assertRelationships('paternal-grandmother', 'granddaughter', [$i4f, $f1m, $i1m, $f4m, $i12f], $en);
229a004d330SGreg Roach            self::assertRelationships('maternal-grandfather', 'grandson', [$i3m, $f1m, $i2f, $f5m, $i13m], $en);
230a004d330SGreg Roach            self::assertRelationships('maternal-grandmother', 'grandchild', [$i5u, $f1m, $i2f, $f5m, $i14f], $en);
231c2a86322SGreg Roach            self::assertRelationships('paternal great-grandfather', 'great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $en);
232c2a86322SGreg Roach            self::assertRelationships('paternal great-grandmother', 'great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $en);
233c2a86322SGreg Roach            self::assertRelationships('paternal great-great-grandfather', 'great-great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $en);
234c2a86322SGreg Roach            self::assertRelationships('paternal great-great-grandmother', 'great-great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $en);
235c2a86322SGreg Roach            self::assertRelationships('paternal great-great-great-grandfather', 'great-great-great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i20m], $en);
236c2a86322SGreg Roach            self::assertRelationships('paternal great-great-great-grandmother', 'great-great-great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f], $en);
237c2a86322SGreg Roach            self::assertRelationships('paternal great ×4 grandfather', 'great ×4 grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i22m], $en);
238c2a86322SGreg Roach            self::assertRelationships('paternal great ×4 grandmother', 'great ×4 granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i23f], $en);
239c2a86322SGreg Roach            self::assertRelationships('aunt', 'niece', [$i38f, $f7, $i17f, $f8, $i37f], $en);
240c2a86322SGreg Roach            self::assertRelationships('great-uncle', 'great-nephew', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m], $en);
241c2a86322SGreg Roach            self::assertRelationships('great-great-uncle', 'great-great-nephew', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $en);
242c2a86322SGreg Roach            self::assertRelationships('nephew', 'uncle', [$i24m, $f10, $i21f, $f9, $i18m], $en);
243c2a86322SGreg Roach            self::assertRelationships('great-niece', 'great-uncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f], $en);
244c2a86322SGreg Roach            self::assertRelationships('great-great-nephew', 'great-great-uncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m], $en);
24541e0cd5cSGreg Roach            self::assertRelationships('first cousin', 'first cousin', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en);
24641e0cd5cSGreg Roach            self::assertRelationships('second cousin', 'second cousin', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $en);
24741e0cd5cSGreg Roach            self::assertRelationships('first cousin once removed ascending', 'first cousin once removed descending', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en);
24841e0cd5cSGreg Roach            self::assertRelationships('third cousin', 'third cousin', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $en);
24941e0cd5cSGreg 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);
25041e0cd5cSGreg 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);
25141e0cd5cSGreg 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);
25241e0cd5cSGreg 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);
25341e0cd5cSGreg 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);
254a004d330SGreg Roach            // Compound relationships
255c2a86322SGreg Roach            self::assertRelationships('wife’s ex-husband', 'ex-wife’s husband', [$i1m, $f1m, $i2f, $f2d, $i6m], $en);
256a004d330SGreg Roach        }
257a004d330SGreg Roach
258f1de4d34SGreg Roach        // This relationship has a different name in different variants of English.
25941e0cd5cSGreg 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);
26041e0cd5cSGreg 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);
26141e0cd5cSGreg 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);
26241e0cd5cSGreg Roach
263a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
264d8a5ab6eSJonathan Jaubart        // FRENCH
265a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
266d8a5ab6eSJonathan Jaubart
267a004d330SGreg Roach        $fr_fr = new LanguageFrench();
268a004d330SGreg Roach        $fr_ca = new LanguageFrench();
269a004d330SGreg Roach
270a004d330SGreg Roach        foreach ([$fr_fr, $fr_ca] as $fr) {
271f1de4d34SGreg Roach            self::assertRelationships('épouse', 'époux', [$i1m, $f1m, $i2f], $fr);
272f1de4d34SGreg Roach            self::assertRelationships('conjoint', 'conjoint', [$i9u, $f6, $i15u], $fr);
273f1de4d34SGreg Roach            self::assertRelationships('ex-époux', 'ex-épouse', [$i2f, $f2d, $i6m], $fr);
274f1de4d34SGreg Roach            self::assertRelationships('fiancé', 'fiancée', [$i10f, $f3e, $i3m], $fr);
275f1de4d34SGreg Roach            self::assertRelationships('fils', 'père', [$i1m, $f1m, $i3m], $fr);
276f1de4d34SGreg Roach            self::assertRelationships('fille', 'mère', [$i2f, $f1m, $i4f], $fr);
277f1de4d34SGreg Roach            self::assertRelationships('enfant', 'père', [$i1m, $f1m, $i5u], $fr);
278f1de4d34SGreg Roach            self::assertRelationships('grand frère', 'petite sœur', [$i4f, $f1m, $i3m], $fr);
279f1de4d34SGreg Roach            self::assertRelationships('petit frère/sœur', 'grand frère', [$i3m, $f1m, $i5u], $fr);
280f1de4d34SGreg Roach            self::assertRelationships('frère', 'sœur', [$i8f, $f2d, $i7ma], $fr);
281a004d330SGreg Roach            self::assertRelationship('sœur', [$i7ma, $f2d, $i8f], $fr);
282a004d330SGreg Roach            self::assertRelationship('frère/sœur', [$i7ma, $f2d, $i9u], $fr);
283a004d330SGreg Roach            self::assertRelationship('mère adoptive', [$i7ma, $f2d, $i2f], $fr);
284a004d330SGreg Roach            self::assertRelationship('père adoptif', [$i7ma, $f2d, $i6m], $fr);
285a004d330SGreg Roach            self::assertRelationship('fils adoptif', [$i6m, $f2d, $i7ma], $fr);
286a004d330SGreg Roach            self::assertRelationship('beau-père', [$i8f, $f2d, $i2f, $f1m, $i1m], $fr);
287a004d330SGreg Roach            self::assertRelationship('belle-fille', [$i1m, $f1m, $i2f, $f2d, $i8f], $fr);
288a004d330SGreg Roach            self::assertRelationship('demi-frère', [$i8f, $f2d, $i2f, $f1m, $i3m], $fr);
289a004d330SGreg Roach            self::assertRelationship('quasi-sœur', [$i8f, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $fr);
290a004d330SGreg Roach            self::assertRelationship('beau-père', [$i8f, $f2d, $i6m, $f13m, $i31m], $fr);
291a004d330SGreg Roach            self::assertRelationship('belle-mère', [$i2f, $f1m, $i1m, $f4m, $i12f], $fr);
292a004d330SGreg Roach            self::assertRelationship('belle-fille', [$i12f, $f4m, $i1m, $f1m, $i2f], $fr);
293d8a5ab6eSJonathan Jaubart            // Dynamic relationships
294f1de4d34SGreg Roach            self::assertRelationships('grand-père paternel', 'petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m], $fr);
295f1de4d34SGreg Roach            self::assertRelationships('grand-mère paternelle', 'petite-fille', [$i4f, $f1m, $i1m, $f4m, $i12f], $fr);
296f1de4d34SGreg Roach            self::assertRelationships('grand-père maternel', 'petit-fils', [$i3m, $f1m, $i2f, $f5m, $i13m], $fr);
297f1de4d34SGreg Roach            self::assertRelationships('grand-mère maternelle', 'petite-fille', [$i4f, $f1m, $i2f, $f5m, $i14f], $fr);
298f1de4d34SGreg Roach            self::assertRelationships('arrière-grand-père paternel', 'arrière-petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $fr);
299f1de4d34SGreg Roach            self::assertRelationships('arrière-grand-mère paternelle', 'arrière-petite-fille', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $fr);
300f1de4d34SGreg Roach            self::assertRelationships('arrière-arrière-grand-père paternel', 'arrière-arrière-petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $fr);
301f1de4d34SGreg Roach            self::assertRelationships('arrière-arrière-grand-mère paternelle', 'arrière-arrière-petite-fille', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $fr);
302f1de4d34SGreg Roach            self::assertRelationships('arrière-(x3)-grand-père paternel', 'arrière-(x3)-petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i20m], $fr);
303f1de4d34SGreg Roach            self::assertRelationships('arrière-(x3)-grand-mère paternelle', 'arrière-(x3)-petite-fille', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f], $fr);
304f1de4d34SGreg Roach            self::assertRelationships('arrière-(x4)-grand-père paternel', 'arrière-(x4)-petit-fils', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i22m], $fr);
305f1de4d34SGreg Roach            self::assertRelationships('arrière-(x4)-grand-mère paternelle', 'arrière-(x4)-petite-fille', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i23f], $fr);
306f1de4d34SGreg Roach            self::assertRelationships('oncle', 'neveu', [$i18m, $f9, $i21f, $f10, $i24m], $fr);
307f1de4d34SGreg Roach            self::assertRelationships('grand-oncle', 'petit-neveu', [$i30m, $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);
309f1de4d34SGreg Roach            self::assertRelationships('neveu', 'oncle', [$i24m, $f10, $i21f, $f9, $i18m], $fr);
310f1de4d34SGreg Roach            self::assertRelationships('petite-nièce', 'grand-oncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f], $fr);
311f1de4d34SGreg Roach            self::assertRelationships('arrière-petit-neveu', 'arrière-grand-oncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m], $fr);
312f1de4d34SGreg Roach            self::assertRelationships('cousine germaine', 'cousin germain', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $fr);
313f1de4d34SGreg Roach            self::assertRelationships('cousin issu de germain', 'cousin issu de germain', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $fr);
314f1de4d34SGreg 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);
315f1de4d34SGreg Roach            self::assertRelationships('grand-cousine', 'petit-cousin', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $fr);
316f1de4d34SGreg Roach            self::assertRelationships('petit-cousin', 'grand-cousine', [$i26f, $f11m, $i24m, $f10, $i21f, $f9, $i18m, $f8, $i30m], $fr);
317f1de4d34SGreg 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);
318f1de4d34SGreg 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);
319d8a5ab6eSJonathan Jaubart            // Compound relationships
320f1de4d34SGreg Roach            self::assertRelationships('ex-époux de l’épouse', 'époux de l’ex-épouse', [$i1m, $f1m, $i2f, $f2d, $i6m], $fr);
321a004d330SGreg Roach        }
322d8a5ab6eSJonathan Jaubart
323a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
3246fcafd02SGreg Roach        // SLOVAK
325a004d330SGreg Roach        ///////////////////////////////////////////////////////////////////////
326*696d9d5cSGreg Roach
327*696d9d5cSGreg Roach        $sk = new LanguageSlovak();
328*696d9d5cSGreg Roach
329*696d9d5cSGreg Roach        self::assertRelationships('wife', 'husband', [$i1m, $f1m, $i2f], $en);
330*696d9d5cSGreg Roach        self::assertRelationships('partner', 'partner', [$i9u, $f6, $i15u], $en);
331*696d9d5cSGreg Roach        self::assertRelationships('ex-husband', 'ex-wife', [$i2f, $f2d, $i6m], $en);
332*696d9d5cSGreg Roach        self::assertRelationships('fiancé', 'fiancée', [$i10f, $f3e, $i3m], $en);
333*696d9d5cSGreg Roach        self::assertRelationships('son', 'father', [$i1m, $f1m, $i3m], $en);
334*696d9d5cSGreg Roach        self::assertRelationships('daughter', 'mother', [$i2f, $f1m, $i4f], $en);
335*696d9d5cSGreg Roach        self::assertRelationships('child', 'father', [$i1m, $f1m, $i5u], $en);
336*696d9d5cSGreg Roach        self::assertRelationships('elder brother', 'younger sister', [$i4f, $f1m, $i3m], $en);
337*696d9d5cSGreg Roach        self::assertRelationships('younger sibling', 'elder brother', [$i3m, $f1m, $i5u], $en);
338*696d9d5cSGreg Roach        self::assertRelationships('brother', 'sister', [$i8f, $f2d, $i7ma], $en);
339*696d9d5cSGreg Roach        self::assertRelationships('sibling', 'brother', [$i7ma, $f2d, $i9u], $en);
340*696d9d5cSGreg Roach        self::assertRelationships('adoptive-mother', 'adopted-son', [$i7ma, $f2d, $i2f], $en);
341*696d9d5cSGreg Roach        self::assertRelationships('stepfather', 'stepchild', [$i9u, $f2d, $i2f, $f1m, $i1m], $en);
342*696d9d5cSGreg Roach        self::assertRelationships('stepdaughter', 'stepmother', [$i2f, $f1m, $i2f, $f2d, $i8f], $en);
343*696d9d5cSGreg Roach        self::assertRelationships('stepsister', 'stepsibling', [$i9u, $f2d, $i6m, $f13m, $i31m, $f14d, $i33f], $en);
344*696d9d5cSGreg Roach        self::assertRelationships('half-brother', 'half-sister', [$i8f, $f2d, $i2f, $f1m, $i3m], $en);
345*696d9d5cSGreg Roach        self::assertRelationships('mother-in-law', 'daughter-in-law', [$i2f, $f1m, $i1m, $f4m, $i12f], $en);
346*696d9d5cSGreg Roach        self::assertRelationships('paternal-grandfather', 'grandson', [$i3m, $f1m, $i1m, $f4m, $i11m], $en);
347*696d9d5cSGreg Roach        self::assertRelationships('paternal-grandmother', 'granddaughter', [$i4f, $f1m, $i1m, $f4m, $i12f], $en);
348*696d9d5cSGreg Roach        self::assertRelationships('maternal-grandfather', 'grandson', [$i3m, $f1m, $i2f, $f5m, $i13m], $en);
349*696d9d5cSGreg Roach        self::assertRelationships('maternal-grandmother', 'grandchild', [$i5u, $f1m, $i2f, $f5m, $i14f], $en);
350*696d9d5cSGreg Roach        self::assertRelationships('paternal great-grandfather', 'great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i16m], $en);
351*696d9d5cSGreg Roach        self::assertRelationships('paternal great-grandmother', 'great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f], $en);
352*696d9d5cSGreg Roach        self::assertRelationships('paternal great-great-grandfather', 'great-great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m], $en);
353*696d9d5cSGreg Roach        self::assertRelationships('paternal great-great-grandmother', 'great-great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i19f], $en);
354*696d9d5cSGreg Roach        self::assertRelationships('paternal great-great-great-grandfather', 'great-great-great-grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i20m], $en);
355*696d9d5cSGreg Roach        self::assertRelationships('paternal great-great-great-grandmother', 'great-great-great-granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f], $en);
356*696d9d5cSGreg Roach        self::assertRelationships('paternal great ×4 grandfather', 'great ×4 grandson', [$i3m, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i22m], $en);
357*696d9d5cSGreg Roach        self::assertRelationships('paternal great ×4 grandmother', 'great ×4 granddaughter', [$i4f, $f1m, $i1m, $f4m, $i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i23f], $en);
358*696d9d5cSGreg Roach        self::assertRelationships('aunt', 'niece', [$i38f, $f7, $i17f, $f8, $i37f], $en);
359*696d9d5cSGreg Roach        self::assertRelationships('great-uncle', 'great-nephew', [$i30m, $f8, $i18m, $f9, $i21f, $f10, $i24m], $en);
360*696d9d5cSGreg Roach        self::assertRelationships('great-great-uncle', 'great-great-nephew', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m], $en);
361*696d9d5cSGreg Roach        self::assertRelationships('nephew', 'uncle', [$i24m, $f10, $i21f, $f9, $i18m], $en);
362*696d9d5cSGreg Roach        self::assertRelationships('great-niece', 'great-uncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f], $en);
363*696d9d5cSGreg Roach        self::assertRelationships('great-great-nephew', 'great-great-uncle', [$i24m, $f10, $i21f, $f9, $i18m, $f8, $i17f, $f7, $i11m], $en);
364*696d9d5cSGreg Roach        self::assertRelationships('first cousin', 'first cousin', [$i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en);
365*696d9d5cSGreg Roach        self::assertRelationships('second cousin', 'second cousin', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m], $en);
366*696d9d5cSGreg Roach        self::assertRelationships('first cousin once removed ascending', 'first cousin once removed descending', [$i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f], $en);
367*696d9d5cSGreg Roach        self::assertRelationships('third cousin', 'third cousin', [$i11m, $f7, $i17f, $f8, $i18m, $f9, $i21f, $f10, $i24m, $f11m, $i26f, $f12, $i29m, $f15, $i34f], $en);
368*696d9d5cSGreg 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);
369*696d9d5cSGreg 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);
370*696d9d5cSGreg 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);
371*696d9d5cSGreg 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);
372*696d9d5cSGreg 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);
373*696d9d5cSGreg 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);        // Compound relationships
374*696d9d5cSGreg Roach        self::assertRelationships('wife’s ex-husband', 'ex-wife’s husband', [$i1m, $f1m, $i2f, $f2d, $i6m], $sk);
375a004d330SGreg Roach    }
376a004d330SGreg Roach
377a004d330SGreg Roach    /**
378a004d330SGreg Roach     * @param string                  $expected
379a004d330SGreg Roach     * @param array                   $nodes
380a004d330SGreg Roach     * @param ModuleLanguageInterface $language
381a004d330SGreg Roach     */
382a004d330SGreg Roach    private static function assertRelationship(string $expected, array $nodes, ModuleLanguageInterface $language): void
383a004d330SGreg Roach    {
384a004d330SGreg Roach        $service = new RelationshipService();
385a004d330SGreg Roach        $actual  = $service->nameFromPath($nodes, $language);
386a004d330SGreg Roach        $path    = implode('-', array_map(fn (GedcomRecord $record): string => $record->xref(), $nodes));
387a004d330SGreg Roach        $english = $service->nameFromPath($nodes, new LanguageEnglishUnitedStates());
388a004d330SGreg Roach        $message = 'Language: ' . $language->title() . PHP_EOL . 'Path: ' . $path . ' (' . $english . ')';
389a004d330SGreg Roach
390a004d330SGreg Roach        self::assertSame($expected, $actual, $message);
391a004d330SGreg Roach    }
392a004d330SGreg Roach
393a004d330SGreg Roach    /**
394a004d330SGreg Roach     * Test a relationship name in both directions
395a004d330SGreg Roach     *
396a004d330SGreg Roach     * @param string                  $fwd
397a004d330SGreg Roach     * @param string                  $rev
398a004d330SGreg Roach     * @param array                   $nodes
399a004d330SGreg Roach     * @param ModuleLanguageInterface $language
400a004d330SGreg Roach     */
401a004d330SGreg Roach    private static function assertRelationships(string $fwd, string $rev, array $nodes, ModuleLanguageInterface $language): void
402a004d330SGreg Roach    {
403a004d330SGreg Roach        self::assertRelationship($fwd, $nodes, $language);
404a004d330SGreg Roach        self::assertRelationship($rev, array_reverse($nodes), $language);
4056fcafd02SGreg Roach    }
4066fcafd02SGreg Roach}
407