1db7d25eeSGreg Roach<?php 2db7d25eeSGreg Roach 3db7d25eeSGreg Roach/** 4db7d25eeSGreg Roach * webtrees: online genealogy 51062a142SGreg Roach * Copyright (C) 2018 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 */ 17db7d25eeSGreg Roachnamespace Fisharebest\Webtrees\Census; 18db7d25eeSGreg Roach 19db7d25eeSGreg Roachuse Mockery; 20db7d25eeSGreg Roach 21db7d25eeSGreg Roach/** 22db7d25eeSGreg Roach * Test harness for the class CensusColumnBornForeignParts 23db7d25eeSGreg Roach */ 24*c1010edaSGreg Roachclass CensusColumnBornForeignPartsTest extends \PHPUnit\Framework\TestCase 25*c1010edaSGreg Roach{ 26db7d25eeSGreg Roach /** 27db7d25eeSGreg Roach * Delete mock objects 28db7d25eeSGreg Roach */ 29*c1010edaSGreg Roach public function tearDown() 30*c1010edaSGreg Roach { 31db7d25eeSGreg Roach Mockery::close(); 32db7d25eeSGreg Roach } 33db7d25eeSGreg Roach 34db7d25eeSGreg Roach /** 3516d0b7f7SRico Sonntag * Get place mock. 3616d0b7f7SRico Sonntag * 3716d0b7f7SRico Sonntag * @param string $place Gedcom Place 3816d0b7f7SRico Sonntag * 3916d0b7f7SRico Sonntag * @return \Fisharebest\Webtrees\Place 4016d0b7f7SRico Sonntag */ 41*c1010edaSGreg Roach private function getPlaceMock($place) 42*c1010edaSGreg Roach { 4316d0b7f7SRico Sonntag $placeParts = explode(', ', $place); 4416d0b7f7SRico Sonntag 4516d0b7f7SRico Sonntag $placeMock = Mockery::mock('\Fisharebest\Webtrees\Place'); 4616d0b7f7SRico Sonntag $placeMock->shouldReceive('getGedcomName')->andReturn($place); 4716d0b7f7SRico Sonntag $placeMock->shouldReceive('lastPart')->andReturn(end($placeParts)); 4816d0b7f7SRico Sonntag 4916d0b7f7SRico Sonntag return $placeMock; 5016d0b7f7SRico Sonntag } 5116d0b7f7SRico Sonntag 5216d0b7f7SRico Sonntag /** 5315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 5415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 55db7d25eeSGreg Roach */ 56*c1010edaSGreg Roach public function testBornEnglandCensusEngland() 57*c1010edaSGreg Roach { 58c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 5916d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('London, England')); 60db7d25eeSGreg Roach 61c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 62db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('England'); 63db7d25eeSGreg Roach 64ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 65db7d25eeSGreg Roach 66db7d25eeSGreg Roach $this->assertSame('', $column->generate($individual)); 67db7d25eeSGreg Roach } 68db7d25eeSGreg Roach 69db7d25eeSGreg Roach /** 7015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 7115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 72db7d25eeSGreg Roach */ 73*c1010edaSGreg Roach public function testBornWalesCensusEngland() 74*c1010edaSGreg Roach { 75c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 7616d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Cardiff, Wales')); 77db7d25eeSGreg Roach 78c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 79db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('England'); 80db7d25eeSGreg Roach 81ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 82db7d25eeSGreg Roach 83db7d25eeSGreg Roach $this->assertSame('', $column->generate($individual)); 84db7d25eeSGreg Roach } 85db7d25eeSGreg Roach 86db7d25eeSGreg Roach /** 8715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 8815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 89db7d25eeSGreg Roach */ 90*c1010edaSGreg Roach public function testBornScotlandCensusEngland() 91*c1010edaSGreg Roach { 92c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 9316d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Edinburgh, Scotland')); 94db7d25eeSGreg Roach 95c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 96db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('England'); 97db7d25eeSGreg Roach 98ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 99db7d25eeSGreg Roach 100db7d25eeSGreg Roach $this->assertSame('S', $column->generate($individual)); 101db7d25eeSGreg Roach } 102db7d25eeSGreg Roach 103db7d25eeSGreg Roach /** 10415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 10515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 106db7d25eeSGreg Roach */ 107*c1010edaSGreg Roach public function testBornIrelandCensusEngland() 108*c1010edaSGreg Roach { 109c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 11016d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Dublin, Ireland')); 111db7d25eeSGreg Roach 112c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 113db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('England'); 114db7d25eeSGreg Roach 115ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 116db7d25eeSGreg Roach 117db7d25eeSGreg Roach $this->assertSame('I', $column->generate($individual)); 118db7d25eeSGreg Roach } 119db7d25eeSGreg Roach 120db7d25eeSGreg Roach /** 12115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 12215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 123db7d25eeSGreg Roach */ 124*c1010edaSGreg Roach public function testBornForeignCensusEngland() 125*c1010edaSGreg Roach { 126c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 12716d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Elbonia')); 128db7d25eeSGreg Roach 129c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 130db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('England'); 131db7d25eeSGreg Roach 132ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 133db7d25eeSGreg Roach 134db7d25eeSGreg Roach $this->assertSame('F', $column->generate($individual)); 135db7d25eeSGreg Roach } 136db7d25eeSGreg Roach 137db7d25eeSGreg Roach /** 13815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 13915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 140db7d25eeSGreg Roach */ 141*c1010edaSGreg Roach public function testBornEnglandCensusIreland() 142*c1010edaSGreg Roach { 143c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 14416d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('London, England')); 145db7d25eeSGreg Roach 146c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 147db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Ireland'); 148db7d25eeSGreg Roach 149ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 150db7d25eeSGreg Roach 151db7d25eeSGreg Roach $this->assertSame('E', $column->generate($individual)); 152db7d25eeSGreg Roach } 153db7d25eeSGreg Roach 154db7d25eeSGreg Roach /** 15515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 15615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 157db7d25eeSGreg Roach */ 158*c1010edaSGreg Roach public function testBornWalesCensusIreland() 159*c1010edaSGreg Roach { 160c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 16116d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Cardiff, Wales')); 162db7d25eeSGreg Roach 163c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 164db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Ireland'); 165db7d25eeSGreg Roach 166ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 167db7d25eeSGreg Roach 168db7d25eeSGreg Roach $this->assertSame('E', $column->generate($individual)); 169db7d25eeSGreg Roach } 170db7d25eeSGreg Roach 171db7d25eeSGreg Roach /** 17215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 17315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 174db7d25eeSGreg Roach */ 175*c1010edaSGreg Roach public function testBornScotlandCensusIreland() 176*c1010edaSGreg Roach { 177c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 17816d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Edinburgh, Scotland')); 179db7d25eeSGreg Roach 180c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 181db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Ireland'); 182db7d25eeSGreg Roach 183ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 184db7d25eeSGreg Roach 185db7d25eeSGreg Roach $this->assertSame('S', $column->generate($individual)); 186db7d25eeSGreg Roach } 187db7d25eeSGreg Roach 188db7d25eeSGreg Roach /** 18915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 19015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 191db7d25eeSGreg Roach */ 192*c1010edaSGreg Roach public function testBornIrelandCensusIreland() 193*c1010edaSGreg Roach { 194c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 19516d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Dublin, Ireland')); 196db7d25eeSGreg Roach 197c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 198db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Ireland'); 199db7d25eeSGreg Roach 200ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 201db7d25eeSGreg Roach 202db7d25eeSGreg Roach $this->assertSame('', $column->generate($individual)); 203db7d25eeSGreg Roach } 204db7d25eeSGreg Roach 205db7d25eeSGreg Roach /** 20615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 20715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 208db7d25eeSGreg Roach */ 209*c1010edaSGreg Roach public function testBornForeignCensusIreland() 210*c1010edaSGreg Roach { 211c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 21216d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Elbonia')); 213db7d25eeSGreg Roach 214c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 215db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Ireland'); 216db7d25eeSGreg Roach 217ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 218db7d25eeSGreg Roach 219db7d25eeSGreg Roach $this->assertSame('F', $column->generate($individual)); 220db7d25eeSGreg Roach } 221db7d25eeSGreg Roach 222db7d25eeSGreg Roach /** 22315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 22415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 225db7d25eeSGreg Roach */ 226*c1010edaSGreg Roach public function testBornEnglandCensusScotland() 227*c1010edaSGreg Roach { 228c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 22916d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('London, England')); 230db7d25eeSGreg Roach 231c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 232db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Scotland'); 233db7d25eeSGreg Roach 234ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 235db7d25eeSGreg Roach 236db7d25eeSGreg Roach $this->assertSame('E', $column->generate($individual)); 237db7d25eeSGreg Roach } 238db7d25eeSGreg Roach 239db7d25eeSGreg Roach /** 24015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 24115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 242db7d25eeSGreg Roach */ 243*c1010edaSGreg Roach public function testBornWalesCensusScotland() 244*c1010edaSGreg Roach { 245c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 24616d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Cardiff, Wales')); 247db7d25eeSGreg Roach 248c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 249db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Scotland'); 250db7d25eeSGreg Roach 251ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 252db7d25eeSGreg Roach 253db7d25eeSGreg Roach $this->assertSame('E', $column->generate($individual)); 254db7d25eeSGreg Roach } 255db7d25eeSGreg Roach 256db7d25eeSGreg Roach /** 25715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 25815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 259db7d25eeSGreg Roach */ 260*c1010edaSGreg Roach public function testBornScotlandCensusScotland() 261*c1010edaSGreg Roach { 262c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 26316d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Edinburgh, Scotland')); 264db7d25eeSGreg Roach 265c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 266db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Scotland'); 267db7d25eeSGreg Roach 268ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 269db7d25eeSGreg Roach 270db7d25eeSGreg Roach $this->assertSame('', $column->generate($individual)); 271db7d25eeSGreg Roach } 272db7d25eeSGreg Roach 273db7d25eeSGreg Roach /** 27415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 27515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 276db7d25eeSGreg Roach */ 277*c1010edaSGreg Roach public function testBornIrelandCensusScotland() 278*c1010edaSGreg Roach { 279c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 28016d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Dublin, Ireland')); 281db7d25eeSGreg Roach 282c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 283db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Scotland'); 284db7d25eeSGreg Roach 285ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 286db7d25eeSGreg Roach 287db7d25eeSGreg Roach $this->assertSame('I', $column->generate($individual)); 288db7d25eeSGreg Roach } 289db7d25eeSGreg Roach 290db7d25eeSGreg Roach /** 29115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 29215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 293db7d25eeSGreg Roach */ 294*c1010edaSGreg Roach public function testBornForeignCensusScotland() 295*c1010edaSGreg Roach { 296c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 29716d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Elbonia')); 298db7d25eeSGreg Roach 299c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 300db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Scotland'); 301db7d25eeSGreg Roach 302ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 303db7d25eeSGreg Roach 304db7d25eeSGreg Roach $this->assertSame('F', $column->generate($individual)); 305db7d25eeSGreg Roach } 306db7d25eeSGreg Roach 307db7d25eeSGreg Roach /** 30815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 30915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 310db7d25eeSGreg Roach */ 311*c1010edaSGreg Roach public function testBornEnglandCensusWales() 312*c1010edaSGreg Roach { 313c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 31416d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('London, England')); 315db7d25eeSGreg Roach 316c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 317db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Wales'); 318db7d25eeSGreg Roach 319ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 320db7d25eeSGreg Roach 321db7d25eeSGreg Roach $this->assertSame('', $column->generate($individual)); 322db7d25eeSGreg Roach } 323db7d25eeSGreg Roach 324db7d25eeSGreg Roach /** 32515d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 32615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 327db7d25eeSGreg Roach */ 328*c1010edaSGreg Roach public function testBornWalesCensusWales() 329*c1010edaSGreg Roach { 330c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 33116d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Cardiff, Wales')); 332db7d25eeSGreg Roach 333c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 334db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Wales'); 335db7d25eeSGreg Roach 336ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 337db7d25eeSGreg Roach 338db7d25eeSGreg Roach $this->assertSame('', $column->generate($individual)); 339db7d25eeSGreg Roach } 340db7d25eeSGreg Roach 341db7d25eeSGreg Roach /** 34215d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 34315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 344db7d25eeSGreg Roach */ 345*c1010edaSGreg Roach public function testBornScotlandCensusWales() 346*c1010edaSGreg Roach { 347c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 34816d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Edinburgh, Scotland')); 349db7d25eeSGreg Roach 350c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 351db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Wales'); 352db7d25eeSGreg Roach 353ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 354db7d25eeSGreg Roach 355db7d25eeSGreg Roach $this->assertSame('S', $column->generate($individual)); 356db7d25eeSGreg Roach } 357db7d25eeSGreg Roach 358db7d25eeSGreg Roach /** 35915d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 36015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 361db7d25eeSGreg Roach */ 362*c1010edaSGreg Roach public function testBornIrelandCensusWales() 363*c1010edaSGreg Roach { 364c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 36516d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Dublin, Ireland')); 366db7d25eeSGreg Roach 367c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 368db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Wales'); 369db7d25eeSGreg Roach 370ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 371db7d25eeSGreg Roach 372db7d25eeSGreg Roach $this->assertSame('I', $column->generate($individual)); 373db7d25eeSGreg Roach } 374db7d25eeSGreg Roach 375db7d25eeSGreg Roach /** 37615d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 37715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 378db7d25eeSGreg Roach */ 379*c1010edaSGreg Roach public function testBornForeignCensusWales() 380*c1010edaSGreg Roach { 381c314ecc9SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 38216d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('Elbonia')); 383db7d25eeSGreg Roach 384c314ecc9SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 385db7d25eeSGreg Roach $census->shouldReceive('censusPlace')->andReturn('Wales'); 386db7d25eeSGreg Roach 387ef21b467SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 388db7d25eeSGreg Roach 389db7d25eeSGreg Roach $this->assertSame('F', $column->generate($individual)); 390db7d25eeSGreg Roach } 391b164ca57SGreg Roach 392b164ca57SGreg Roach /** 39315d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 39415d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 395b164ca57SGreg Roach */ 396*c1010edaSGreg Roach public function testBornNowhereCensusEngland() 397*c1010edaSGreg Roach { 398b164ca57SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 39916d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('')); 400b164ca57SGreg Roach 401b164ca57SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 402b164ca57SGreg Roach $census->shouldReceive('censusPlace')->andReturn('England'); 403b164ca57SGreg Roach 404b164ca57SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 405b164ca57SGreg Roach 406b164ca57SGreg Roach $this->assertSame('', $column->generate($individual)); 407b164ca57SGreg Roach } 408b164ca57SGreg Roach 409b164ca57SGreg Roach /** 41015d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 41115d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 412b164ca57SGreg Roach */ 413*c1010edaSGreg Roach public function testBornNowhereCensusWales() 414*c1010edaSGreg Roach { 415b164ca57SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 41616d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('')); 417b164ca57SGreg Roach 418b164ca57SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 419b164ca57SGreg Roach $census->shouldReceive('censusPlace')->andReturn('Wales'); 420b164ca57SGreg Roach 421b164ca57SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 422b164ca57SGreg Roach 423b164ca57SGreg Roach $this->assertSame('', $column->generate($individual)); 424b164ca57SGreg Roach } 425b164ca57SGreg Roach 426b164ca57SGreg Roach /** 42715d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts 42815d603e7SGreg Roach * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn 429b164ca57SGreg Roach */ 430*c1010edaSGreg Roach public function testBornNowhereCensusScotland() 431*c1010edaSGreg Roach { 432b164ca57SGreg Roach $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); 43316d0b7f7SRico Sonntag $individual->shouldReceive('getBirthPlace')->andReturn($this->getPlaceMock('')); 434b164ca57SGreg Roach 435b164ca57SGreg Roach $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); 436b164ca57SGreg Roach $census->shouldReceive('censusPlace')->andReturn('Scotland'); 437b164ca57SGreg Roach 438b164ca57SGreg Roach $column = new CensusColumnBornForeignParts($census, '', ''); 439b164ca57SGreg Roach 440b164ca57SGreg Roach $this->assertSame('', $column->generate($individual)); 441b164ca57SGreg Roach } 442db7d25eeSGreg Roach} 443