123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Tests\Entity;
- use App\Entity\Link;
- use App\Util\GNUsocialTestCase;
- 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://' . $_ENV['SOCIAL_DOMAIN']));
- }
- }
|