1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-06 13:16:45 +02:00

feat(tests): add tests for [url] shortcode

This commit is contained in:
Awilum
2022-04-15 16:56:43 +03:00
parent c22f6d11f0
commit 0e4e8bb8be

View File

@@ -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"}\']'));
});