. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Date; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\TestCase; /** * Test harness for the class CensusColumnMonthIfBornWithinYear */ class CensusColumnMonthIfBornWithinYearTest extends TestCase { /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMonthIfBornWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testBornWithinYear(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthDate')->willReturn(new Date('01 JAN 1860')); $census = $this->createMock(CensusInterface::class); $census->method('censusDate')->willReturn('01 JUN 1860'); $column = new CensusColumnMonthIfBornWithinYear($census, '', ''); self::assertSame('Jan', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMonthIfBornWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testBornOverYearBeforeTheCensus(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthDate')->willReturn(new Date('01 JAN 1859')); $census = $this->createMock(CensusInterface::class); $census->method('censusDate')->willReturn('01 JUN 1860'); $column = new CensusColumnMonthIfBornWithinYear($census, '', ''); self::assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMonthIfBornWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testBornAfterTheCensus(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthDate')->willReturn(new Date('02 JUN 1860')); $census = $this->createMock(CensusInterface::class); $census->method('censusDate')->willReturn('01 JUN 1860'); $column = new CensusColumnMonthIfBornWithinYear($census, '', ''); self::assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnMonthIfBornWithinYear * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn */ public function testNoBirth(): void { $individual = $this->createMock(Individual::class); $individual->method('getBirthDate')->willReturn(new Date('')); $census = $this->createMock(CensusInterface::class); $census->method('censusDate')->willReturn('01 JUN 1860'); $column = new CensusColumnMonthIfBornWithinYear($census, '', ''); self::assertSame('', $column->generate($individual, $individual)); } }