From 8e12f5ee59dc8e3bc4907bca6ac84ce9bb08901a Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Wed, 18 Aug 2021 17:34:34 +0100 Subject: [PATCH] [TESTS] Raise test coverage for Link to 100% --- tests/Entity/LinkTest.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/Entity/LinkTest.php diff --git a/tests/Entity/LinkTest.php b/tests/Entity/LinkTest.php new file mode 100644 index 0000000000..75c380876e --- /dev/null +++ b/tests/Entity/LinkTest.php @@ -0,0 +1,36 @@ +. +// }}} + +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()); + } +}