xref: /webtrees/tests/app/Census/CensusColumnBornForeignPartsTest.php (revision 3cfcc809af53e831fa6cafac7b274a2cb407db6e)
1db7d25eeSGreg Roach<?php
23976b470SGreg Roach
3db7d25eeSGreg Roach/**
4db7d25eeSGreg Roach * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
6db7d25eeSGreg Roach * This program is free software: you can redistribute it and/or modify
7db7d25eeSGreg Roach * it under the terms of the GNU General Public License as published by
8db7d25eeSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9db7d25eeSGreg Roach * (at your option) any later version.
10db7d25eeSGreg Roach * This program is distributed in the hope that it will be useful,
11db7d25eeSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12db7d25eeSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13db7d25eeSGreg Roach * GNU General Public License for more details.
14db7d25eeSGreg Roach * You should have received a copy of the GNU General Public License
15db7d25eeSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16db7d25eeSGreg Roach */
17e7f56f2aSGreg Roachdeclare(strict_types=1);
18e7f56f2aSGreg Roach
19db7d25eeSGreg Roachnamespace Fisharebest\Webtrees\Census;
20db7d25eeSGreg Roach
21ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
2252348eb8SGreg Roachuse Fisharebest\Webtrees\Place;
23*3cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase;
24392561bbSGreg Roachuse Illuminate\Support\Collection;
25db7d25eeSGreg Roach
26db7d25eeSGreg Roach/**
27db7d25eeSGreg Roach * Test harness for the class CensusColumnBornForeignParts
28db7d25eeSGreg Roach */
29*3cfcc809SGreg Roachclass CensusColumnBornForeignPartsTest extends TestCase
30c1010edaSGreg Roach{
31db7d25eeSGreg Roach    /**
3216d0b7f7SRico Sonntag     * Get place mock.
3316d0b7f7SRico Sonntag     *
3416d0b7f7SRico Sonntag     * @param string $place Gedcom Place
3516d0b7f7SRico Sonntag     *
3652348eb8SGreg Roach     * @return Place
3716d0b7f7SRico Sonntag     */
3852348eb8SGreg Roach    private function getPlaceMock($place): Place
39c1010edaSGreg Roach    {
4016d0b7f7SRico Sonntag        $placeParts = explode(', ', $place);
4116d0b7f7SRico Sonntag
420ecdbde6SGreg Roach        $placeMock = $this->createMock(Place::class);
430ecdbde6SGreg Roach        $placeMock->method('gedcomName')->willReturn($place);
440ecdbde6SGreg Roach        $placeMock->method('lastParts')->willReturn((new Collection($placeParts))->slice(-1));
4516d0b7f7SRico Sonntag
4616d0b7f7SRico Sonntag        return $placeMock;
4716d0b7f7SRico Sonntag    }
4816d0b7f7SRico Sonntag
4916d0b7f7SRico Sonntag    /**
5015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
5115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
5252348eb8SGreg Roach     *
5352348eb8SGreg Roach     * @return void
54db7d25eeSGreg Roach     */
559b802b22SGreg Roach    public function testBornEnglandCensusEngland(): void
56c1010edaSGreg Roach    {
570ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
580ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('London, England'));
59db7d25eeSGreg Roach
600ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
610ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('England');
62db7d25eeSGreg Roach
63ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
64db7d25eeSGreg Roach
65342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
66db7d25eeSGreg Roach    }
67db7d25eeSGreg Roach
68db7d25eeSGreg Roach    /**
6915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
7015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
7152348eb8SGreg Roach     *
7252348eb8SGreg Roach     * @return void
73db7d25eeSGreg Roach     */
749b802b22SGreg Roach    public function testBornWalesCensusEngland(): void
75c1010edaSGreg Roach    {
760ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
770ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Cardiff, Wales'));
78db7d25eeSGreg Roach
790ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
800ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('England');
81db7d25eeSGreg Roach
82ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
83db7d25eeSGreg Roach
84342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
85db7d25eeSGreg Roach    }
86db7d25eeSGreg Roach
87db7d25eeSGreg Roach    /**
8815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
8915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
9052348eb8SGreg Roach     *
9152348eb8SGreg Roach     * @return void
92db7d25eeSGreg Roach     */
939b802b22SGreg Roach    public function testBornScotlandCensusEngland(): void
94c1010edaSGreg Roach    {
950ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
960ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Edinburgh, Scotland'));
97db7d25eeSGreg Roach
980ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
990ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('England');
100db7d25eeSGreg Roach
101ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
102db7d25eeSGreg Roach
103342dcecdSGreg Roach        $this->assertSame('S', $column->generate($individual, $individual));
104db7d25eeSGreg Roach    }
105db7d25eeSGreg Roach
106db7d25eeSGreg Roach    /**
10715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
10815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
10952348eb8SGreg Roach     *
11052348eb8SGreg Roach     * @return void
111db7d25eeSGreg Roach     */
1129b802b22SGreg Roach    public function testBornIrelandCensusEngland(): void
113c1010edaSGreg Roach    {
1140ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1150ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Dublin, Ireland'));
116db7d25eeSGreg Roach
1170ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
1180ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('England');
119db7d25eeSGreg Roach
120ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
121db7d25eeSGreg Roach
122342dcecdSGreg Roach        $this->assertSame('I', $column->generate($individual, $individual));
123db7d25eeSGreg Roach    }
124db7d25eeSGreg Roach
125db7d25eeSGreg Roach    /**
12615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
12715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
12852348eb8SGreg Roach     *
12952348eb8SGreg Roach     * @return void
130db7d25eeSGreg Roach     */
1319b802b22SGreg Roach    public function testBornForeignCensusEngland(): void
132c1010edaSGreg Roach    {
1330ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1340ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Elbonia'));
135db7d25eeSGreg Roach
1360ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
1370ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('England');
138db7d25eeSGreg Roach
139ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
140db7d25eeSGreg Roach
141342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
142db7d25eeSGreg Roach    }
143db7d25eeSGreg Roach
144db7d25eeSGreg Roach    /**
14515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
14615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
14752348eb8SGreg Roach     *
14852348eb8SGreg Roach     * @return void
149db7d25eeSGreg Roach     */
1509b802b22SGreg Roach    public function testBornEnglandCensusIreland(): void
151c1010edaSGreg Roach    {
1520ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1530ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('London, England'));
154db7d25eeSGreg Roach
1550ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
1560ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Ireland');
157db7d25eeSGreg Roach
158ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
159db7d25eeSGreg Roach
160342dcecdSGreg Roach        $this->assertSame('E', $column->generate($individual, $individual));
161db7d25eeSGreg Roach    }
162db7d25eeSGreg Roach
163db7d25eeSGreg Roach    /**
16415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
16515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
16652348eb8SGreg Roach     *
16752348eb8SGreg Roach     * @return void
168db7d25eeSGreg Roach     */
1699b802b22SGreg Roach    public function testBornWalesCensusIreland(): void
170c1010edaSGreg Roach    {
1710ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1720ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Cardiff, Wales'));
173db7d25eeSGreg Roach
1740ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
1750ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Ireland');
176db7d25eeSGreg Roach
177ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
178db7d25eeSGreg Roach
179342dcecdSGreg Roach        $this->assertSame('E', $column->generate($individual, $individual));
180db7d25eeSGreg Roach    }
181db7d25eeSGreg Roach
182db7d25eeSGreg Roach    /**
18315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
18415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
18552348eb8SGreg Roach     *
18652348eb8SGreg Roach     * @return void
187db7d25eeSGreg Roach     */
1889b802b22SGreg Roach    public function testBornScotlandCensusIreland(): void
189c1010edaSGreg Roach    {
1900ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
1910ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Edinburgh, Scotland'));
192db7d25eeSGreg Roach
1930ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
1940ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Ireland');
195db7d25eeSGreg Roach
196ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
197db7d25eeSGreg Roach
198342dcecdSGreg Roach        $this->assertSame('S', $column->generate($individual, $individual));
199db7d25eeSGreg Roach    }
200db7d25eeSGreg Roach
201db7d25eeSGreg Roach    /**
20215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
20315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
20452348eb8SGreg Roach     *
20552348eb8SGreg Roach     * @return void
206db7d25eeSGreg Roach     */
2079b802b22SGreg Roach    public function testBornIrelandCensusIreland(): void
208c1010edaSGreg Roach    {
2090ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
2100ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Dublin, Ireland'));
211db7d25eeSGreg Roach
2120ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2130ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Ireland');
214db7d25eeSGreg Roach
215ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
216db7d25eeSGreg Roach
217342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
218db7d25eeSGreg Roach    }
219db7d25eeSGreg Roach
220db7d25eeSGreg Roach    /**
22115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
22215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
22352348eb8SGreg Roach     *
22452348eb8SGreg Roach     * @return void
225db7d25eeSGreg Roach     */
2269b802b22SGreg Roach    public function testBornForeignCensusIreland(): void
227c1010edaSGreg Roach    {
2280ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
2290ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Elbonia'));
230db7d25eeSGreg Roach
2310ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2320ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Ireland');
233db7d25eeSGreg Roach
234ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
235db7d25eeSGreg Roach
236342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
237db7d25eeSGreg Roach    }
238db7d25eeSGreg Roach
239db7d25eeSGreg Roach    /**
24015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
24115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
24252348eb8SGreg Roach     *
24352348eb8SGreg Roach     * @return void
244db7d25eeSGreg Roach     */
2459b802b22SGreg Roach    public function testBornEnglandCensusScotland(): void
246c1010edaSGreg Roach    {
2470ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
2480ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('London, England'));
249db7d25eeSGreg Roach
2500ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2510ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Scotland');
252db7d25eeSGreg Roach
253ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
254db7d25eeSGreg Roach
255342dcecdSGreg Roach        $this->assertSame('E', $column->generate($individual, $individual));
256db7d25eeSGreg Roach    }
257db7d25eeSGreg Roach
258db7d25eeSGreg Roach    /**
25915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
26015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
26152348eb8SGreg Roach     *
26252348eb8SGreg Roach     * @return void
263db7d25eeSGreg Roach     */
2649b802b22SGreg Roach    public function testBornWalesCensusScotland(): void
265c1010edaSGreg Roach    {
2660ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
2670ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Cardiff, Wales'));
268db7d25eeSGreg Roach
2690ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2700ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Scotland');
271db7d25eeSGreg Roach
272ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
273db7d25eeSGreg Roach
274342dcecdSGreg Roach        $this->assertSame('E', $column->generate($individual, $individual));
275db7d25eeSGreg Roach    }
276db7d25eeSGreg Roach
277db7d25eeSGreg Roach    /**
27815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
27915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
28052348eb8SGreg Roach     *
28152348eb8SGreg Roach     * @return void
282db7d25eeSGreg Roach     */
2839b802b22SGreg Roach    public function testBornScotlandCensusScotland(): void
284c1010edaSGreg Roach    {
2850ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
2860ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Edinburgh, Scotland'));
287db7d25eeSGreg Roach
2880ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
2890ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Scotland');
290db7d25eeSGreg Roach
291ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
292db7d25eeSGreg Roach
293342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
294db7d25eeSGreg Roach    }
295db7d25eeSGreg Roach
296db7d25eeSGreg Roach    /**
29715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
29815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
29952348eb8SGreg Roach     *
30052348eb8SGreg Roach     * @return void
301db7d25eeSGreg Roach     */
3029b802b22SGreg Roach    public function testBornIrelandCensusScotland(): void
303c1010edaSGreg Roach    {
3040ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
3050ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Dublin, Ireland'));
306db7d25eeSGreg Roach
3070ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
3080ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Scotland');
309db7d25eeSGreg Roach
310ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
311db7d25eeSGreg Roach
312342dcecdSGreg Roach        $this->assertSame('I', $column->generate($individual, $individual));
313db7d25eeSGreg Roach    }
314db7d25eeSGreg Roach
315db7d25eeSGreg Roach    /**
31615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
31715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
31852348eb8SGreg Roach     *
31952348eb8SGreg Roach     * @return void
320db7d25eeSGreg Roach     */
3219b802b22SGreg Roach    public function testBornForeignCensusScotland(): void
322c1010edaSGreg Roach    {
3230ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
3240ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Elbonia'));
325db7d25eeSGreg Roach
3260ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
3270ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Scotland');
328db7d25eeSGreg Roach
329ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
330db7d25eeSGreg Roach
331342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
332db7d25eeSGreg Roach    }
333db7d25eeSGreg Roach
334db7d25eeSGreg Roach    /**
33515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
33615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
33752348eb8SGreg Roach     *
33852348eb8SGreg Roach     * @return void
339db7d25eeSGreg Roach     */
3409b802b22SGreg Roach    public function testBornEnglandCensusWales(): void
341c1010edaSGreg Roach    {
3420ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
3430ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('London, England'));
344db7d25eeSGreg Roach
3450ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
3460ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Wales');
347db7d25eeSGreg Roach
348ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
349db7d25eeSGreg Roach
350342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
351db7d25eeSGreg Roach    }
352db7d25eeSGreg Roach
353db7d25eeSGreg Roach    /**
35415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
35515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
35652348eb8SGreg Roach     *
35752348eb8SGreg Roach     * @return void
358db7d25eeSGreg Roach     */
3599b802b22SGreg Roach    public function testBornWalesCensusWales(): void
360c1010edaSGreg Roach    {
3610ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
3620ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Cardiff, Wales'));
363db7d25eeSGreg Roach
3640ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
3650ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Wales');
366db7d25eeSGreg Roach
367ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
368db7d25eeSGreg Roach
369342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
370db7d25eeSGreg Roach    }
371db7d25eeSGreg Roach
372db7d25eeSGreg Roach    /**
37315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
37415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
37552348eb8SGreg Roach     *
37652348eb8SGreg Roach     * @return void
377db7d25eeSGreg Roach     */
3789b802b22SGreg Roach    public function testBornScotlandCensusWales(): void
379c1010edaSGreg Roach    {
3800ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
3810ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Edinburgh, Scotland'));
382db7d25eeSGreg Roach
3830ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
3840ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Wales');
385db7d25eeSGreg Roach
386ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
387db7d25eeSGreg Roach
388342dcecdSGreg Roach        $this->assertSame('S', $column->generate($individual, $individual));
389db7d25eeSGreg Roach    }
390db7d25eeSGreg Roach
391db7d25eeSGreg Roach    /**
39215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
39315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
39452348eb8SGreg Roach     *
39552348eb8SGreg Roach     * @return void
396db7d25eeSGreg Roach     */
3979b802b22SGreg Roach    public function testBornIrelandCensusWales(): void
398c1010edaSGreg Roach    {
3990ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
4000ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Dublin, Ireland'));
401db7d25eeSGreg Roach
4020ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
4030ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Wales');
404db7d25eeSGreg Roach
405ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
406db7d25eeSGreg Roach
407342dcecdSGreg Roach        $this->assertSame('I', $column->generate($individual, $individual));
408db7d25eeSGreg Roach    }
409db7d25eeSGreg Roach
410db7d25eeSGreg Roach    /**
41115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
41215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
41352348eb8SGreg Roach     *
41452348eb8SGreg Roach     * @return void
415db7d25eeSGreg Roach     */
4169b802b22SGreg Roach    public function testBornForeignCensusWales(): void
417c1010edaSGreg Roach    {
4180ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
4190ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Elbonia'));
420db7d25eeSGreg Roach
4210ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
4220ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Wales');
423db7d25eeSGreg Roach
424ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
425db7d25eeSGreg Roach
426342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
427db7d25eeSGreg Roach    }
428b164ca57SGreg Roach
429b164ca57SGreg Roach    /**
43015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
43115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
43252348eb8SGreg Roach     *
43352348eb8SGreg Roach     * @return void
434b164ca57SGreg Roach     */
4359b802b22SGreg Roach    public function testBornNowhereCensusEngland(): void
436c1010edaSGreg Roach    {
4370ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
4380ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock(''));
439b164ca57SGreg Roach
4400ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
4410ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('England');
442b164ca57SGreg Roach
443b164ca57SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
444b164ca57SGreg Roach
445342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
446b164ca57SGreg Roach    }
447b164ca57SGreg Roach
448b164ca57SGreg Roach    /**
44915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
45015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
45152348eb8SGreg Roach     *
45252348eb8SGreg Roach     * @return void
453b164ca57SGreg Roach     */
4549b802b22SGreg Roach    public function testBornNowhereCensusWales(): void
455c1010edaSGreg Roach    {
4560ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
4570ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock(''));
458b164ca57SGreg Roach
4590ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
4600ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Wales');
461b164ca57SGreg Roach
462b164ca57SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
463b164ca57SGreg Roach
464342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
465b164ca57SGreg Roach    }
466b164ca57SGreg Roach
467b164ca57SGreg Roach    /**
46815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
46915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
47052348eb8SGreg Roach     *
47152348eb8SGreg Roach     * @return void
472b164ca57SGreg Roach     */
4739b802b22SGreg Roach    public function testBornNowhereCensusScotland(): void
474c1010edaSGreg Roach    {
4750ecdbde6SGreg Roach        $individual = $this->createMock(Individual::class);
4760ecdbde6SGreg Roach        $individual->method('getBirthPlace')->willReturn($this->getPlaceMock(''));
477b164ca57SGreg Roach
4780ecdbde6SGreg Roach        $census = $this->createMock(CensusInterface::class);
4790ecdbde6SGreg Roach        $census->method('censusPlace')->willReturn('Scotland');
480b164ca57SGreg Roach
481b164ca57SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
482b164ca57SGreg Roach
483342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
484b164ca57SGreg Roach    }
485db7d25eeSGreg Roach}
486