Skip to content

Commit

Permalink
Add integration test for issue in #9266
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 18, 2016
1 parent f64bd03 commit dd063df
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/TestCase/Routing/DispatcherFactoryTest.php
Expand Up @@ -14,6 +14,8 @@
*/
namespace Cake\Test\TestCase\Routing;

use Cake\Core\Configure;
use Cake\Network\Request;
use Cake\Routing\DispatcherFactory;
use Cake\TestSuite\TestCase;

Expand All @@ -31,6 +33,7 @@ class DispatcherFactoryTest extends TestCase
public function setUp()
{
parent::setUp();
Configure::write('App.namespace', 'TestApp');
DispatcherFactory::clear();
}

Expand Down Expand Up @@ -99,4 +102,32 @@ public function testCreate()
$this->assertInstanceOf('Cake\Routing\Dispatcher', $result);
$this->assertCount(1, $result->filters());
}

/**
* test create() -> dispatch() -> response flow.
*
* @return void
*/
public function testCreateDispatchWithFilters()
{
$url = new Request([
'url' => 'posts',
'params' => [
'controller' => 'Posts',
'action' => 'index',
'pass' => [],
'bare' => true,
]
]);
$response = $this->getMockBuilder('Cake\Network\Response')
->setMethods(['send'])
->getMock();
DispatcherFactory::add('ControllerFactory');
DispatcherFactory::add('Append');

$dispatcher = DispatcherFactory::create();
$result = $dispatcher->dispatch($url, $response);
$this->assertNull($result);
$this->assertEquals('posts index appended content', $response->body());
}
}

0 comments on commit dd063df

Please sign in to comment.