-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed batch filter clobbers array keys when fill parameter is used
- Loading branch information
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--TEST-- | ||
"batch" filter | ||
--TEMPLATE-- | ||
{% for row in items|batch(3, 'fill') %} | ||
<div class=row> | ||
{% for key, column in row %} | ||
<div class={{ key }}>{{ column }}</div> | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
--DATA-- | ||
return ['items' => ['a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', '123' => 'e']] | ||
--EXPECT-- | ||
<div class=row> | ||
<div class=a>a</div> | ||
<div class=b>b</div> | ||
<div class=c>c</div> | ||
</div> | ||
<div class=row> | ||
<div class=d>d</div> | ||
<div class=123>e</div> | ||
<div class=124>fill</div> | ||
</div> |