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

feat(shortcodes): add eval shortcode

This commit is contained in:
Awilum
2022-05-27 16:34:00 +03:00
parent 0d72580bbc
commit 5fe6c9a13e
4 changed files with 62 additions and 1 deletions

View File

@@ -608,6 +608,9 @@ parsers:
calc:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/CalcShortcode.php"
eval:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/EvalShortcode.php"
# CORS
#

View File

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