Added additional test using ajaxLogin with Dispatcher. Currently fails.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6896 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-05-16 01:33:53 +00:00
parent 84739652c8
commit 5893fd3669

View file

@ -103,6 +103,25 @@ class AuthTestController extends Controller {
return true;
}
}
class AjaxAuthController extends Controller {
var $name = 'AjaxAuth';
var $components = array('Auth');
var $uses = array();
var $testUrl = null;
function beforeFilter() {
$this->Auth->ajaxLogin = 'test_element';
$this->Auth->userModel = 'AuthUser';
}
function add() {
echo 'Added Record';
}
function redirect($url, $status, $exit) {
$this->testUrl = Router::url($url);
return false;
}
}
/**
* Short description for class.
*
@ -488,7 +507,19 @@ class AuthTest extends CakeTestCase {
$result = ob_get_clean();
$this->assertPattern('/test element/', $result);
$this->assertNoPattern('/add/', $result);
$this->assertNoPattern('/add/', $result);
if (!class_exists('dispatcher')) {
require CAKE . 'dispatcher.php';
}
Configure::write('test', true);
ob_start();
$Dispatcher =& new Dispatcher();
$Dispatcher->dispatch('/ajax_auth/add', array('return' => 1));
$result = ob_get_clean();
$this->assertPattern('/test element/', $result);
$this->assertNoPattern('/Added Record/', $result);
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
}