Correcting duplicate class defines in the test cases that was causing tests to fail.

Added Router::reload(); to ViewTest::setUp()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5341 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-06-23 07:44:39 +00:00
parent 90299c0d0e
commit 65cdc377a6
3 changed files with 174 additions and 289 deletions

View file

@ -26,42 +26,38 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1); define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
require_once LIBS.'../app_helper.php';
require_once LIBS.DS.'model'.DS.'model.php';
require_once LIBS.DS.'view'.DS.'helper.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'ajax.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'html.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'form.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'javascript.php';
require_once LIBS.DS.'controller'.DS.'controller.php';
class AjaxTestController extends Controller {
var $name = 'AjaxTest';
var $uses = null;
}
class PostAjaxTest extends Model {
var $primaryKey = 'id';
var $useTable = false;
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
} }
}
require_once LIBS.'../app_helper.php';
require_once LIBS.DS.'model'.DS.'model.php';
require_once LIBS.DS.'view'.DS.'helper.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'ajax.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'html.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'form.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'javascript.php';
require_once LIBS.DS.'controller'.DS.'controller.php';
if (!class_exists('TheTestController')) {
class TheTestController extends Controller {
var $name = 'TheTest';
var $uses = null;
}
}
if (!class_exists('Post')) {
class Post extends Model {
var $primaryKey = 'id';
var $useTable = false;
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
}
}
}
/** /**
* Short description for class. * Short description for class.
@ -77,9 +73,9 @@ class AjaxTest extends UnitTestCase {
$this->Ajax->Form = new FormHelper(); $this->Ajax->Form = new FormHelper();
$this->Ajax->Javascript = new JavascriptHelper(); $this->Ajax->Javascript = new JavascriptHelper();
$this->Ajax->Form->Html =& $this->Ajax->Html; $this->Ajax->Form->Html =& $this->Ajax->Html;
$view = new View(new TheTestController()); $view = new View(new AjaxTestController());
ClassRegistry::addObject('view', $view); ClassRegistry::addObject('view', $view);
ClassRegistry::addObject('Post', new Post()); ClassRegistry::addObject('PostAjaxTest', new PostAjaxTest());
} }
function testEvalScripts() { function testEvalScripts() {
@ -93,12 +89,12 @@ class AjaxTest extends UnitTestCase {
} }
function testAutoComplete() { function testAutoComplete() {
$result = $this->Ajax->autoComplete('Post/title' , '/posts', array('minChars' => 2)); $result = $this->Ajax->autoComplete('PostAjaxTest/title' , '/posts', array('minChars' => 2));
$this->assertPattern('/^<input[^<>]+name="data\[Post\]\[title\]"[^<>]+autocomplete="off"[^<>]+\/>/', $result); $this->assertPattern('/^<input[^<>]+name="data\[PostAjaxTest\]\[title\]"[^<>]+autocomplete="off"[^<>]+\/>/', $result);
$this->assertPattern('/<div[^<>]+id="PostTitle_autoComplete"[^<>]*><\/div>/', $result); $this->assertPattern('/<div[^<>]+id="PostAjaxTestTitle_autoComplete"[^<>]*><\/div>/', $result);
$this->assertPattern('/<div[^<>]+class="auto_complete"[^<>]*><\/div>/', $result); $this->assertPattern('/<div[^<>]+class="auto_complete"[^<>]*><\/div>/', $result);
$this->assertPattern('/<\/div>\s+<script type="text\/javascript">new Ajax\.Autocompleter\(\'PostTitle\', \'PostTitle_autoComplete\', \'\/posts\',/', $result); $this->assertPattern('/<\/div>\s+<script type="text\/javascript">new Ajax\.Autocompleter\(\'PostAjaxTestTitle\', \'PostAjaxTestTitle_autoComplete\', \'\/posts\',/', $result);
$this->assertPattern('/<script(.*)>(.*) {minChars:2}\);/', $result); $this->assertPattern('/<script(.*)>(.*) {minChars:2}\);/', $result);
$this->assertPattern('/<\/script>$/', $result); $this->assertPattern('/<\/script>$/', $result);
} }

View file

@ -26,204 +26,139 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1); define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
require_once LIBS.'../app_helper.php';
require_once LIBS.'class_registry.php';
require_once LIBS.DS.'view'.DS.'view.php';
require_once LIBS.DS.'view'.DS.'helper.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'html.php';
require_once LIBS.DS.'view'.DS.'helpers'.DS.'form.php';
require_once LIBS.DS.'controller'.DS.'controller.php';
require_once LIBS.DS.'model'.DS.'model.php';
class ContactTestController extends Controller {
var $name = 'ContactTest';
var $uses = null;
}
class Contact extends Model {
var $primaryKey = 'id';
var $useTable = false;
var $name = 'Contact';
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'published', 'type' => 'date', 'null' => true, 'default' => null, 'length' => null),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
}
}
class UserForm extends Model {
var $useTable = false;
var $primaryKey = 'id';
var $name = 'UserForm';
var $hasMany = array('OpenidUrl' => array('className' => 'OpenidUrl', 'foreignKey' => 'user_form_id'));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
}
}
class OpenidUrl extends Model {
var $useTable = false;
var $primaryKey = 'id';
var $name = 'OpenidUrl';
var $belongsTo = array('UserForm' => array('className' => 'UserForm', 'foreignKey' => 'user_form_id'));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'user_form_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'url', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),));
} }
require_once LIBS.'../app_helper.php'; function beforeValidate() {
require_once LIBS.'class_registry.php'; $this->invalidate('openid_not_registered');
require_once LIBS.DS.'view'.DS.'view.php'; return true;
require_once LIBS.DS.'view'.DS.'helper.php'; }
require_once LIBS.DS.'view'.DS.'helpers'.DS.'html.php'; }
require_once LIBS.DS.'view'.DS.'helpers'.DS.'form.php';
require_once LIBS.DS.'controller'.DS.'controller.php';
require_once LIBS.DS.'model'.DS.'model.php';
if (!class_exists('TheTestController')) { class ValidateUser extends Model {
class TheTestController extends Controller { var $primaryKey = 'id';
var $name = 'TheTest'; var $useTable = false;
var $uses = null; var $name = 'ValidateUser';
} var $hasOne = array('ValidateProfile' => array('className' => 'ValidateProfile', 'foreignKey' => 'user_id'));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'email', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
} }
/** function beforeValidate() {
* Short description for class. $this->invalidate('email');
* return false;
* @package cake.tests }
* @subpackage cake.tests.cases.libs.view.helpers }
*/
class Contact extends Model {
var $primaryKey = 'id';
var $useTable = false;
var $name = 'Contact';
function loadInfo() { class ValidateProfile extends Model {
return new Set(array( var $primaryKey = 'id';
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), var $useTable = false;
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), var $name = 'ValidateProfile';
array('name' => 'published', 'type' => 'date', 'null' => true, 'default' => null, 'length' => null), var $hasOne = array('ValidateItem' => array('className' => 'ValidateItem', 'foreignKey' => 'profile_id'));
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), var $belongsTo = array('ValidateUser' => array('className' => 'ValidateUser', 'foreignKey' => 'user_id'));
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
)); function loadInfo() {
} return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'user_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'full_name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'city', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
} }
/** function beforeValidate() {
* Short description for class. $this->invalidate('full_name');
* $this->invalidate('city');
* @package cake.tests return false;
* @subpackage cake.tests.cases.libs.view.helpers }
*/ }
class UserForm extends Model {
var $useTable = false;
var $primaryKey = 'id';
var $name = 'UserForm';
var $hasMany = array('OpenidUrl' => array( class ValidateItem extends Model {
'className' => 'OpenidUrl', var $primaryKey = 'id';
'foreignKey' => 'user_form_id' var $useTable = false;
)); var $name = 'ValidateItem';
var $belongsTo = array('ValidateProfile' => array('className' => 'ValidateProfile', 'foreignKey' => 'profile_id'));
function loadInfo() { function loadInfo() {
return new Set(array( return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), array('name' => 'profile_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) array('name' => 'description', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
)); array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
} array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)));
} }
/** function beforeValidate() {
* Short description for class. $this->invalidate('description');
* return false;
* @package cake.tests
* @subpackage cake.tests.cases.libs.view.helpers
*/
class OpenidUrl extends Model {
var $useTable = false;
var $primaryKey = 'id';
var $name = 'OpenidUrl';
var $belongsTo = array('UserForm' => array(
'className' => 'UserForm',
'foreignKey' => 'user_form_id'
));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'user_form_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'url', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
));
}
function beforeValidate() {
$this->invalidate('openid_not_registered');
return true;
}
} }
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.view.helpers
*/
class ValidateUser extends Model {
var $primaryKey = 'id';
var $useTable = false;
var $name = 'ValidateUser';
var $hasOne = array('ValidateProfile' => array(
'className' => 'ValidateProfile',
'foreignKey' => 'user_id'
));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'email', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
}
function beforeValidate() {
$this->invalidate('email');
return false;
}
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.view.helpers
*/
class ValidateProfile extends Model {
var $primaryKey = 'id';
var $useTable = false;
var $name = 'ValidateProfile';
var $hasOne = array('ValidateItem' => array(
'className' => 'ValidateItem',
'foreignKey' => 'profile_id'
));
var $belongsTo = array('ValidateUser' => array(
'className' => 'ValidateUser',
'foreignKey' => 'user_id'
));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'user_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'full_name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'city', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
}
function beforeValidate() {
$this->invalidate('full_name');
$this->invalidate('city');
return false;
}
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.view.helpers
*/
class ValidateItem extends Model {
var $primaryKey = 'id';
var $useTable = false;
var $name = 'ValidateItem';
var $belongsTo = array('ValidateProfile' => array(
'className' => 'ValidateProfile',
'foreignKey' => 'profile_id'
));
function loadInfo() {
return new Set(array(
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'profile_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'description', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
));
}
function beforeValidate() {
$this->invalidate('description');
return false;
}
}
/** /**
* Short description for class. * Short description for class.
* *
@ -235,7 +170,7 @@ class FormHelperTest extends CakeTestCase {
function startTest($method) { function startTest($method) {
$this->Form =& new FormHelper(); $this->Form =& new FormHelper();
$this->Form->Html =& new HtmlHelper(); $this->Form->Html =& new HtmlHelper();
$this->Controller =& new TheTestController(); $this->Controller =& new ContactTestController();
$this->View =& new View($this->Controller); $this->View =& new View($this->Controller);
ClassRegistry::addObject('view', $view); ClassRegistry::addObject('view', $view);
ClassRegistry::addObject('Contact', new Contact()); ClassRegistry::addObject('Contact', new Contact());
@ -254,14 +189,8 @@ class FormHelperTest extends CakeTestCase {
$this->UserForm =& new UserForm(); $this->UserForm =& new UserForm();
$this->UserForm->OpenidUrl =& new OpenidUrl(); $this->UserForm->OpenidUrl =& new OpenidUrl();
$data = array( $data = array('UserForm' => array('name' => 'user'),
'UserForm' => array( 'OpenidUrl' => array('url' => 'http://www.cakephp.org'));
'name' => 'user'
),
'OpenidUrl' => array(
'url' => 'http://www.cricava.com'
)
);
$result = $this->UserForm->OpenidUrl->create($data); $result = $this->UserForm->OpenidUrl->create($data);
$this->assertTrue($result); $this->assertTrue($result);
@ -272,12 +201,7 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->create('UserForm', array('type' => 'post', 'action' => 'login')); $result = $this->Form->create('UserForm', array('type' => 'post', 'action' => 'login'));
$this->assertPattern('/^<form\s+id="[^"]+"\s+method="post"\s+action="\/user_forms\/login\/"[^>]*>$/', $result); $this->assertPattern('/^<form\s+id="[^"]+"\s+method="post"\s+action="\/user_forms\/login\/"[^>]*>$/', $result);
$expected = array( $expected = array('OpenidUrl' => array('openid_not_registered' => 1));
'OpenidUrl' => array(
'openid_not_registered' => 1
)
);
$this->assertEqual($this->Form->validationErrors, $expected); $this->assertEqual($this->Form->validationErrors, $expected);
$result = $this->Form->error('OpenidUrl.openid_not_registered', 'Error, not registered', array('wrap' => false)); $result = $this->Form->error('OpenidUrl.openid_not_registered', 'Error, not registered', array('wrap' => false));
@ -291,14 +215,8 @@ class FormHelperTest extends CakeTestCase {
$this->ValidateUser =& new ValidateUser(); $this->ValidateUser =& new ValidateUser();
$this->ValidateUser->ValidateProfile =& new ValidateProfile(); $this->ValidateUser->ValidateProfile =& new ValidateProfile();
$data = array( $data = array('ValidateUser' => array('name' => 'mariano'),
'ValidateUser' => array( 'ValidateProfile' => array('full_name' => 'Mariano Iglesias'));
'name' => 'mariano'
),
'ValidateProfile' => array(
'full_name' => 'Mariano Iglesias'
)
);
$result = $this->ValidateUser->create($data); $result = $this->ValidateUser->create($data);
$this->assertTrue($result); $this->assertTrue($result);
@ -312,18 +230,9 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->create('ValidateUser', array('type' => 'post', 'action' => 'add')); $result = $this->Form->create('ValidateUser', array('type' => 'post', 'action' => 'add'));
$this->assertPattern('/^<form\s+id="[^"]+"\s+method="post"\s+action="\/validate_users\/add\/"[^>]*>$/', $result); $this->assertPattern('/^<form\s+id="[^"]+"\s+method="post"\s+action="\/validate_users\/add\/"[^>]*>$/', $result);
$expected = array( $expected = array('OpenidUrl' => array('openid_not_registered' => 1),
'OpenidUrl' => array( 'ValidateUser' => array('email' => 1),
'openid_not_registered' => 1 'ValidateProfile' => array('full_name' => 1, 'city' => 1));
),
'ValidateUser' => array(
'email' => 1
),
'ValidateProfile' => array(
'full_name' => 1,
'city' => 1
)
);
$this->assertEqual($this->Form->validationErrors, $expected); $this->assertEqual($this->Form->validationErrors, $expected);
@ -336,17 +245,9 @@ class FormHelperTest extends CakeTestCase {
$this->ValidateUser->ValidateProfile =& new ValidateProfile(); $this->ValidateUser->ValidateProfile =& new ValidateProfile();
$this->ValidateUser->ValidateProfile->ValidateItem =& new ValidateItem(); $this->ValidateUser->ValidateProfile->ValidateItem =& new ValidateItem();
$data = array( $data = array('ValidateUser' => array('name' => 'mariano'),
'ValidateUser' => array( 'ValidateProfile' => array('full_name' => 'Mariano Iglesias'),
'name' => 'mariano' 'ValidateItem' => array('name' => 'Item'));
),
'ValidateProfile' => array(
'full_name' => 'Mariano Iglesias'
),
'ValidateItem' => array(
'name' => 'Item'
)
);
$result = $this->ValidateUser->create($data); $result = $this->ValidateUser->create($data);
$this->assertTrue($result); $this->assertTrue($result);
@ -363,21 +264,10 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->create('ValidateUser', array('type' => 'post', 'action' => 'add')); $result = $this->Form->create('ValidateUser', array('type' => 'post', 'action' => 'add'));
$this->assertPattern('/^<form\s+id="[^"]+"\s+method="post"\s+action="\/validate_users\/add\/"[^>]*>$/', $result); $this->assertPattern('/^<form\s+id="[^"]+"\s+method="post"\s+action="\/validate_users\/add\/"[^>]*>$/', $result);
$expected = array( $expected = array('OpenidUrl' => array('openid_not_registered' => 1),
'OpenidUrl' => array( 'ValidateUser' => array('email' => 1),
'openid_not_registered' => 1 'ValidateProfile' => array('full_name' => 1, 'city' => 1),
), 'ValidateItem' => array('description' => 1));
'ValidateUser' => array(
'email' => 1
),
'ValidateProfile' => array(
'full_name' => 1,
'city' => 1
),
'ValidateItem' => array(
'description' => 1
)
);
$this->assertEqual($this->Form->validationErrors, $expected); $this->assertEqual($this->Form->validationErrors, $expected);
@ -853,5 +743,4 @@ class FormHelperTest extends CakeTestCase {
unset($this->Form); unset($this->Form);
} }
} }
?>
?>

View file

@ -48,6 +48,7 @@
class ViewTest extends UnitTestCase { class ViewTest extends UnitTestCase {
function setUp() { function setUp() {
Router::reload();
$this->PostsController = new PostsController(); $this->PostsController = new PostsController();
$this->PostsController->index(); $this->PostsController->index();
$this->view = new View($this->PostsController); $this->view = new View($this->PostsController);
@ -80,5 +81,4 @@ class ViewTest extends UnitTestCase {
unset($this->PostsController); unset($this->PostsController);
} }
} }
?> ?>