mirror of
https://github.com/flextype/flextype.git
synced 2025-08-07 21:56:33 +02:00
feat(tests): improve tests for directives
This commit is contained in:
@@ -13,4 +13,11 @@ afterEach(function (): void {
|
||||
test('fields directive', function () {
|
||||
entries()->create('field', ['foo' => '@field[id]']);
|
||||
$this->assertEquals('field', entries()->fetch('field')['foo']);
|
||||
});
|
||||
|
||||
test('fields directive disabled', function () {
|
||||
registry()->set('flextype.settings.entries.directives.fields.enabled', false);
|
||||
entries()->create('field', ['foo' => '@field[id]']);
|
||||
$this->assertEquals('@field[id]', entries()->fetch('field')['foo']);
|
||||
registry()->set('flextype.settings.entries.directives.fields.enabled', true);
|
||||
});
|
@@ -14,4 +14,11 @@ test('markdown directive', function () {
|
||||
entries()->create('markdown', ['foo' => '@markdown **Hello world!**']);
|
||||
|
||||
$this->assertEquals('<p> <strong>Hello world!</strong></p>', entries()->fetch('markdown')['foo']);
|
||||
});
|
||||
|
||||
test('markdown directive disabled', function () {
|
||||
registry()->set('flextype.settings.entries.directives.markdown.enabled', false);
|
||||
entries()->create('markdown', ['foo' => '@markdown **Hello world!**']);
|
||||
$this->assertEquals('@markdown **Hello world!**', entries()->fetch('markdown')['foo']);
|
||||
registry()->set('flextype.settings.entries.directives.markdown.enabled', true);
|
||||
});
|
@@ -14,4 +14,11 @@ test('php directive', function () {
|
||||
entries()->create('type-php', ['title' => '@php echo "Foo";']);
|
||||
|
||||
$this->assertEquals('Foo', entries()->fetch('type-php')['title']);
|
||||
});
|
||||
|
||||
test('php directive disabled', function () {
|
||||
registry()->set('flextype.settings.entries.directives.php.enabled', false);
|
||||
entries()->create('type-php', ['title' => '@php echo "Foo";']);
|
||||
$this->assertEquals('@php echo "Foo";', entries()->fetch('type-php')['title']);
|
||||
registry()->set('flextype.settings.entries.directives.php.enabled', true);
|
||||
});
|
@@ -14,4 +14,11 @@ test('shortcodes directive', function () {
|
||||
entries()->create('shortcodes', ['foo' => '@shortcodes (strings prepend:"Hello ")World(/strings)']);
|
||||
|
||||
$this->assertEquals('Hello World', entries()->fetch('shortcodes')['foo']);
|
||||
});
|
||||
|
||||
test('shortcodes directive disabled', function () {
|
||||
registry()->set('flextype.settings.entries.directives.shortcodes.enabled', false);
|
||||
entries()->create('shortcodes', ['foo' => '@shortcodes (strings prepend:"Hello ")World(/strings)']);
|
||||
$this->assertEquals('@shortcodes (strings prepend:"Hello ")World(/strings)', entries()->fetch('shortcodes')['foo']);
|
||||
registry()->set('flextype.settings.entries.directives.shortcodes.enabled', true);
|
||||
});
|
@@ -14,4 +14,11 @@ test('textile directive', function () {
|
||||
entries()->create('textile', ['foo' => '@textile **Hello world!**']);
|
||||
|
||||
$this->assertEquals('<p> <b>Hello world!</b></p>', entries()->fetch('textile')['foo']);
|
||||
});
|
||||
|
||||
test('textile directive disabled', function () {
|
||||
registry()->set('flextype.settings.entries.directives.textile.enabled', false);
|
||||
entries()->create('textile', ['foo' => '@textile **Hello world!**']);
|
||||
$this->assertEquals('@textile **Hello world!**', entries()->fetch('textile')['foo']);
|
||||
registry()->set('flextype.settings.entries.directives.textile.enabled', true);
|
||||
});
|
@@ -41,4 +41,11 @@ test('types directive', function () {
|
||||
$this->assertEquals('{"foo":"Foo"}', entries()->fetch('type-json')['foo']);
|
||||
$this->assertEquals('{"foo": "Foo"}', entries()->fetch('type-json-2')['foo']);
|
||||
$this->assertEquals('[1,2,3,4,5]', entries()->fetch('type-json-3')['foo']);
|
||||
});
|
||||
|
||||
test('types directive disabled', function () {
|
||||
registry()->set('flextype.settings.entries.directives.types.enabled', false);
|
||||
entries()->create('field', ['foo' => '@type[int] 100']);
|
||||
$this->assertEquals('@type[int] 100', entries()->fetch('field')['foo']);
|
||||
registry()->set('flextype.settings.entries.directives.types.enabled', true);
|
||||
});
|
@@ -14,4 +14,11 @@ test('vars directive', function () {
|
||||
entries()->create('type-vars', ['vars' => ['foo' => 'Foo'], 'title' => '@var[foo]']);
|
||||
|
||||
$this->assertEquals('Foo', entries()->fetch('type-vars')['title']);
|
||||
});
|
||||
|
||||
test('vars directive disabled', function () {
|
||||
registry()->set('flextype.settings.entries.directives.vars.enabled', false);
|
||||
entries()->create('type-vars', ['vars' => ['foo' => 'Foo'], 'title' => '@var[foo]']);
|
||||
$this->assertEquals('@var[foo]', entries()->fetch('type-vars')['title']);
|
||||
registry()->set('flextype.settings.entries.directives.vars.enabled', true);
|
||||
});
|
Reference in New Issue
Block a user