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