diff --git a/tests/Feature/PluginInlineTemplatesTest.php b/tests/Feature/PluginInlineTemplatesTest.php index ce83d9d..fb35344 100644 --- a/tests/Feature/PluginInlineTemplatesTest.php +++ b/tests/Feature/PluginInlineTemplatesTest.php @@ -1,23 +1,15 @@ create([ - 'name' => 'Test Plugin', - 'markup_language' => 'liquid', - 'render_markup' => <<<'LIQUID' +test('renders plugin with inline templates', function () { + $plugin = Plugin::factory()->create([ + 'name' => 'Test Plugin', + 'markup_language' => 'liquid', + 'render_markup' => <<<'LIQUID' {% assign min = 1 %} {% assign max = facts | size %} {% assign diff = max | minus: min %} @@ -39,7 +31,6 @@ class PluginInlineTemplatesTest extends TestCase {% template title_bar %}
@@ -59,32 +50,31 @@ class PluginInlineTemplatesTest extends TestCase %} LIQUID - , - 'data_payload' => [ - 'facts' => ['Fact 1', 'Fact 2', 'Fact 3'], - ], - ]); + , + 'data_payload' => [ + 'facts' => ['Fact 1', 'Fact 2', 'Fact 3'], + ], + ]); - $result = $plugin->render('full'); + $result = $plugin->render('full'); - // Should render both templates - // Check for any of the facts (since random number generation is non-deterministic) - $this->assertTrue( - str_contains($result, 'Fact 1') || - str_contains($result, 'Fact 2') || - str_contains($result, 'Fact 3') - ); - $this->assertStringContainsString('Test Plugin', $result); - $this->assertStringContainsString('Please try to enjoy each fact equally', $result); - $this->assertStringContainsString('class="view view--full"', $result); - } + // Should render both templates + // Check for any of the facts (since random number generation is non-deterministic) + $this->assertTrue( + str_contains($result, 'Fact 1') || + str_contains($result, 'Fact 2') || + str_contains($result, 'Fact 3') + ); + $this->assertStringContainsString('Test Plugin', $result); + $this->assertStringContainsString('Please try to enjoy each fact equally', $result); + $this->assertStringContainsString('class="view view--full"', $result); +}); - public function test_plugin_with_inline_templates_using_with_syntax(): void - { - $plugin = Plugin::factory()->create([ - 'name' => 'Test Plugin', - 'markup_language' => 'liquid', - 'render_markup' => <<<'LIQUID' +test('renders plugin with inline templates using with syntax', function () { + $plugin = Plugin::factory()->create([ + 'name' => 'Test Plugin', + 'markup_language' => 'liquid', + 'render_markup' => <<<'LIQUID' {% assign min = 1 %} {% assign max = facts | size %} {% assign diff = max | minus: min %} @@ -126,31 +116,30 @@ LIQUID %} LIQUID - , - 'data_payload' => [ - 'facts' => ['Fact 1', 'Fact 2', 'Fact 3'], - ], - ]); + , + 'data_payload' => [ + 'facts' => ['Fact 1', 'Fact 2', 'Fact 3'], + ], + ]); - $result = $plugin->render('full'); + $result = $plugin->render('full'); - // Should render both templates - // Check for any of the facts (since random number generation is non-deterministic) - $this->assertTrue( - str_contains($result, 'Fact 1') || - str_contains($result, 'Fact 2') || - str_contains($result, 'Fact 3') - ); - $this->assertStringContainsString('Test Plugin', $result); - $this->assertStringContainsString('Please try to enjoy each fact equally', $result); - $this->assertStringContainsString('class="view view--full"', $result); - } + // Should render both templates + // Check for any of the facts (since random number generation is non-deterministic) + $this->assertTrue( + str_contains($result, 'Fact 1') || + str_contains($result, 'Fact 2') || + str_contains($result, 'Fact 3') + ); + $this->assertStringContainsString('Test Plugin', $result); + $this->assertStringContainsString('Please try to enjoy each fact equally', $result); + $this->assertStringContainsString('class="view view--full"', $result); +}); - public function test_plugin_with_simple_inline_template(): void - { - $plugin = Plugin::factory()->create([ - 'markup_language' => 'liquid', - 'render_markup' => <<<'LIQUID' +test('renders plugin with simple inline template', function () { + $plugin = Plugin::factory()->create([ + 'markup_language' => 'liquid', + 'render_markup' => <<<'LIQUID' {% template simple %}