Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
update the test to better use the callback function
  • Loading branch information
antograssiot committed Aug 1, 2015
1 parent abf342f commit 1ca0977
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/TestCase/Collection/Iterator/SortIteratorTest.php
Expand Up @@ -205,22 +205,22 @@ public function testSortDateTime()
new Time('2015-06-30'),
new Time('2013-08-12')
]);
$identity = function ($a) {
return $a;
$callback = function ($a) {
return $a->addYear();
};
$sorted = new SortIterator($items, $identity);
$sorted = new SortIterator($items, $callback);
$expected = [
new Time('2015-06-30'),
new Time('2014-07-21'),
new Time('2013-08-12')
new Time('2016-06-30'),
new Time('2015-07-21'),
new Time('2014-08-12')
];
$this->assertEquals($expected, $sorted->toList());

$sorted = new SortIterator($items, $identity, SORT_ASC);
$sorted = new SortIterator($items, $callback, SORT_ASC);
$expected = [
new Time('2013-08-12'),
new Time('2014-07-21'),
new Time('2015-06-30')
new Time('2014-08-12'),
new Time('2015-07-21'),
new Time('2016-06-30')
];
$this->assertEquals($expected, $sorted->toList());
}
Expand Down

0 comments on commit 1ca0977

Please sign in to comment.