. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\TestCase; use PHPUnit\Framework\Attributes\CoversClass; #[CoversClass(CensusColumnGivenNameInitial::class)] #[CoversClass(AbstractCensusColumn::class)] class CensusColumnGivenNameInitialTest extends TestCase { public function testOneGivenName(): void { $individual = $this->createMock(Individual::class); $individual->method('getAllNames')->willReturn([['givn' => 'Joe']]); $census = $this->createMock(CensusInterface::class); $column = new CensusColumnGivenNameInitial($census, '', ''); self::assertSame('Joe', $column->generate($individual, $individual)); } public function testMultipleGivenNames(): void { $individual = $this->createMock(Individual::class); $individual->method('getAllNames')->willReturn([['givn' => 'Joe Fred']]); $census = $this->createMock(CensusInterface::class); $column = new CensusColumnGivenNameInitial($census, '', ''); self::assertSame('Joe F', $column->generate($individual, $individual)); } public function testNoName(): void { $individual = $this->createMock(Individual::class); $individual->method('getAllNames')->willReturn([]); $census = $this->createMock(CensusInterface::class); $column = new CensusColumnGivenNameInitial($census, '', ''); self::assertSame('', $column->generate($individual, $individual)); } }