. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\Individual; use Illuminate\Support\Collection; /** * Test harness for the class CensusColumnOccupation */ class CensusColumnOccupationTest extends \Fisharebest\Webtrees\TestCase { /** * @covers \Fisharebest\Webtrees\Census\CensusColumnOccupation * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testNoOccupation(): void { $individual = $this->createMock(Individual::class); $individual->method('facts')->with(['OCCU'])->willReturn(new Collection()); $census = $this->createMock(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(): void { $fact = $this->createMock(Fact::class); $fact->method('value')->willReturn('Farmer'); $individual = $this->createMock(Individual::class); $individual->method('facts')->with(['OCCU'])->willReturn(new Collection([$fact])); $census = $this->createMock(CensusInterface::class); $column = new CensusColumnOccupation($census, '', ''); $this->assertSame('Farmer', $column->generate($individual, $individual)); } }