. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Date; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\TestCase; use PHPUnit\Framework\Attributes\CoversClass; #[CoversClass(CensusColumnMonthIfBornWithinYear::class)] #[CoversClass(AbstractCensusColumn::class)] class CensusColumnMonthIfBornWithinYearTest extends TestCase { 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)); } 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)); } 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)); } 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)); } }