. */ namespace Fisharebest\Webtrees\Census; 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('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getFacts')->withArgs(['OCCU'])->andReturn([]); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $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('Fisharebest\Webtrees\Fact'); $fact->shouldReceive('getValue')->andReturn('Farmer'); $individual = Mockery::mock('Fisharebest\Webtrees\Individual'); $individual->shouldReceive('getFacts')->withArgs(['OCCU'])->andReturn([$fact]); $census = Mockery::mock('Fisharebest\Webtrees\Census\CensusInterface'); $column = new CensusColumnOccupation($census, '', ''); $this->assertSame('Farmer', $column->generate($individual)); } }