mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
This commit is contained in:
parent
f4f8ab5181
commit
25f36eaf54
3 changed files with 152 additions and 0 deletions
|
|
@ -228,4 +228,28 @@ LIQUID
|
|||
// Should return the fallback value
|
||||
$this->assertStringContainsString('Not Found', $result);
|
||||
}
|
||||
|
||||
public function test_plugin_with_group_by_filter(): void
|
||||
{
|
||||
$plugin = Plugin::factory()->create([
|
||||
'markup_language' => 'liquid',
|
||||
'render_markup' => <<<'LIQUID'
|
||||
{{ collection | group_by: 'age' | json }}
|
||||
LIQUID
|
||||
,
|
||||
'data_payload' => [
|
||||
'collection' => [
|
||||
['name' => 'Ryan', 'age' => 35],
|
||||
['name' => 'Sara', 'age' => 29],
|
||||
['name' => 'Jimbob', 'age' => 29],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$result = $plugin->render('full');
|
||||
|
||||
// Should output JSON representation of grouped data
|
||||
$this->assertStringContainsString('"35":[{"name":"Ryan","age":35}]', $result);
|
||||
$this->assertStringContainsString('"29":[{"name":"Sara","age":29},{"name":"Jimbob","age":29}]', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue