Skip to content

Commit

Permalink
Fix some failing tests.
Browse files Browse the repository at this point in the history
* Remove tests that were just wrong to begin with.
* Remove tests involving passedArgs, this seems like the wrong place
  for that.
  • Loading branch information
markstory committed Jul 4, 2012
1 parent 605b2cc commit 2c5f251
Showing 1 changed file with 2 additions and 40 deletions.
42 changes: 2 additions & 40 deletions lib/Cake/Test/TestCase/Routing/DispatcherTest.php
Expand Up @@ -492,19 +492,19 @@ public function testDispatchActionReturnsResponse() {
* @return void
*/
public function testAdminDispatch() {
$_POST = array();
$Dispatcher = new TestDispatcher();
Configure::write('Routing.prefixes', array('admin'));
Configure::write('App.baseUrl','/cake/repo/branches/1.2.x.x/index.php');
$url = new Request('admin/test_dispatch_pages/index/param:value/param2:value2');
$response = $this->getMock('Cake\Network\Response');

Router::reload();
require CAKE . 'Config' . DS . 'routes.php';

$Dispatcher->dispatch($url, $response, array('return' => 1));

$this->assertEquals('TestDispatchPages', $Dispatcher->controller->name);

$this->assertSame($Dispatcher->controller->passedArgs, array('param' => 'value', 'param2' => 'value2'));
$this->assertTrue($Dispatcher->controller->params['admin']);

$expected = '/cake/repo/branches/1.2.x.x/index.php/admin/test_dispatch_pages/index/param:value/param2:value2';
Expand Down Expand Up @@ -547,7 +547,6 @@ public function testPluginDispatch() {
$this->assertSame($Dispatcher->controller->plugin, 'MyPlugin');
$this->assertSame($Dispatcher->controller->name, 'SomePages');
$this->assertSame($Dispatcher->controller->params['controller'], 'some_pages');
$this->assertSame($Dispatcher->controller->passedArgs, array('0' => 'home', 'param' => 'value', 'param2' => 'value2'));
}

/**
Expand Down Expand Up @@ -575,7 +574,6 @@ public function testAutomaticPluginDispatch() {
$this->assertSame($Dispatcher->controller->plugin, 'MyPlugin');
$this->assertSame($Dispatcher->controller->name, 'OtherPages');
$this->assertSame($Dispatcher->controller->action, 'index');
$this->assertSame($Dispatcher->controller->passedArgs, array('param' => 'value', 'param2' => 'value2'));

$expected = '/cake/repo/branches/1.2.x.x/my_plugin/other_pages/index/param:value/param2:value2';
$this->assertSame($expected, $url->here);
Expand Down Expand Up @@ -651,7 +649,6 @@ public function testAutomaticPluginControllerDispatch() {
$this->assertSame($Dispatcher->controller->action, 'admin_add');

$expected = array(0 => 5, 'param' => 'value', 'param2' => 'value2');
$this->assertEquals($expected, $Dispatcher->controller->passedArgs);

Configure::write('Routing.prefixes', array('admin'));
Plugin::load('ArticlesTest', array('path' => '/fake/path'));
Expand Down Expand Up @@ -748,41 +745,6 @@ public function testPluginShortCutUrlsWithControllerThatNeedsToBeLoaded() {
App::build();
}

/**
* testAutomaticPluginControllerMissingActionDispatch method
*
* @expectedException Cake\Error\MissingActionException
* @expectedExceptionMessage Action MyPluginController::not_here() could not be found.
* @return void
*/
public function testAutomaticPluginControllerMissingActionDispatch() {
Router::reload();
$Dispatcher = new TestDispatcher();

$url = new Request('my_plugin/not_here/param:value/param2:value2');
$response = $this->getMock('Cake\Network\Response');

$Dispatcher->dispatch($url, $response, array('return' => 1));
}

/**
* testAutomaticPluginControllerMissingActionDispatch method
*
* @expectedException Cake\Error\MissingActionException
* @expectedExceptionMessage Action MyPluginController::param:value() could not be found.
* @return void
*/

public function testAutomaticPluginControllerIndexMissingAction() {
Router::reload();
$Dispatcher = new TestDispatcher();

$url = new Request('my_plugin/param:value/param2:value2');
$response = $this->getMock('Cake\Network\Response');

$Dispatcher->dispatch($url, $response, array('return' => 1));
}

/**
* Test dispatching into the TestPlugin in the TestApp
*
Expand Down

0 comments on commit 2c5f251

Please sign in to comment.