From 0e4e8bb8be853de91a869f12872425169dc26602 Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 15 Apr 2022 16:56:43 +0300 Subject: [PATCH] feat(tests): add tests for [url] shortcode --- .../Parsers/Shortcodes/UrlShortcodeTest.php | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/src/flextype/core/Parsers/Shortcodes/UrlShortcodeTest.php b/tests/src/flextype/core/Parsers/Shortcodes/UrlShortcodeTest.php index a33ea346..377bfebb 100644 --- a/tests/src/flextype/core/Parsers/Shortcodes/UrlShortcodeTest.php +++ b/tests/src/flextype/core/Parsers/Shortcodes/UrlShortcodeTest.php @@ -2,8 +2,26 @@ declare(strict_types=1); -test('[url] shortcode', function () { - registry()->set('flextype.settings.url', 'https://awilum.github.io/flextype'); +test('[getBaseUrl] shortcode', function () { + registry()->set('flextype.settings.base_url', 'https://awilum.github.io/flextype'); - $this->assertStringContainsString('https://awilum.github.io/flextype', parsers()->shortcodes()->parse('[url]')); + $this->assertStringContainsString('https://awilum.github.io/flextype', parsers()->shortcodes()->parse('[getBaseUrl]')); }); + +test('[getBasePath] shortcode', function () { + app()->setBasePath('/foo/'); + + $this->assertStringContainsString('/foo/', parsers()->shortcodes()->parse('[getBasePath]')); +}); + +test('[getAbsoluteUrl] shortcode', function () { + $this->assertStringContainsString('/', parsers()->shortcodes()->parse('[getAbsoluteUrl]')); +}); + +test('[getUriString] shortcode', function () { + $this->assertStringContainsString('', parsers()->shortcodes()->parse('[getUriString]')); +}); + +test('[urlFor] shortcode', function () { + $this->assertStringContainsString('', parsers()->shortcodes()->parse('[urlFor routeName="test-route" queryParams=\'{"foo": "Foo"}\']')); +}); \ No newline at end of file