Commit ce634a46 authored by Igor Wiedler's avatar Igor Wiedler

no longer expose the ControllerCollection, just provide flushControllerCollection() instead

parent a29f5770
...@@ -77,16 +77,6 @@ class Application extends HttpKernel implements EventSubscriberInterface ...@@ -77,16 +77,6 @@ class Application extends HttpKernel implements EventSubscriberInterface
return $this->routeCollection; return $this->routeCollection;
} }
/**
* Get the collection of controllers.
*
* @return Silex\ControllerCollection
*/
public function getControllerCollection()
{
return $this->controllerCollection;
}
/** /**
* Map a pattern to a callable. * Map a pattern to a callable.
* *
...@@ -235,6 +225,14 @@ class Application extends HttpKernel implements EventSubscriberInterface ...@@ -235,6 +225,14 @@ class Application extends HttpKernel implements EventSubscriberInterface
return $this; return $this;
} }
/**
* Flush the controller collection
*/
public function flushControllerCollection()
{
$this->controllerCollection->flush();
}
/** /**
* Handle the request and deliver the response. * Handle the request and deliver the response.
* *
......
...@@ -94,23 +94,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase ...@@ -94,23 +94,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$routeCollection = $application->getRouteCollection(); $routeCollection = $application->getRouteCollection();
$this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routeCollection); $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routeCollection);
$this->assertEquals(0, count($routeCollection->all())); $this->assertEquals(0, count($routeCollection->all()));
$application->getControllerCollection()->flush(); $application->flushControllerCollection();
$this->assertEquals(2, count($routeCollection->all())); $this->assertEquals(2, count($routeCollection->all()));
} }
public function testGetControllerCollection()
{
$application = new Application();
$application->get('/foo', function() {
return 'foo';
});
$application->get('/bar', function() {
return 'bar';
});
$controllerCollection = $application->getControllerCollection();
$this->assertInstanceOf('Silex\ControllerCollection', $controllerCollection);
}
} }
...@@ -34,7 +34,7 @@ class FunctionalTest extends \PHPUnit_Framework_TestCase ...@@ -34,7 +34,7 @@ class FunctionalTest extends \PHPUnit_Framework_TestCase
}) })
->setRouteName('foo_abc'); ->setRouteName('foo_abc');
$application->getControllerCollection()->flush(); $application->flushControllerCollection();
$routeCollection = $application->getRouteCollection(); $routeCollection = $application->getRouteCollection();
$this->assertInstanceOf('Symfony\Component\Routing\Route', $routeCollection->get('homepage')); $this->assertInstanceOf('Symfony\Component\Routing\Route', $routeCollection->get('homepage'));
$this->assertInstanceOf('Symfony\Component\Routing\Route', $routeCollection->get('foo_abc')); $this->assertInstanceOf('Symfony\Component\Routing\Route', $routeCollection->get('foo_abc'));
......
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