. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\TestCase; use Illuminate\Support\Collection; use PHPUnit\Framework\Attributes\CoversClass; #[CoversClass(CensusColumnReligion::class)] #[CoversClass(AbstractCensusColumn::class)] class CensusColumnReligionTest extends TestCase { public function testNoReligion(): void { $individual = $this->createMock(Individual::class); $individual ->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['RELI'], []])) ->willReturnOnConsecutiveCalls(new Collection(), new Collection()); $census = $this->createMock(CensusInterface::class); $column = new CensusColumnReligion($census, '', ''); self::assertSame('', $column->generate($individual, $individual)); } public function testRecordReligion(): void { $individual = $this->createMock(Individual::class); $fact = $this->createMock(Fact::class); $fact->method('value')->willReturn('Jedi'); $individual->method('facts')->with(['RELI'])->willReturn(new Collection([$fact])); $census = $this->createMock(CensusInterface::class); $column = new CensusColumnReligion($census, '', ''); self::assertSame('Jedi', $column->generate($individual, $individual)); } public function testEventReligion(): void { $individual = $this->createMock(Individual::class); $fact = $this->createMock(Fact::class); $fact->method('attribute')->with('RELI')->willReturn('Jedi'); $individual ->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['RELI'], []])) ->willReturnOnConsecutiveCalls( new Collection(), new Collection([$fact]) ); $census = $this->createMock(CensusInterface::class); $column = new CensusColumnReligion($census, '', ''); self::assertSame('Jedi', $column->generate($individual, $individual)); } }