Skip to content

Commit

Permalink
Merge branch 'hotfix/router-priority-list' of https://github.com/Soca…
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Jul 25, 2012
2 parents 394c94f + 5d0ca28 commit 0c1b41b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Mvc/Router/PriorityList.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function insert($name, RouteInterface $route, $priority)

$this->routes[$name] = array(
'route' => $route,
'priority' => $priority,
'priority' => (int) $priority,
'serial' => $this->serial++,
);
}
Expand Down
15 changes: 15 additions & 0 deletions tests/Zend/Mvc/Router/PriorityListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,19 @@ public function testLIFOWithPriority()

$this->assertEquals(array('baz', 'bar', 'foo'), $orders);
}

public function testPriorityWithNegativesAndNull()
{
$this->list->insert('foo', new TestAsset\DummyRoute(), null);
$this->list->insert('bar', new TestAsset\DummyRoute(), 1);
$this->list->insert('baz', new TestAsset\DummyRoute(), -1);

$order = array();

foreach ($this->list as $key => $value) {
$orders[] = $key;
}

$this->assertEquals(array('bar', 'foo', 'baz'), $orders);
}
}

0 comments on commit 0c1b41b

Please sign in to comment.