Skip to content

Commit

Permalink
Add tests for unique_by working with string as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
dpolac committed May 11, 2016
1 parent f447ec5 commit 28f0fc7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Tests/Fixtures/filters/unique_by_eq.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--TEST--
"unique_by" works with '==' and '===' as parameter
--TEMPLATE--
{% for i in list|unique_by('==') %}
* {{ i.data }}
{% endfor %}
===
{% for i in list|unique_by('===') %}
* {{ i.data }}
{% endfor %}
--DATA--
$obj1 = new \StdClass;
$obj1->data = "a";
$obj2 = new \StdClass;
$obj2->data = "a";
$obj3 = new \StdClass;
$obj3->data = "b";
$obj4 = new \StdClass;
$obj4->data = "c";
return [ 'list' => [$obj1, $obj4, $obj2, $obj3, $obj1, $obj3] ];
--EXPECT--
* a
* c
* b
===
* a
* c
* a
* b

0 comments on commit 28f0fc7

Please sign in to comment.