. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use DOMDocument; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\TestCase; /** * @covers \Fisharebest\Webtrees\Module\MapLinkOpenStreetMap * @covers \Fisharebest\Webtrees\Module\ModuleMapLinkTrait */ class MapLinkOpenStreetMapTest extends TestCase { /** * @return void */ public function testNoCoordinates(): void { $module = new MapLinkOpenStreetMap(); $fact = $this->createMock(Fact::class); $fact->method('latitude')->willReturn(null); $fact->method('longitude')->willReturn(null); $html = $module->mapLink($fact); $this->assertSame('', $html); } /** * @return void */ public function testLink(): void { $module = new MapLinkOpenStreetMap(); $record = $this->createMock(Individual::class); $record->method('fullName')->willReturn('FULL NAME'); $fact = $this->createMock(Fact::class); $fact->method('latitude')->willReturn(54.321); $fact->method('longitude')->willReturn(-1.2345); $fact->method('label')->willReturn('LABEL'); $fact->method('record')->willReturn($record); $html = $module->mapLink($fact); self::assertTrue((new DOMDocument())->loadHTML($html), 'HTML=' . $html); } }