. */ namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Date; use Fisharebest\Webtrees\Individual; use Mockery; /** * Test harness for the class CensusColumnSurname */ class CensusColumnSurnameTest extends \PHPUnit_Framework_TestCase { /** * Delete mock objects */ public function tearDown() { Mockery::close(); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnSurname * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testSurname() { $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)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnSurname * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testNoName() { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getAllNames')->andReturn([]); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnSurname($census, '', ''); $this->assertSame('', $column->generate($individual)); } }