Skip to content
Permalink
Browse files

Update PSR7 integration tests based on feedback.

  • Loading branch information...
markstory committed Jun 17, 2016
1 parent d43864b commit fc6cfe8fe1bfca6708977e546792fe3671f12eda
@@ -18,7 +18,8 @@
use Cake\Network\Session;
use Cake\Routing\DispatcherFactory;
use Cake\Routing\Router;
use Cake\TestSuite\RequestDispatcher;
use Cake\TestSuite\LegacyRequestDispatcher;
use Cake\TestSuite\MiddlewareDispatcher;
use Cake\TestSuite\Stub\Response;
use Cake\Utility\CookieCryptTrait;
use Cake\Utility\Hash;
@@ -384,11 +385,7 @@ public function delete($url)
*/
protected function _sendRequest($url, $method, $data = [])
{
if ($this->_useHttpServer) {
$dispatcher = new MiddlewareDispatcher($this);
} else {
$dispatcher = new RequestDispatcher($this);
}
$dispatcher = $this->_makeDispatcher();
try {
$request = $this->_buildRequest($url, $method, $data);
$response = $dispatcher->execute($request);
@@ -404,6 +401,19 @@ protected function _sendRequest($url, $method, $data = [])
}
}
/**
* Get the correct dispatcher instance.
*
* @return object A dispatcher instance
*/
protected function _makeDispatcher()
{
if ($this->_useHttpServer) {
return new MiddlewareDispatcher($this);
}
return new LegacyRequestDispatcher($this);
}
/**
* Adds additional event spies to the controller/view event manager.
*
@@ -25,7 +25,7 @@
*
* @internal
*/
class RequestDispatcher
class LegacyRequestDispatcher
{
/**
* Constructor

0 comments on commit fc6cfe8

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