. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use DOMDocument; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\TestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\CoversTrait; #[CoversClass(MapLinkBing::class)] #[CoversTrait(ModuleMapLinkTrait::class)] class MapLinkGoogleTest extends TestCase { public function testNoCoordinates(): void { $module = new MapLinkGoogle(); $fact = $this->createMock(Fact::class); $fact->method('latitude')->willReturn(null); $fact->method('longitude')->willReturn(null); $html = $module->mapLink($fact); static::assertSame('', $html); } public function testLink(): void { $module = new MapLinkGoogle(); $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); } }