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

feat(shortcodes): add type shortcode

This commit is contained in:
Awilum
2022-05-27 17:14:42 +03:00
parent 9274fb42b1
commit 97e6bda8e0
4 changed files with 59 additions and 1 deletions

View File

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

View File

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