. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Place; use Illuminate\Support\Collection; /** * Test harness for the class CensusColumnBornForeignParts */ class CensusColumnBornForeignPartsTest extends \Fisharebest\Webtrees\TestCase { /** * Get place mock. * * @param string $place Gedcom Place * * @return Place */ private function getPlaceMock($place): Place { $placeParts = explode(', ', $place); $placeMock = $this->createMock(Place::class); $placeMock->method('gedcomName')->willReturn($place); $placeMock->method('lastParts')->willReturn((new Collection($placeParts))->slice(-1)); return $placeMock; } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornEnglandCensusEngland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('London, England')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('England'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornWalesCensusEngland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Cardiff, Wales')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('England'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornScotlandCensusEngland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Edinburgh, Scotland')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('England'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('S', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornIrelandCensusEngland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Dublin, Ireland')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('England'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('I', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornForeignCensusEngland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Elbonia')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('England'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('F', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornEnglandCensusIreland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('London, England')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Ireland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('E', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornWalesCensusIreland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Cardiff, Wales')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Ireland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('E', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornScotlandCensusIreland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Edinburgh, Scotland')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Ireland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('S', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornIrelandCensusIreland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Dublin, Ireland')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Ireland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornForeignCensusIreland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Elbonia')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Ireland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('F', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornEnglandCensusScotland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('London, England')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Scotland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('E', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornWalesCensusScotland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Cardiff, Wales')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Scotland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('E', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornScotlandCensusScotland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Edinburgh, Scotland')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Scotland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornIrelandCensusScotland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Dublin, Ireland')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Scotland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('I', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornForeignCensusScotland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Elbonia')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Scotland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('F', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornEnglandCensusWales(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('London, England')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Wales'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornWalesCensusWales(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Cardiff, Wales')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Wales'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornScotlandCensusWales(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Edinburgh, Scotland')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Wales'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('S', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornIrelandCensusWales(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Dublin, Ireland')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Wales'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('I', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornForeignCensusWales(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('Elbonia')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Wales'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('F', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornNowhereCensusEngland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('England'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornNowhereCensusWales(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Wales'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnBornForeignParts * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testBornNowhereCensusScotland(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthPlace')->willReturn($this->getPlaceMock('')); $census = $this->createMock(CensusInterface::class); $census->method('censusPlace')->willReturn('Scotland'); $column = new CensusColumnBornForeignParts($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } }