diff --git a/tests/src/flextype/core/Parsers/Shortcodes/TextileShortcodeTest.php b/tests/src/flextype/core/Parsers/Shortcodes/TextileShortcodeTest.php index e481f4ae..f6892b33 100644 --- a/tests/src/flextype/core/Parsers/Shortcodes/TextileShortcodeTest.php +++ b/tests/src/flextype/core/Parsers/Shortcodes/TextileShortcodeTest.php @@ -16,3 +16,9 @@ test('textile shortcode', function () { expect(entries()->create('textile', ['test' => '(textile) **Foo**']))->toBeTrue(); expect(entries()->fetch('textile')['test'])->toBe("
Foo
"); }); + +test('textile shortcode disabled', function () { + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.textile.enabled', false); + expect(parsers()->shortcodes()->parse("(textile)foo(/textile)"))->toBe(''); + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.textile.enabled', true); +}); \ No newline at end of file diff --git a/tests/src/flextype/core/Parsers/Shortcodes/TypeShortcodeTest.php b/tests/src/flextype/core/Parsers/Shortcodes/TypeShortcodeTest.php index 3f0f9778..3e5be9f9 100644 --- a/tests/src/flextype/core/Parsers/Shortcodes/TypeShortcodeTest.php +++ b/tests/src/flextype/core/Parsers/Shortcodes/TypeShortcodeTest.php @@ -16,4 +16,10 @@ test('type shortcode', function () { expect(entries()->create('test-2', ['price' => '(type:string) 10']))->toBeTrue(); expect(entries()->fetch('test-2')['price'])->toBe('10'); +}); + +test('type shortcode disabled', function () { + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.type.enabled', false); + expect(parsers()->shortcodes()->parse("(type:int) 10"))->toBe(' 10'); + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.type.enabled', true); }); \ No newline at end of file diff --git a/tests/src/flextype/core/Parsers/Shortcodes/UrlShortcodeTest.php b/tests/src/flextype/core/Parsers/Shortcodes/UrlShortcodeTest.php index 5ceb8e46..dcbccffe 100644 --- a/tests/src/flextype/core/Parsers/Shortcodes/UrlShortcodeTest.php +++ b/tests/src/flextype/core/Parsers/Shortcodes/UrlShortcodeTest.php @@ -2,26 +2,32 @@ declare(strict_types=1); -test('(getBaseUrl) shortcode', function () { +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('(getBaseUrl)')); }); -test('(getBasePath) shortcode', function () { +test('getBasePath shortcode', function () { app()->setBasePath('/foo/'); $this->assertStringContainsString('/foo/', parsers()->shortcodes()->parse('(getBasePath)')); }); -test('(getAbsoluteUrl) shortcode', function () { +test('getAbsoluteUrl shortcode', function () { $this->assertStringContainsString('/', parsers()->shortcodes()->parse('(getAbsoluteUrl)')); }); -test('(getUriString) shortcode', function () { +test('getUriString shortcode', function () { $this->assertStringContainsString('', parsers()->shortcodes()->parse('(getUriString)')); }); -test('(urlFor) shortcode', function () { +test('urlFor shortcode', function () { $this->assertStringContainsString('', parsers()->shortcodes()->parse("(urlFor routeName='test-route' queryParams='{\"foo\": \"Foo\"}')")); +}); + +test('url shortcode disabled', function () { + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.url.enabled', false); + expect(parsers()->shortcodes()->parse("(getBasePath)"))->toBe(''); + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.url.enabled', true); }); \ No newline at end of file diff --git a/tests/src/flextype/core/Parsers/Shortcodes/UuidShortcodeTest.php b/tests/src/flextype/core/Parsers/Shortcodes/UuidShortcodeTest.php index 1d050ca8..cd0c5f9d 100644 --- a/tests/src/flextype/core/Parsers/Shortcodes/UuidShortcodeTest.php +++ b/tests/src/flextype/core/Parsers/Shortcodes/UuidShortcodeTest.php @@ -5,4 +5,10 @@ declare(strict_types=1); test('uuid shortcode', function () { expect(strings(parsers()->shortcodes()->parse('(uuid)'))->length() > 0)->toBeTrue(); expect(strings(parsers()->shortcodes()->parse('(uuid:4)'))->length() > 0)->toBeTrue(); +}); + +test('uuid shortcode disabled', function () { + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.uuid.enabled', false); + expect(parsers()->shortcodes()->parse("(uuid)"))->toBe(''); + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.uuid.enabled', true); }); \ No newline at end of file diff --git a/tests/src/flextype/core/Parsers/Shortcodes/VarShortcodeTest.php b/tests/src/flextype/core/Parsers/Shortcodes/VarShortcodeTest.php index ee13f79c..b9c2c22b 100644 --- a/tests/src/flextype/core/Parsers/Shortcodes/VarShortcodeTest.php +++ b/tests/src/flextype/core/Parsers/Shortcodes/VarShortcodeTest.php @@ -19,4 +19,10 @@ test('var shortcode', function () { expect(entries()->create('zed', ['title' => '(var set:zed)Zed(/var)(var:zed)']))->toBeTrue(); expect(entries()->fetch('zed')['title'])->toBe('Zed'); +}); + +test('var shortcode disabled', function () { + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.var.enabled', false); + expect(parsers()->shortcodes()->parse("(var set:bar value:Bar)"))->toBe(''); + registry()->set('flextype.settings.parsers.shortcodes.shortcodes.var.enabled', true); }); \ No newline at end of file