Browse Source

Test for calling ErrorAction->setAjaxError() for ajax-based actions

master
Anton Terekhov 12 years ago
parent
commit
3517a6450c
  1. 24
      tests/app/FrontControllerTest.php

24
tests/app/FrontControllerTest.php

@ -47,7 +47,7 @@ class FrontControllerTest extends PHPUnit_Framework_TestCase
$this->getMock('ErrorLayout', array('fetch', 'setException'), array(), 'ErrorLayoutMock');
}
if (!class_exists('ErrorActionMock')) {
$this->getMock('ErrorAction', array(), array(), 'ErrorActionMock', false);
$this->getMock('ErrorAction', array('setAjaxError'), array(), 'ErrorActionMock', false);
}
set_new_overload(array($this, 'newCallback'));
}
@ -231,6 +231,21 @@ class FrontControllerTest extends PHPUnit_Framework_TestCase
/**
* @runInSeparateProcess
*/
public function testExecuteWithAjaxActionError()
{
$this->getMock('userAction');
$_SERVER['REQUEST_URI'] = '/user/account/213';
$this->setConstants(false);
$controller = FrontController::getInstance();
$router = $controller->getRouter();
$router->add('user', 'user/account/:id', 'NewAjax');
$result = $controller->execute();
$this->assertNull($result);
}
/**
* @runInSeparateProcess
*/
public function testExecuteWithAjaxActionProfiler()
{
Config::set('PROFILER', true);
@ -276,6 +291,9 @@ class FrontControllerTest extends PHPUnit_Framework_TestCase
/**
* Used in testExecuteWithAjaxAction
*/
class NewAjaxAction extends AjaxAction{
protected function execute() {}
class NewAjaxAction extends AjaxAction
{
protected function execute()
{
}
}
Loading…
Cancel
Save