. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Individual; use Mockery; /** * Test harness for the class CensusColumnOccupation */ class CensusColumnOccupationTest extends \Fisharebest\Webtrees\TestCase { /** * Delete mock objects * * @return void */ public function tearDown() { Mockery::close(); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnOccupation * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testNoOccupation() { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('facts')->with(['OCCU'])->andReturn([]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnOccupation($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnOccupation * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testOccupation() { $fact = Mockery::mock(Fact::class); $fact->shouldReceive('value')->andReturn('Farmer'); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('facts')->with(['OCCU'])->andReturn([$fact]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnOccupation($census, '', ''); $this->assertSame('Farmer', $column->generate($individual, $individual)); } }