Skip to content
Permalink
Browse files

Don't double bind dispatch filters.

Binding dispatcher filters is done by the Dispatcher for people using
the 'old' setup. Binding here add hidden global state and duplicates the
bindings which is undesirable.
  • Loading branch information...
markstory committed Apr 19, 2016
1 parent 268de40 commit 366484c270c1cd6a85bd5b8f03629380d192a0c3
Showing with 0 additions and 33 deletions.
  1. +0 −5 src/Http/ActionDispatcher.php
  2. +0 −28 tests/TestCase/Http/ActionDispatcherTest.php
@@ -61,11 +61,6 @@ public function __construct($factory = null, $eventManager = null)
if ($eventManager) {
$this->eventManager($eventManager);
}
// Compatibility with DispatcherFilters.
foreach (DispatcherFactory::filters() as $filter) {
$this->addFilter($filter);
}
$this->factory = $factory ?: new ControllerFactory();
}
@@ -19,7 +19,6 @@
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\Network\Session;
use Cake\Routing\DispatcherFactory;
use Cake\Routing\Filter\ControllerFactoryFilter;
use Cake\Routing\Router;
use Cake\TestSuite\TestCase;
@@ -43,17 +42,6 @@ public function setUp()
$this->dispatcher->addFilter(new ControllerFactoryFilter());
}
/**
* Teardown
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
DispatcherFactory::clear();
}
/**
* Ensure the constructor args end up on the right protected properties.
*
@@ -69,22 +57,6 @@ public function testConstructorArgs()
$this->assertAttributeSame($factory, 'factory', $dispatcher);
}
/**
* Ensure that filters connected to the DispatcherFactory are
* also applied
*/
public function testDispatcherFactoryCompat()
{
$filter = $this->getMock(
'Cake\Routing\DispatcherFilter',
['beforeDispatch', 'afterDispatch']
);
DispatcherFactory::add($filter);
$dispatcher = new ActionDispatcher();
$this->assertCount(1, $dispatcher->getFilters());
$this->assertSame($filter, $dispatcher->getFilters()[0]);
}
/**
* Test adding routing filters
*

0 comments on commit 366484c

Please sign in to comment.
You can’t perform that action at this time.