. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Individual; use Illuminate\Support\Collection; use Mockery; /** * Test harness for the class CensusColumnSurname */ class CensusColumnSurnameTest extends \Fisharebest\Webtrees\TestCase { /** * Delete mock objects * * @return void */ public function tearDown() { Mockery::close(); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnSurname * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testSurname(): void { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getAllNames')->andReturn([['surname' => 'Bloggs']]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnSurname($census, '', ''); $this->assertSame('Bloggs', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnSurname * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testNoName(): void { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getAllNames')->andReturn([]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnSurname($census, '', ''); $this->assertSame('', $column->generate($individual, $individual)); } }