. */ namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\Individual; use Mockery; /** * Test harness for the class CensusColumnOccupation */ class CensusColumnOccupationTest extends \PHPUnit_Framework_TestCase { /** * Delete mock objects */ public function tearDown() { Mockery::close(); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnOccupation * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testNoOccupation() { $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getFacts')->withArgs(array('OCCU'))->andReturn(array()); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnOccupation($census, '', ''); $this->assertSame('', $column->generate($individual)); } /** * @covers Fisharebest\Webtrees\Census\CensusColumnOccupation * @covers Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testOccupation() { $fact = Mockery::mock(Fact::class); $fact->shouldReceive('getValue')->andReturn('Farmer'); $individual = Mockery::mock(Individual::class); $individual->shouldReceive('getFacts')->withArgs(array('OCCU'))->andReturn(array($fact)); $census = Mockery::mock(CensusInterface::class); $column = new CensusColumnOccupation($census, '', ''); $this->assertSame('Farmer', $column->generate($individual)); } }