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