Skip to content

Commit

Permalink
Present unqiue sorted middleware (#16034)
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid authored and taylorotwell committed Oct 20, 2016
1 parent 2cfe1b0 commit 35981d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/SortedMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function sortMiddleware($priorityMap, $middlewares)
}
}

return $middlewares;
return array_values(array_unique($middlewares, SORT_REGULAR));
}

/**
Expand Down
10 changes: 2 additions & 8 deletions tests/Routing/RoutingSortedMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public function testMiddlewareCanBeSortedByPriority()
'Something',
'Something',
'Second',
'Something',
'Something',
'Otherthing',
'First:api',
'Third:foo',
'First:foo,bar',
Expand All @@ -28,16 +27,11 @@ public function testMiddlewareCanBeSortedByPriority()
];

$expected = [
'Something',
'Something',
'Something',
'Something',
'First:api',
'First:foo,bar',
'Second',
'Something',
'Something',
'Second',
'Otherthing',
'Third:foo',
'Third',
];
Expand Down

0 comments on commit 35981d4

Please sign in to comment.