Browse Source

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.
Mark Story 10 years ago
parent
commit
366484c270
2 changed files with 0 additions and 33 deletions
  1. 0 5
      src/Http/ActionDispatcher.php
  2. 0 28
      tests/TestCase/Http/ActionDispatcherTest.php

+ 0 - 5
src/Http/ActionDispatcher.php

@@ -61,11 +61,6 @@ class ActionDispatcher
         if ($eventManager) {
             $this->eventManager($eventManager);
         }
-
-        // Compatibility with DispatcherFilters.
-        foreach (DispatcherFactory::filters() as $filter) {
-            $this->addFilter($filter);
-        }
         $this->factory = $factory ?: new ControllerFactory();
     }
 

+ 0 - 28
tests/TestCase/Http/ActionDispatcherTest.php

@@ -19,7 +19,6 @@ use Cake\Http\ActionDispatcher;
 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;
@@ -44,17 +43,6 @@ class ActionDispatcherTest extends TestCase
     }
 
     /**
-     * Teardown
-     *
-     * @return void
-     */
-    public function tearDown()
-    {
-        parent::tearDown();
-        DispatcherFactory::clear();
-    }
-
-    /**
      * Ensure the constructor args end up on the right protected properties.
      *
      * @return void
@@ -70,22 +58,6 @@ class ActionDispatcherTest extends TestCase
     }
 
     /**
-     * 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
      *
      * @return void