Commit 06b28886 authored by Fabien Potencier's avatar Fabien Potencier

added ControllerCollection::all()

parent f99f6ef7
...@@ -54,4 +54,14 @@ class ControllerCollection ...@@ -54,4 +54,14 @@ class ControllerCollection
$this->controllers = array(); $this->controllers = array();
} }
/**
* Gets all controllers.
*
* @return array An array of Controllers
*/
public function all()
{
return $this->controllers;
}
} }
...@@ -49,6 +49,15 @@ class ControllerCollectionTest extends \PHPUnit_Framework_TestCase ...@@ -49,6 +49,15 @@ class ControllerCollectionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(2, count($routes->all())); $this->assertEquals(2, count($routes->all()));
} }
public function testAll()
{
$controllers = new ControllerCollection(new RouteCollection());
$controllers->add($c1 = new Controller(new Route('/foo')));
$controllers->add($c2 = new Controller(new Route('/bar')));
$this->assertEquals(array($c1, $c2), $controllers->all());
}
public function testControllerFreezing() public function testControllerFreezing()
{ {
$routes = new RouteCollection(); $routes = new RouteCollection();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment