xref: /webtrees/tests/app/Census/CensusColumnBornForeignPartsTest.php (revision 8fcd0d32e56ee262912bbdb593202cfd1cbc1615)
1db7d25eeSGreg Roach<?php
2db7d25eeSGreg Roach/**
3db7d25eeSGreg Roach * webtrees: online genealogy
4*8fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
5db7d25eeSGreg Roach * This program is free software: you can redistribute it and/or modify
6db7d25eeSGreg Roach * it under the terms of the GNU General Public License as published by
7db7d25eeSGreg Roach * the Free Software Foundation, either version 3 of the License, or
8db7d25eeSGreg Roach * (at your option) any later version.
9db7d25eeSGreg Roach * This program is distributed in the hope that it will be useful,
10db7d25eeSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11db7d25eeSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12db7d25eeSGreg Roach * GNU General Public License for more details.
13db7d25eeSGreg Roach * You should have received a copy of the GNU General Public License
14db7d25eeSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15db7d25eeSGreg Roach */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
18db7d25eeSGreg Roachnamespace Fisharebest\Webtrees\Census;
19db7d25eeSGreg Roach
20ddf438a5SGreg Roachuse Fisharebest\Webtrees\Individual;
2152348eb8SGreg Roachuse Fisharebest\Webtrees\Place;
22db7d25eeSGreg Roachuse Mockery;
23db7d25eeSGreg Roach
24db7d25eeSGreg Roach/**
25db7d25eeSGreg Roach * Test harness for the class CensusColumnBornForeignParts
26db7d25eeSGreg Roach */
2784e2cf4eSGreg Roachclass CensusColumnBornForeignPartsTest extends \Fisharebest\Webtrees\TestCase
28c1010edaSGreg Roach{
29db7d25eeSGreg Roach    /**
30db7d25eeSGreg Roach     * Delete mock objects
3152348eb8SGreg Roach     *
3252348eb8SGreg Roach     * @return void
33db7d25eeSGreg Roach     */
34c1010edaSGreg Roach    public function tearDown()
35c1010edaSGreg Roach    {
36db7d25eeSGreg Roach        Mockery::close();
37db7d25eeSGreg Roach    }
38db7d25eeSGreg Roach
39db7d25eeSGreg Roach    /**
4016d0b7f7SRico Sonntag     * Get place mock.
4116d0b7f7SRico Sonntag     *
4216d0b7f7SRico Sonntag     * @param string $place Gedcom Place
4316d0b7f7SRico Sonntag     *
4452348eb8SGreg Roach     * @return Place
4516d0b7f7SRico Sonntag     */
4652348eb8SGreg Roach    private function getPlaceMock($place): Place
47c1010edaSGreg Roach    {
4816d0b7f7SRico Sonntag        $placeParts = explode(', ', $place);
4916d0b7f7SRico Sonntag
50ddf438a5SGreg Roach        $placeMock = Mockery::mock(Place::class);
5116d0b7f7SRico Sonntag        $placeMock->shouldReceive('getGedcomName')->andReturn($place);
5216d0b7f7SRico Sonntag        $placeMock->shouldReceive('lastPart')->andReturn(end($placeParts));
5316d0b7f7SRico Sonntag
5416d0b7f7SRico Sonntag        return $placeMock;
5516d0b7f7SRico Sonntag    }
5616d0b7f7SRico Sonntag
5716d0b7f7SRico Sonntag    /**
5815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
5915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
6052348eb8SGreg Roach     *
6152348eb8SGreg Roach     * @return void
62db7d25eeSGreg Roach     */
63c1010edaSGreg Roach    public function testBornEnglandCensusEngland()
64c1010edaSGreg Roach    {
65ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
6616d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('London, England'));
67db7d25eeSGreg Roach
68ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
69db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('England');
70db7d25eeSGreg Roach
71ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
72db7d25eeSGreg Roach
73342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
74db7d25eeSGreg Roach    }
75db7d25eeSGreg Roach
76db7d25eeSGreg Roach    /**
7715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
7815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
7952348eb8SGreg Roach     *
8052348eb8SGreg Roach     * @return void
81db7d25eeSGreg Roach     */
82c1010edaSGreg Roach    public function testBornWalesCensusEngland()
83c1010edaSGreg Roach    {
84ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
8516d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Cardiff, Wales'));
86db7d25eeSGreg Roach
87ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
88db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('England');
89db7d25eeSGreg Roach
90ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
91db7d25eeSGreg Roach
92342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
93db7d25eeSGreg Roach    }
94db7d25eeSGreg Roach
95db7d25eeSGreg Roach    /**
9615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
9715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
9852348eb8SGreg Roach     *
9952348eb8SGreg Roach     * @return void
100db7d25eeSGreg Roach     */
101c1010edaSGreg Roach    public function testBornScotlandCensusEngland()
102c1010edaSGreg Roach    {
103ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
10416d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Edinburgh, Scotland'));
105db7d25eeSGreg Roach
106ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
107db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('England');
108db7d25eeSGreg Roach
109ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
110db7d25eeSGreg Roach
111342dcecdSGreg Roach        $this->assertSame('S', $column->generate($individual, $individual));
112db7d25eeSGreg Roach    }
113db7d25eeSGreg Roach
114db7d25eeSGreg Roach    /**
11515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
11615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
11752348eb8SGreg Roach     *
11852348eb8SGreg Roach     * @return void
119db7d25eeSGreg Roach     */
120c1010edaSGreg Roach    public function testBornIrelandCensusEngland()
121c1010edaSGreg Roach    {
122ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
12316d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Dublin, Ireland'));
124db7d25eeSGreg Roach
125ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
126db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('England');
127db7d25eeSGreg Roach
128ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
129db7d25eeSGreg Roach
130342dcecdSGreg Roach        $this->assertSame('I', $column->generate($individual, $individual));
131db7d25eeSGreg Roach    }
132db7d25eeSGreg Roach
133db7d25eeSGreg Roach    /**
13415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
13515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
13652348eb8SGreg Roach     *
13752348eb8SGreg Roach     * @return void
138db7d25eeSGreg Roach     */
139c1010edaSGreg Roach    public function testBornForeignCensusEngland()
140c1010edaSGreg Roach    {
141ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
14216d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Elbonia'));
143db7d25eeSGreg Roach
144ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
145db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('England');
146db7d25eeSGreg Roach
147ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
148db7d25eeSGreg Roach
149342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
150db7d25eeSGreg Roach    }
151db7d25eeSGreg Roach
152db7d25eeSGreg Roach    /**
15315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
15415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
15552348eb8SGreg Roach     *
15652348eb8SGreg Roach     * @return void
157db7d25eeSGreg Roach     */
158c1010edaSGreg Roach    public function testBornEnglandCensusIreland()
159c1010edaSGreg Roach    {
160ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
16116d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('London, England'));
162db7d25eeSGreg Roach
163ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
164db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Ireland');
165db7d25eeSGreg Roach
166ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
167db7d25eeSGreg Roach
168342dcecdSGreg Roach        $this->assertSame('E', $column->generate($individual, $individual));
169db7d25eeSGreg Roach    }
170db7d25eeSGreg Roach
171db7d25eeSGreg Roach    /**
17215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
17315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
17452348eb8SGreg Roach     *
17552348eb8SGreg Roach     * @return void
176db7d25eeSGreg Roach     */
177c1010edaSGreg Roach    public function testBornWalesCensusIreland()
178c1010edaSGreg Roach    {
179ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
18016d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Cardiff, Wales'));
181db7d25eeSGreg Roach
182ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
183db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Ireland');
184db7d25eeSGreg Roach
185ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
186db7d25eeSGreg Roach
187342dcecdSGreg Roach        $this->assertSame('E', $column->generate($individual, $individual));
188db7d25eeSGreg Roach    }
189db7d25eeSGreg Roach
190db7d25eeSGreg Roach    /**
19115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
19215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
19352348eb8SGreg Roach     *
19452348eb8SGreg Roach     * @return void
195db7d25eeSGreg Roach     */
196c1010edaSGreg Roach    public function testBornScotlandCensusIreland()
197c1010edaSGreg Roach    {
198ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
19916d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Edinburgh, Scotland'));
200db7d25eeSGreg Roach
201ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
202db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Ireland');
203db7d25eeSGreg Roach
204ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
205db7d25eeSGreg Roach
206342dcecdSGreg Roach        $this->assertSame('S', $column->generate($individual, $individual));
207db7d25eeSGreg Roach    }
208db7d25eeSGreg Roach
209db7d25eeSGreg Roach    /**
21015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
21115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
21252348eb8SGreg Roach     *
21352348eb8SGreg Roach     * @return void
214db7d25eeSGreg Roach     */
215c1010edaSGreg Roach    public function testBornIrelandCensusIreland()
216c1010edaSGreg Roach    {
217ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
21816d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Dublin, Ireland'));
219db7d25eeSGreg Roach
220ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
221db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Ireland');
222db7d25eeSGreg Roach
223ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
224db7d25eeSGreg Roach
225342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
226db7d25eeSGreg Roach    }
227db7d25eeSGreg Roach
228db7d25eeSGreg Roach    /**
22915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
23015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
23152348eb8SGreg Roach     *
23252348eb8SGreg Roach     * @return void
233db7d25eeSGreg Roach     */
234c1010edaSGreg Roach    public function testBornForeignCensusIreland()
235c1010edaSGreg Roach    {
236ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
23716d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Elbonia'));
238db7d25eeSGreg Roach
239ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
240db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Ireland');
241db7d25eeSGreg Roach
242ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
243db7d25eeSGreg Roach
244342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
245db7d25eeSGreg Roach    }
246db7d25eeSGreg Roach
247db7d25eeSGreg Roach    /**
24815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
24915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
25052348eb8SGreg Roach     *
25152348eb8SGreg Roach     * @return void
252db7d25eeSGreg Roach     */
253c1010edaSGreg Roach    public function testBornEnglandCensusScotland()
254c1010edaSGreg Roach    {
255ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
25616d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('London, England'));
257db7d25eeSGreg Roach
258ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
259db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Scotland');
260db7d25eeSGreg Roach
261ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
262db7d25eeSGreg Roach
263342dcecdSGreg Roach        $this->assertSame('E', $column->generate($individual, $individual));
264db7d25eeSGreg Roach    }
265db7d25eeSGreg Roach
266db7d25eeSGreg Roach    /**
26715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
26815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
26952348eb8SGreg Roach     *
27052348eb8SGreg Roach     * @return void
271db7d25eeSGreg Roach     */
272c1010edaSGreg Roach    public function testBornWalesCensusScotland()
273c1010edaSGreg Roach    {
274ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
27516d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Cardiff, Wales'));
276db7d25eeSGreg Roach
277ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
278db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Scotland');
279db7d25eeSGreg Roach
280ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
281db7d25eeSGreg Roach
282342dcecdSGreg Roach        $this->assertSame('E', $column->generate($individual, $individual));
283db7d25eeSGreg Roach    }
284db7d25eeSGreg Roach
285db7d25eeSGreg Roach    /**
28615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
28715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
28852348eb8SGreg Roach     *
28952348eb8SGreg Roach     * @return void
290db7d25eeSGreg Roach     */
291c1010edaSGreg Roach    public function testBornScotlandCensusScotland()
292c1010edaSGreg Roach    {
293ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
29416d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Edinburgh, Scotland'));
295db7d25eeSGreg Roach
296ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
297db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Scotland');
298db7d25eeSGreg Roach
299ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
300db7d25eeSGreg Roach
301342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
302db7d25eeSGreg Roach    }
303db7d25eeSGreg Roach
304db7d25eeSGreg Roach    /**
30515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
30615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
30752348eb8SGreg Roach     *
30852348eb8SGreg Roach     * @return void
309db7d25eeSGreg Roach     */
310c1010edaSGreg Roach    public function testBornIrelandCensusScotland()
311c1010edaSGreg Roach    {
312ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
31316d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Dublin, Ireland'));
314db7d25eeSGreg Roach
315ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
316db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Scotland');
317db7d25eeSGreg Roach
318ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
319db7d25eeSGreg Roach
320342dcecdSGreg Roach        $this->assertSame('I', $column->generate($individual, $individual));
321db7d25eeSGreg Roach    }
322db7d25eeSGreg Roach
323db7d25eeSGreg Roach    /**
32415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
32515d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
32652348eb8SGreg Roach     *
32752348eb8SGreg Roach     * @return void
328db7d25eeSGreg Roach     */
329c1010edaSGreg Roach    public function testBornForeignCensusScotland()
330c1010edaSGreg Roach    {
331ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
33216d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Elbonia'));
333db7d25eeSGreg Roach
334ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
335db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Scotland');
336db7d25eeSGreg Roach
337ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
338db7d25eeSGreg Roach
339342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
340db7d25eeSGreg Roach    }
341db7d25eeSGreg Roach
342db7d25eeSGreg Roach    /**
34315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
34415d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
34552348eb8SGreg Roach     *
34652348eb8SGreg Roach     * @return void
347db7d25eeSGreg Roach     */
348c1010edaSGreg Roach    public function testBornEnglandCensusWales()
349c1010edaSGreg Roach    {
350ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
35116d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('London, England'));
352db7d25eeSGreg Roach
353ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
354db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Wales');
355db7d25eeSGreg Roach
356ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
357db7d25eeSGreg Roach
358342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
359db7d25eeSGreg Roach    }
360db7d25eeSGreg Roach
361db7d25eeSGreg Roach    /**
36215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
36315d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
36452348eb8SGreg Roach     *
36552348eb8SGreg Roach     * @return void
366db7d25eeSGreg Roach     */
367c1010edaSGreg Roach    public function testBornWalesCensusWales()
368c1010edaSGreg Roach    {
369ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
37016d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Cardiff, Wales'));
371db7d25eeSGreg Roach
372ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
373db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Wales');
374db7d25eeSGreg Roach
375ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
376db7d25eeSGreg Roach
377342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
378db7d25eeSGreg Roach    }
379db7d25eeSGreg Roach
380db7d25eeSGreg Roach    /**
38115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
38215d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
38352348eb8SGreg Roach     *
38452348eb8SGreg Roach     * @return void
385db7d25eeSGreg Roach     */
386c1010edaSGreg Roach    public function testBornScotlandCensusWales()
387c1010edaSGreg Roach    {
388ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
38916d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Edinburgh, Scotland'));
390db7d25eeSGreg Roach
391ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
392db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Wales');
393db7d25eeSGreg Roach
394ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
395db7d25eeSGreg Roach
396342dcecdSGreg Roach        $this->assertSame('S', $column->generate($individual, $individual));
397db7d25eeSGreg Roach    }
398db7d25eeSGreg Roach
399db7d25eeSGreg Roach    /**
40015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
40115d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
40252348eb8SGreg Roach     *
40352348eb8SGreg Roach     * @return void
404db7d25eeSGreg Roach     */
405c1010edaSGreg Roach    public function testBornIrelandCensusWales()
406c1010edaSGreg Roach    {
407ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
40816d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Dublin, Ireland'));
409db7d25eeSGreg Roach
410ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
411db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Wales');
412db7d25eeSGreg Roach
413ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
414db7d25eeSGreg Roach
415342dcecdSGreg Roach        $this->assertSame('I', $column->generate($individual, $individual));
416db7d25eeSGreg Roach    }
417db7d25eeSGreg Roach
418db7d25eeSGreg Roach    /**
41915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
42015d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
42152348eb8SGreg Roach     *
42252348eb8SGreg Roach     * @return void
423db7d25eeSGreg Roach     */
424c1010edaSGreg Roach    public function testBornForeignCensusWales()
425c1010edaSGreg Roach    {
426ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
42716d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Elbonia'));
428db7d25eeSGreg Roach
429ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
430db7d25eeSGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Wales');
431db7d25eeSGreg Roach
432ef21b467SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
433db7d25eeSGreg Roach
434342dcecdSGreg Roach        $this->assertSame('F', $column->generate($individual, $individual));
435db7d25eeSGreg Roach    }
436b164ca57SGreg Roach
437b164ca57SGreg Roach    /**
43815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
43915d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
44052348eb8SGreg Roach     *
44152348eb8SGreg Roach     * @return void
442b164ca57SGreg Roach     */
443c1010edaSGreg Roach    public function testBornNowhereCensusEngland()
444c1010edaSGreg Roach    {
445ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
44616d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock(''));
447b164ca57SGreg Roach
448ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
449b164ca57SGreg Roach        $census->shouldReceive('censusPlace')->andReturn('England');
450b164ca57SGreg Roach
451b164ca57SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
452b164ca57SGreg Roach
453342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
454b164ca57SGreg Roach    }
455b164ca57SGreg Roach
456b164ca57SGreg Roach    /**
45715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
45815d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
45952348eb8SGreg Roach     *
46052348eb8SGreg Roach     * @return void
461b164ca57SGreg Roach     */
462c1010edaSGreg Roach    public function testBornNowhereCensusWales()
463c1010edaSGreg Roach    {
464ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
46516d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock(''));
466b164ca57SGreg Roach
467ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
468b164ca57SGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Wales');
469b164ca57SGreg Roach
470b164ca57SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
471b164ca57SGreg Roach
472342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
473b164ca57SGreg Roach    }
474b164ca57SGreg Roach
475b164ca57SGreg Roach    /**
47615d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts
47715d603e7SGreg Roach     * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn
47852348eb8SGreg Roach     *
47952348eb8SGreg Roach     * @return void
480b164ca57SGreg Roach     */
481c1010edaSGreg Roach    public function testBornNowhereCensusScotland()
482c1010edaSGreg Roach    {
483ddf438a5SGreg Roach        $individual = Mockery::mock(Individual::class);
48416d0b7f7SRico Sonntag        $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock(''));
485b164ca57SGreg Roach
486ddf438a5SGreg Roach        $census = Mockery::mock(CensusInterface::class);
487b164ca57SGreg Roach        $census->shouldReceive('censusPlace')->andReturn('Scotland');
488b164ca57SGreg Roach
489b164ca57SGreg Roach        $column = new CensusColumnBornForeignParts($census, '', '');
490b164ca57SGreg Roach
491342dcecdSGreg Roach        $this->assertSame('', $column->generate($individual, $individual));
492b164ca57SGreg Roach    }
493db7d25eeSGreg Roach}
494