xref: /webtrees/tests/app/SurnameTradition/PolishSurnameTraditionTest.php (revision 83c91e47e8062fedee3ea4cf18b5828ff8995aac)
1323788f4SGreg Roach<?php
23976b470SGreg Roach
3323788f4SGreg Roach/**
4323788f4SGreg Roach * webtrees: online genealogy
589f7189bSGreg Roach * Copyright (C) 2021 webtrees development team
6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify
7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by
8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9323788f4SGreg Roach * (at your option) any later version.
10323788f4SGreg Roach * This program is distributed in the hope that it will be useful,
11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13323788f4SGreg Roach * GNU General Public License for more details.
14323788f4SGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16323788f4SGreg Roach */
17fcfa147eSGreg Roach
18e7f56f2aSGreg Roachdeclare(strict_types=1);
19e7f56f2aSGreg Roach
2084e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition;
21c1010edaSGreg Roach
22cb7a42eaSGreg Roachuse Fisharebest\Webtrees\Fact;
23cb7a42eaSGreg Roachuse Fisharebest\Webtrees\Individual;
243cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
25cb7a42eaSGreg Roachuse Illuminate\Support\Collection;
263cfcc809SGreg Roach
27323788f4SGreg Roach/**
28c4943cffSGreg Roach * Test harness for the class PolishSurnameTradition
29323788f4SGreg Roach */
303cfcc809SGreg Roachclass PolishSurnameTraditionTest extends TestCase
31c1010edaSGreg Roach{
32c4943cffSGreg Roach    private SurnameTraditionInterface $surname_tradition;
33323788f4SGreg Roach
34323788f4SGreg Roach    /**
35323788f4SGreg Roach     * Test whether married surnames are used
3617d74f3aSGreg Roach     *
3715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
3815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
3952348eb8SGreg Roach     *
4052348eb8SGreg Roach     * @return void
41323788f4SGreg Roach     */
429b802b22SGreg Roach    public function testMarriedSurnames(): void
43c1010edaSGreg Roach    {
445e933c21SGreg Roach        self::assertTrue($this->surname_tradition->hasMarriedNames());
45323788f4SGreg Roach    }
46323788f4SGreg Roach
47323788f4SGreg Roach    /**
48c1ec7145SGreg Roach     * Test whether surnames are used
4917d74f3aSGreg Roach     *
5015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
5115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
5252348eb8SGreg Roach     *
5352348eb8SGreg Roach     * @return void
54c1ec7145SGreg Roach     */
559b802b22SGreg Roach    public function testSurnames(): void
56c1010edaSGreg Roach    {
575e933c21SGreg Roach        self::assertTrue($this->surname_tradition->hasSurnames());
58c1ec7145SGreg Roach    }
59c1ec7145SGreg Roach
60c1ec7145SGreg Roach    /**
61323788f4SGreg Roach     * Test new son names
6217d74f3aSGreg Roach     *
6315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
6415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
6552348eb8SGreg Roach     *
6652348eb8SGreg Roach     * @return void
67323788f4SGreg Roach     */
689b802b22SGreg Roach    public function testNewSonNames(): void
69c1010edaSGreg Roach    {
70cb7a42eaSGreg Roach        $father_fact = $this->createStub(Fact::class);
71*83c91e47SGreg Roach        $father_fact->method('value')->willReturn('John /White/');
72cb7a42eaSGreg Roach
73cb7a42eaSGreg Roach        $father = $this->createStub(Individual::class);
74*83c91e47SGreg Roach        $father->method('facts')->willReturn(new Collection([$father_fact]));
75cb7a42eaSGreg Roach
76cb7a42eaSGreg Roach        $mother_fact = $this->createStub(Fact::class);
77*83c91e47SGreg Roach        $mother_fact->method('value')->willReturn('Mary /Black/');
78cb7a42eaSGreg Roach
79cb7a42eaSGreg Roach        $mother = $this->createStub(Individual::class);
80*83c91e47SGreg Roach        $mother->method('facts')->willReturn(new Collection([$mother_fact]));
81cb7a42eaSGreg Roach
825e933c21SGreg Roach        self::assertSame(
83cb7a42eaSGreg Roach            ["1 NAME /White/\n2 TYPE birth\n2 SURN White"],
84cb7a42eaSGreg Roach            $this->surname_tradition->newChildNames($father, $mother, 'M')
85323788f4SGreg Roach        );
86323788f4SGreg Roach    }
87323788f4SGreg Roach
88323788f4SGreg Roach    /**
89323788f4SGreg Roach     * Test new daughter names
9017d74f3aSGreg Roach     *
9115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
9215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
9352348eb8SGreg Roach     *
9452348eb8SGreg Roach     * @return void
95323788f4SGreg Roach     */
969b802b22SGreg Roach    public function testNewDaughterNames(): void
97c1010edaSGreg Roach    {
98cb7a42eaSGreg Roach        $father_fact = $this->createStub(Fact::class);
99*83c91e47SGreg Roach        $father_fact->method('value')->willReturn('John /White/');
100cb7a42eaSGreg Roach
101cb7a42eaSGreg Roach        $father = $this->createStub(Individual::class);
102*83c91e47SGreg Roach        $father->method('facts')->willReturn(new Collection([$father_fact]));
103cb7a42eaSGreg Roach
104cb7a42eaSGreg Roach        $mother_fact = $this->createStub(Fact::class);
105*83c91e47SGreg Roach        $mother_fact->method('value')->willReturn('Mary /Black/');
106cb7a42eaSGreg Roach
107cb7a42eaSGreg Roach        $mother = $this->createStub(Individual::class);
108*83c91e47SGreg Roach        $mother->method('facts')->willReturn(new Collection([$mother_fact]));
109cb7a42eaSGreg Roach
1105e933c21SGreg Roach        self::assertSame(
111cb7a42eaSGreg Roach            ["1 NAME /White/\n2 TYPE birth\n2 SURN White"],
112cb7a42eaSGreg Roach            $this->surname_tradition->newChildNames($father, $mother, 'F')
113323788f4SGreg Roach        );
114323788f4SGreg Roach    }
115323788f4SGreg Roach
116323788f4SGreg Roach    /**
117323788f4SGreg Roach     * Test new daughter names
11817d74f3aSGreg Roach     *
11915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
12015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
12152348eb8SGreg Roach     *
12252348eb8SGreg Roach     * @return void
123323788f4SGreg Roach     */
1249b802b22SGreg Roach    public function testNewDaughterNamesInflected(): void
125c1010edaSGreg Roach    {
126cb7a42eaSGreg Roach        $father_fact = $this->createStub(Fact::class);
127*83c91e47SGreg Roach        $father_fact->method('value')->willReturn('John /Whitecki/');
128cb7a42eaSGreg Roach
129cb7a42eaSGreg Roach        $father = $this->createStub(Individual::class);
130*83c91e47SGreg Roach        $father->method('facts')->willReturn(new Collection([$father_fact]));
131cb7a42eaSGreg Roach
132cb7a42eaSGreg Roach        $mother_fact = $this->createStub(Fact::class);
133*83c91e47SGreg Roach        $mother_fact->method('value')->willReturn('Mary /Black/');
134cb7a42eaSGreg Roach
135cb7a42eaSGreg Roach        $mother = $this->createStub(Individual::class);
136*83c91e47SGreg Roach        $mother->method('facts')->willReturn(new Collection([$mother_fact]));
137cb7a42eaSGreg Roach
1385e933c21SGreg Roach        self::assertSame(
139cb7a42eaSGreg Roach            ["1 NAME /Whitecka/\n2 TYPE birth\n2 SURN Whitecki"],
140cb7a42eaSGreg Roach            $this->surname_tradition->newChildNames($father, $mother, 'F')
141323788f4SGreg Roach        );
142cb7a42eaSGreg Roach
143cb7a42eaSGreg Roach        $father_fact = $this->createStub(Fact::class);
144*83c91e47SGreg Roach        $father_fact->method('value')->willReturn('John /Whitedzki/');
145cb7a42eaSGreg Roach
146cb7a42eaSGreg Roach        $father = $this->createStub(Individual::class);
147*83c91e47SGreg Roach        $father->method('facts')->willReturn(new Collection([$father_fact]));
148cb7a42eaSGreg Roach
149cb7a42eaSGreg Roach        $mother_fact = $this->createStub(Fact::class);
150*83c91e47SGreg Roach        $mother_fact->method('value')->willReturn('Mary /Black/');
151cb7a42eaSGreg Roach
152cb7a42eaSGreg Roach        $mother = $this->createStub(Individual::class);
153*83c91e47SGreg Roach        $mother->method('facts')->willReturn(new Collection([$mother_fact]));
154cb7a42eaSGreg Roach
1555e933c21SGreg Roach        self::assertSame(
156cb7a42eaSGreg Roach            ["1 NAME /Whitedzka/\n2 TYPE birth\n2 SURN Whitedzki"],
157cb7a42eaSGreg Roach            $this->surname_tradition->newChildNames($father, $mother, 'F')
158323788f4SGreg Roach        );
159cb7a42eaSGreg Roach
160cb7a42eaSGreg Roach        $father_fact = $this->createStub(Fact::class);
161*83c91e47SGreg Roach        $father_fact->method('value')->willReturn('John /Whiteski/');
162cb7a42eaSGreg Roach
163cb7a42eaSGreg Roach        $father = $this->createStub(Individual::class);
164*83c91e47SGreg Roach        $father->method('facts')->willReturn(new Collection([$father_fact]));
165cb7a42eaSGreg Roach
166cb7a42eaSGreg Roach        $mother_fact = $this->createStub(Fact::class);
167*83c91e47SGreg Roach        $mother_fact->method('value')->willReturn('Mary /Black/');
168cb7a42eaSGreg Roach
169cb7a42eaSGreg Roach        $mother = $this->createStub(Individual::class);
170*83c91e47SGreg Roach        $mother->method('facts')->willReturn(new Collection([$mother_fact]));
171cb7a42eaSGreg Roach
1725e933c21SGreg Roach        self::assertSame(
173cb7a42eaSGreg Roach            ["1 NAME /Whiteska/\n2 TYPE birth\n2 SURN Whiteski"],
174cb7a42eaSGreg Roach            $this->surname_tradition->newChildNames($father, $mother, 'F')
175323788f4SGreg Roach        );
176cb7a42eaSGreg Roach
177cb7a42eaSGreg Roach        $father_fact = $this->createStub(Fact::class);
178*83c91e47SGreg Roach        $father_fact->method('value')->willReturn('John /Whiteżki/');
179cb7a42eaSGreg Roach
180cb7a42eaSGreg Roach        $father = $this->createStub(Individual::class);
181*83c91e47SGreg Roach        $father->method('facts')->willReturn(new Collection([$father_fact]));
182cb7a42eaSGreg Roach
183cb7a42eaSGreg Roach        $mother_fact = $this->createStub(Fact::class);
184*83c91e47SGreg Roach        $mother_fact->method('value')->willReturn('Mary /Black/');
185cb7a42eaSGreg Roach
186cb7a42eaSGreg Roach        $mother = $this->createStub(Individual::class);
187*83c91e47SGreg Roach        $mother->method('facts')->willReturn(new Collection([$mother_fact]));
188cb7a42eaSGreg Roach
1895e933c21SGreg Roach        self::assertSame(
190cb7a42eaSGreg Roach            ["1 NAME /Whiteżka/\n2 TYPE birth\n2 SURN Whiteżki"],
191cb7a42eaSGreg Roach            $this->surname_tradition->newChildNames($father, $mother, 'F')
192323788f4SGreg Roach        );
193323788f4SGreg Roach    }
194323788f4SGreg Roach
195323788f4SGreg Roach    /**
196323788f4SGreg Roach     * Test new child names
19717d74f3aSGreg Roach     *
19815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
19915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
20052348eb8SGreg Roach     *
20152348eb8SGreg Roach     * @return void
202323788f4SGreg Roach     */
2039b802b22SGreg Roach    public function testNewChildNames(): void
204c1010edaSGreg Roach    {
205cb7a42eaSGreg Roach        $father_fact = $this->createStub(Fact::class);
206*83c91e47SGreg Roach        $father_fact->method('value')->willReturn('John /White/');
207cb7a42eaSGreg Roach
208cb7a42eaSGreg Roach        $father = $this->createStub(Individual::class);
209*83c91e47SGreg Roach        $father->method('facts')->willReturn(new Collection([$father_fact]));
210cb7a42eaSGreg Roach
211cb7a42eaSGreg Roach        $mother_fact = $this->createStub(Fact::class);
212*83c91e47SGreg Roach        $mother_fact->method('value')->willReturn('Mary /Black/');
213cb7a42eaSGreg Roach
214cb7a42eaSGreg Roach        $mother = $this->createStub(Individual::class);
215*83c91e47SGreg Roach        $mother->method('facts')->willReturn(new Collection([$mother_fact]));
216cb7a42eaSGreg Roach
2175e933c21SGreg Roach        self::assertSame(
218cb7a42eaSGreg Roach            ["1 NAME /White/\n2 TYPE birth\n2 SURN White"],
219cb7a42eaSGreg Roach            $this->surname_tradition->newChildNames($father, $mother, 'U')
220323788f4SGreg Roach        );
221323788f4SGreg Roach    }
222323788f4SGreg Roach
223323788f4SGreg Roach    /**
2241677a03aSGreg Roach     * Test new child names
22517d74f3aSGreg Roach     *
22615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
22715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
22852348eb8SGreg Roach     *
22952348eb8SGreg Roach     * @return void
2301677a03aSGreg Roach     */
2319b802b22SGreg Roach    public function testNewChildNamesWithNoParentsNames(): void
232c1010edaSGreg Roach    {
2335e933c21SGreg Roach        self::assertSame(
234cb7a42eaSGreg Roach            ["1 NAME //\n2 TYPE birth"],
235cb7a42eaSGreg Roach            $this->surname_tradition->newChildNames(null, null, 'U')
2361677a03aSGreg Roach        );
2371677a03aSGreg Roach    }
2381677a03aSGreg Roach
2391677a03aSGreg Roach    /**
240323788f4SGreg Roach     * Test new father names
24117d74f3aSGreg Roach     *
24215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
24315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
24452348eb8SGreg Roach     *
24552348eb8SGreg Roach     * @return void
246323788f4SGreg Roach     */
2479b802b22SGreg Roach    public function testNewFatherNames(): void
248c1010edaSGreg Roach    {
249cb7a42eaSGreg Roach        $fact = $this->createStub(Fact::class);
250*83c91e47SGreg Roach        $fact->method('value')->willReturn('Chris /White/');
251cb7a42eaSGreg Roach
252cb7a42eaSGreg Roach        $individual = $this->createStub(Individual::class);
253*83c91e47SGreg Roach        $individual->method('facts')->willReturn(new Collection([$fact]));
254cb7a42eaSGreg Roach
2555e933c21SGreg Roach        self::assertSame(
256cb7a42eaSGreg Roach            ["1 NAME /White/\n2 TYPE birth\n2 SURN White"],
257cb7a42eaSGreg Roach            $this->surname_tradition->newParentNames($individual, 'M')
258323788f4SGreg Roach        );
259323788f4SGreg Roach    }
260323788f4SGreg Roach
261323788f4SGreg Roach    /**
262323788f4SGreg Roach     * Test new father names
26317d74f3aSGreg Roach     *
26415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
26515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
26652348eb8SGreg Roach     *
26752348eb8SGreg Roach     * @return void
268323788f4SGreg Roach     */
2699b802b22SGreg Roach    public function testNewFatherNamesInflected(): void
270c1010edaSGreg Roach    {
271cb7a42eaSGreg Roach        $fact = $this->createStub(Fact::class);
272*83c91e47SGreg Roach        $fact->method('value')->willReturn('Chris /Whitecka/');
273cb7a42eaSGreg Roach
274cb7a42eaSGreg Roach        $individual = $this->createStub(Individual::class);
275*83c91e47SGreg Roach        $individual->method('facts')->willReturn(new Collection([$fact]));
276cb7a42eaSGreg Roach
2775e933c21SGreg Roach        self::assertSame(
278cb7a42eaSGreg Roach            ["1 NAME /Whitecki/\n2 TYPE birth\n2 SURN Whitecki"],
279cb7a42eaSGreg Roach            $this->surname_tradition->newParentNames($individual, 'M')
280323788f4SGreg Roach        );
281cb7a42eaSGreg Roach
282cb7a42eaSGreg Roach        $fact = $this->createStub(Fact::class);
283*83c91e47SGreg Roach        $fact->method('value')->willReturn('Chris /Whitedzka/');
284cb7a42eaSGreg Roach
285cb7a42eaSGreg Roach        $individual = $this->createStub(Individual::class);
286*83c91e47SGreg Roach        $individual->method('facts')->willReturn(new Collection([$fact]));
287cb7a42eaSGreg Roach
2885e933c21SGreg Roach        self::assertSame(
289cb7a42eaSGreg Roach            ["1 NAME /Whitedzki/\n2 TYPE birth\n2 SURN Whitedzki"],
290cb7a42eaSGreg Roach            $this->surname_tradition->newParentNames($individual, 'M')
291323788f4SGreg Roach        );
292cb7a42eaSGreg Roach
293cb7a42eaSGreg Roach        $fact = $this->createStub(Fact::class);
294*83c91e47SGreg Roach        $fact->method('value')->willReturn('Chris /Whiteska/');
295cb7a42eaSGreg Roach
296cb7a42eaSGreg Roach        $individual = $this->createStub(Individual::class);
297*83c91e47SGreg Roach        $individual->method('facts')->willReturn(new Collection([$fact]));
298cb7a42eaSGreg Roach
2995e933c21SGreg Roach        self::assertSame(
300cb7a42eaSGreg Roach            ["1 NAME /Whiteski/\n2 TYPE birth\n2 SURN Whiteski"],
301cb7a42eaSGreg Roach            $this->surname_tradition->newParentNames($individual, 'M')
302323788f4SGreg Roach        );
303cb7a42eaSGreg Roach
304cb7a42eaSGreg Roach        $fact = $this->createStub(Fact::class);
305*83c91e47SGreg Roach        $fact->method('value')->willReturn('Chris /Whiteżka/');
306cb7a42eaSGreg Roach
307cb7a42eaSGreg Roach        $individual = $this->createStub(Individual::class);
308*83c91e47SGreg Roach        $individual->method('facts')->willReturn(new Collection([$fact]));
309cb7a42eaSGreg Roach
3105e933c21SGreg Roach        self::assertSame(
311cb7a42eaSGreg Roach            ["1 NAME /Whiteżki/\n2 TYPE birth\n2 SURN Whiteżki"],
312cb7a42eaSGreg Roach            $this->surname_tradition->newParentNames($individual, 'M')
313323788f4SGreg Roach        );
314323788f4SGreg Roach    }
315323788f4SGreg Roach
316323788f4SGreg Roach    /**
317323788f4SGreg Roach     * Test new mother names
31817d74f3aSGreg Roach     *
31915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
32015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
32152348eb8SGreg Roach     *
32252348eb8SGreg Roach     * @return void
323323788f4SGreg Roach     */
3249b802b22SGreg Roach    public function testNewMotherNames(): void
325c1010edaSGreg Roach    {
326cb7a42eaSGreg Roach        $fact = $this->createStub(Fact::class);
327*83c91e47SGreg Roach        $fact->method('value')->willReturn('Chris /White/');
328cb7a42eaSGreg Roach
329cb7a42eaSGreg Roach        $individual = $this->createStub(Individual::class);
330*83c91e47SGreg Roach        $individual->method('facts')->willReturn(new Collection([$fact]));
331cb7a42eaSGreg Roach
3325e933c21SGreg Roach        self::assertSame(
333cb7a42eaSGreg Roach            ["1 NAME //\n2 TYPE birth"],
334cb7a42eaSGreg Roach            $this->surname_tradition->newParentNames($individual, 'F')
335323788f4SGreg Roach        );
336323788f4SGreg Roach    }
337323788f4SGreg Roach
338323788f4SGreg Roach    /**
339323788f4SGreg Roach     * Test new parent names
34017d74f3aSGreg Roach     *
34115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
34215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
34352348eb8SGreg Roach     *
34452348eb8SGreg Roach     * @return void
345323788f4SGreg Roach     */
3469b802b22SGreg Roach    public function testNewParentNames(): void
347c1010edaSGreg Roach    {
348cb7a42eaSGreg Roach        $fact = $this->createStub(Fact::class);
349*83c91e47SGreg Roach        $fact->method('value')->willReturn('Chris /White/');
350323788f4SGreg Roach
351cb7a42eaSGreg Roach        $individual = $this->createStub(Individual::class);
352*83c91e47SGreg Roach        $individual->method('facts')->willReturn(new Collection([$fact]));
353323788f4SGreg Roach
3545e933c21SGreg Roach        self::assertSame(
355cb7a42eaSGreg Roach            ["1 NAME //\n2 TYPE birth"],
356cb7a42eaSGreg Roach            $this->surname_tradition->newParentNames($individual, 'U')
357323788f4SGreg Roach        );
358323788f4SGreg Roach    }
359323788f4SGreg Roach
360323788f4SGreg Roach    /**
361323788f4SGreg Roach     * Test new spouse names
36217d74f3aSGreg Roach     *
36315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PolishSurnameTradition
36415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\SurnameTradition\PatrilinealSurnameTradition
36552348eb8SGreg Roach     *
36652348eb8SGreg Roach     * @return void
367323788f4SGreg Roach     */
3689b802b22SGreg Roach    public function testNewSpouseNames(): void
369c1010edaSGreg Roach    {
370cb7a42eaSGreg Roach        $fact = $this->createStub(Fact::class);
371*83c91e47SGreg Roach        $fact->method('value')->willReturn('Chris /White/');
372cb7a42eaSGreg Roach
373cb7a42eaSGreg Roach        $individual = $this->createStub(Individual::class);
374*83c91e47SGreg Roach        $individual->method('facts')->willReturn(new Collection([$fact]));
375cb7a42eaSGreg Roach
3765e933c21SGreg Roach        self::assertSame(
377cb7a42eaSGreg Roach            ["1 NAME //\n2 TYPE birth"],
378cb7a42eaSGreg Roach            $this->surname_tradition->newSpouseNames($individual, 'M')
379323788f4SGreg Roach        );
380cb7a42eaSGreg Roach
381cb7a42eaSGreg Roach        self::assertSame(
382cb7a42eaSGreg Roach            ["1 NAME //\n2 TYPE birth", "1 NAME /White/\n2 TYPE married\n2 SURN White"],
383cb7a42eaSGreg Roach            $this->surname_tradition->newSpouseNames($individual, 'F')
384cb7a42eaSGreg Roach        );
385cb7a42eaSGreg Roach
386cb7a42eaSGreg Roach        self::assertSame(
387cb7a42eaSGreg Roach            ["1 NAME //\n2 TYPE birth"],
388cb7a42eaSGreg Roach            $this->surname_tradition->newSpouseNames($individual, 'U')
389cb7a42eaSGreg Roach        );
390cb7a42eaSGreg Roach    }
391cb7a42eaSGreg Roach
392cb7a42eaSGreg Roach    /**
393cb7a42eaSGreg Roach     * Prepare the environment for these tests
394cb7a42eaSGreg Roach     *
395cb7a42eaSGreg Roach     * @return void
396cb7a42eaSGreg Roach     */
397cb7a42eaSGreg Roach    protected function setUp(): void
398cb7a42eaSGreg Roach    {
399cb7a42eaSGreg Roach        parent::setUp();
400cb7a42eaSGreg Roach
401cb7a42eaSGreg Roach        $this->surname_tradition = new PolishSurnameTradition();
402323788f4SGreg Roach    }
403323788f4SGreg Roach}
404