mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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:
parent
84739652c8
commit
5893fd3669
1 changed files with 32 additions and 1 deletions
|
@ -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']);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue