. */ 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 CensusColumnAgeFemale */ class CensusColumnAgeFemaleTest extends TestCase { /** * @covers \Fisharebest\Webtrees\Census\CensusColumnAgeFemale * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testMale(): void { $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); $census = $this->createMock(CensusInterface::class); $column = new CensusColumnAgeFemale($census, '', ''); self::assertSame('', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnAgeFemale * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testFemale(): void { $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); $individual->method('getEstimatedBirthDate')->willReturn(new Date('01 JAN 1800')); $census = $this->createMock(CensusInterface::class); $census->method('censusDate')->willReturn('30 JUN 1832'); $column = new CensusColumnAgeFemale($census, '', ''); self::assertSame('32', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnAgeFemale * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testUnknownSex(): void { $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('U'); $individual->method('getEstimatedBirthDate')->willReturn(new Date('01 JAN 1800')); $census = $this->createMock(CensusInterface::class); $census->method('censusDate')->willReturn('30 JUN 1832'); $column = new CensusColumnAgeFemale($census, '', ''); self::assertSame('32', $column->generate($individual, $individual)); } /** * @covers \Fisharebest\Webtrees\Census\CensusColumnAgeFemale * @covers \Fisharebest\Webtrees\Census\AbstractCensusColumn * * @return void */ public function testLessThanOneYear(): void { $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); $individual->method('getEstimatedBirthDate')->willReturn(new Date('01 JAN 1800')); $census = $this->createMock(CensusInterface::class); $census->method('censusDate')->willReturn('30 JUN 1800'); $column = new CensusColumnAgeFemale($census, '', ''); self::assertSame('0', $column->generate($individual, $individual)); } }