. */ namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Individual; use Mockery; /** * Test harness for the class CensusColumnGivenNames */ class CensusColumnGivenNamesTest extends \PHPUnit_Framework_TestCase { /** * Delete mock objects */ public function tearDown() { Mockery::close(); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnGivenNames * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testGivenNames() { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getAllNames')->andReturn(array(array('givn' => 'Joe'))); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnGivenNames($census, '', ''); $this->assertSame('Joe', $column->generate($individual)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnGivenNames * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testNoName() { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getAllNames')->andReturn(array()); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnGivenNames($census, '', ''); $this->assertSame('', $column->generate($individual)); } }