mirror of
https://github.com/flextype/flextype.git
synced 2025-08-13 16:44:36 +02:00
feat(expressions): add const
expression
This commit is contained in:
3
tests/fixtures/settings/settings.yaml
vendored
3
tests/fixtures/settings/settings.yaml
vendored
@@ -112,6 +112,9 @@ entries:
|
||||
field:
|
||||
enabled: true
|
||||
class: "Flextype\\Entries\\Expressions\\FieldExpression"
|
||||
const:
|
||||
enabled: true
|
||||
class: "Flextype\\Entries\\Expressions\\ConstExpression"
|
||||
directives:
|
||||
expressions:
|
||||
enabled: true
|
||||
|
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
|
||||
beforeEach(function() {
|
||||
filesystem()->directory(PATH['project'] . '/entries')->create();
|
||||
});
|
||||
|
||||
afterEach(function (): void {
|
||||
filesystem()->directory(PATH['project'] . '/entries')->delete();
|
||||
});
|
||||
|
||||
test('const expression', function () {
|
||||
define('test-expression-const', 'Foo');
|
||||
entries()->create('const', ['test' => '[[ const("test-expression-const") ]]']);
|
||||
expect(entries()->fetch('const')['test'])->toBe('Foo');
|
||||
});
|
Reference in New Issue
Block a user