. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Date; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\Family; use Fisharebest\Webtrees\Individual; use Illuminate\Support\Collection; use Mockery; /** * Test harness for the class CensusColumnConditionFrenchGarcon */ class CensusColumnConditionFrenchGarconTest extends \Fisharebest\Webtrees\TestCase { /** * Delete mock objects * * @return void */ public function tearDown() { Mockery::close(); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testNoSpouseFamiliesMale(): void { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('M'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection()); $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $this->assertSame('1', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testNoSpouseFamiliesFemale(): void { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('F'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection()); $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testNoFamilyFactsMale(): void { $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection()); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); $individual->shouldReceive('sex')->andReturn('M'); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('1', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testNoFamilyFactsFemale(): void { $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection()); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); $individual->shouldReceive('sex')->andReturn('F'); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testSpouseDeadMale(): void { $fact = Mockery::mock(Fact::class); $spouse = Mockery::mock(Individual::class); $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection([$fact])); $family->shouldReceive('facts')->with(['DIV'])->andReturn(new Collection()); $family->shouldReceive('spouse')->andReturn($spouse); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('M'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testSpouseDeadFemale(): void { $fact = Mockery::mock(Fact::class); $spouse = Mockery::mock(Individual::class); $spouse->shouldReceive('getDeathDate')->andReturn(new Date('1820')); $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection([$fact])); $family->shouldReceive('facts')->with(['DIV'])->andReturn(new Collection()); $family->shouldReceive('spouse')->andReturn($spouse); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('F'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testNoFamilyUnmarriedMale(): void { $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection()); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('M'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $this->assertSame('1', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testNoFamilyUnmarriedFemale(): void { $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection()); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('F'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1800')); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testChildMale(): void { $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection()); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('M'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $this->assertSame('1', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testChildFemale(): void { $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection()); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('F'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $individual->shouldReceive('getEstimatedBirthDate')->andReturn(new Date('1820')); $census = Mockery::mock(CensusInterface::class); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testDivorcedMale(): void { $fact = Mockery::mock(Fact::class); $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection([$fact])); $family->shouldReceive('facts')->with(['DIV'])->andReturn(new Collection([$fact])); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('M'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnConditionFrenchGarcon * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition * * @return void */ public function testDivorcedFemale(): void { $fact = Mockery::mock(Fact::class); $family = Mockery::mock(Family::class); $family->shouldReceive('getMarriageDate')->andReturn(new Date('')); $family->shouldReceive('facts')->with(['MARR'])->andReturn(new Collection([$fact])); $family->shouldReceive('facts')->with(['DIV'])->andReturn(new Collection([$fact])); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('sex')->andReturn('F'); $individual->shouldReceive('spouseFamilies')->andReturn(new Collection([$family])); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnConditionFrenchGarcon($census, '', ''); $census->shouldReceive('censusDate')->andReturn('30 JUN 1830'); $this->assertSame('', $column->generate($individual, $individual)); } }