. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\TestCase; use Illuminate\Support\Collection; /** * Test harness for the class CensusColumnSurnameGivenNameInitial */ class CensusColumnSurnameGivenNameInitialTest extends TestCase { /** * @covers \Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNameInitial * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ 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)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnSurnameGivenNameInitial * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ 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)); } }