. // }}} namespace App\Tests\Entity; use App\Util\Common; use App\Util\GNUsocialTestCase; use Component\Link\Entity\Link; use InvalidArgumentException; use Jchook\AssertThrows\AssertThrows; class LinkTest extends GNUsocialTestCase { use AssertThrows; public function testGetOrCreate() { static::assertThrows(InvalidArgumentException::class, fn () => Link::getOrCreate('not a url')); $link = Link::getOrCreate('https://gnu.org'); static::assertNotNull($link->getUrl()); static::assertThrows(InvalidArgumentException::class, fn () => Link::getOrCreate('https://' . Common::config('site', 'server'))); } }