1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-22 04:42:57 +02:00

feat(shortcodes): add const shortcode

This commit is contained in:
Awilum
2022-05-29 11:30:01 +03:00
parent 9ec6a73a7c
commit cd55223e0c
4 changed files with 63 additions and 0 deletions

View File

@@ -645,6 +645,9 @@ parsers:
uuid:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/UuidShortcode.php"
const:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/ConstShortcode.php"
var:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/VarShortcode.php"

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
beforeEach(function() {
filesystem()->directory(PATH['project'] . '/entries')->ensureExists(0755, true);
});
afterEach(function () {
filesystem()->directory(PATH['project'] . '/entries')->delete();
});
test('const shortcode', function () {
define('foo', 'Foo');
expect(entries()->create('const', ['test' => '(const:foo)']))->toBeTrue();
expect(entries()->fetch('const')['test'])->toBe('Foo');
});