mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
adding Doc blocks to everything in tests folder missed in the first pass.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7126 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
e3fea51329
commit
a978fb2661
133 changed files with 3641 additions and 787 deletions
|
@ -1196,7 +1196,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
);
|
||||
$this->assertEqual($controller->params, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAutomaticPluginControllerMissingActionDispatch method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAutomaticPluginControllerMissingActionDispatch() {
|
||||
$_POST = array();
|
||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||
|
@ -1211,7 +1216,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
$expected = 'missingAction';
|
||||
$this->assertIdentical($expected, $controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* testPrefixProtection method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPrefixProtection() {
|
||||
$_POST = array();
|
||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||
|
@ -1228,7 +1238,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
$expected = 'privateAction';
|
||||
$this->assertIdentical($expected, $controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* testChangingParamsFromBeforeFilter method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testChangingParamsFromBeforeFilter() {
|
||||
$Dispatcher =& new TestDispatcher();
|
||||
$url = 'some_posts/index/param:value/param2:value2';
|
||||
|
@ -1243,7 +1258,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
$expected = array('changed');
|
||||
$this->assertIdentical($expected, $controller->params['pass']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testStaticAssets method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testStaticAssets() {
|
||||
Router::reload();
|
||||
$Configure = Configure::getInstance();
|
||||
|
@ -1271,7 +1291,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
|
||||
header('Content-type: text/html');//reset the header content-type without page can render as plain text.
|
||||
}
|
||||
|
||||
/**
|
||||
* testFullPageCachingDispatch method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testFullPageCachingDispatch() {
|
||||
Configure::write('Cache.disable', false);
|
||||
Configure::write('Cache.check', true);
|
||||
|
@ -1361,7 +1386,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
$filename = CACHE . 'views' . DS . Inflector::slug($dispatcher->here) . '.php';
|
||||
unlink($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* testHttpMethodOverrides method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testHttpMethodOverrides() {
|
||||
Router::reload();
|
||||
Router::mapResources('Posts');
|
||||
|
@ -1409,7 +1439,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
|
||||
unset($_POST['_method']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testEnvironmentDetection method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEnvironmentDetection() {
|
||||
$dispatcher =& new Dispatcher();
|
||||
|
||||
|
@ -1509,7 +1544,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
}
|
||||
$this->__loadEnvironment(array_merge(array('reload' => true), $backup));
|
||||
}
|
||||
|
||||
/**
|
||||
* backupEnvironment method
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __backupEnvironment() {
|
||||
return array(
|
||||
'App' => Configure::read('App'),
|
||||
|
@ -1518,7 +1558,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
'SERVER'=> $_SERVER
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* reloadEnvironment method
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __reloadEnvironment() {
|
||||
foreach ($_GET as $key => $val) {
|
||||
unset($_GET[$key]);
|
||||
|
@ -1531,7 +1576,13 @@ class DispatcherTest extends UnitTestCase {
|
|||
}
|
||||
Configure::write('App', array());
|
||||
}
|
||||
|
||||
/**
|
||||
* loadEnvironment method
|
||||
*
|
||||
* @param mixed $env
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __loadEnvironment($env) {
|
||||
if ($env['reload']) {
|
||||
$this->__reloadEnvironment();
|
||||
|
@ -1559,7 +1610,12 @@ class DispatcherTest extends UnitTestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
$_GET = $this->_get;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,12 @@ class CacheTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($settings, $expecting);
|
||||
}
|
||||
|
||||
/**
|
||||
* testWriteEmptyValues method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testWriteEmptyValues() {
|
||||
return;
|
||||
Cache::engine('File', array('path' => TMP . 'tests'));
|
||||
|
|
14
cake/tests/cases/libs/cache/apc.test.php
vendored
14
cake/tests/cases/libs/cache/apc.test.php
vendored
|
@ -104,7 +104,12 @@ class ApcEngineTest extends UnitTestCase {
|
|||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDeleteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDeleteCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('delete_test', $data);
|
||||
|
@ -113,7 +118,12 @@ class ApcEngineTest extends UnitTestCase {
|
|||
$result = Cache::delete('delete_test');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
Cache::config('default');
|
||||
}
|
||||
|
|
7
cake/tests/cases/libs/cache/file.test.php
vendored
7
cake/tests/cases/libs/cache/file.test.php
vendored
|
@ -284,7 +284,12 @@ class FileEngineTest extends CakeTestCase {
|
|||
$result = Cache::clear();
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRemoveWindowsSlashesFromCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRemoveWindowsSlashesFromCache() {
|
||||
$File = new File(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'tmp' . DS . 'dir_map');
|
||||
$File->read(11);
|
||||
|
|
14
cake/tests/cases/libs/cache/memcache.test.php
vendored
14
cake/tests/cases/libs/cache/memcache.test.php
vendored
|
@ -138,7 +138,12 @@ class MemcacheEngineTest extends UnitTestCase {
|
|||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDeleteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDeleteCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('delete_test', $data);
|
||||
|
@ -147,7 +152,12 @@ class MemcacheEngineTest extends UnitTestCase {
|
|||
$result = Cache::delete('delete_test');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
Cache::config('default');
|
||||
}
|
||||
|
|
14
cake/tests/cases/libs/cache/xcache.test.php
vendored
14
cake/tests/cases/libs/cache/xcache.test.php
vendored
|
@ -121,7 +121,12 @@ class XcacheEngineTest extends UnitTestCase {
|
|||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDeleteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDeleteCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('delete_test', $data);
|
||||
|
@ -130,7 +135,12 @@ class XcacheEngineTest extends UnitTestCase {
|
|||
$result = Cache::delete('delete_test');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
Cache::config('default');
|
||||
}
|
||||
|
|
|
@ -165,7 +165,12 @@ class ClassRegistryTest extends UnitTestCase {
|
|||
|
||||
$this->assertTrue($TagCopy->name === 'SomeOtherName');
|
||||
}
|
||||
|
||||
/**
|
||||
* testClassRegistryFlush method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testClassRegistryFlush () {
|
||||
$ArticleTag = ClassRegistry::getObject('RegisterArticleTag');
|
||||
$this->assertTrue(is_a($ArticleTag, 'RegisterArticleTag'));
|
||||
|
@ -175,7 +180,12 @@ class ClassRegistryTest extends UnitTestCase {
|
|||
$this->assertFalse($NoArticleTag);
|
||||
$this->assertTrue(is_a($ArticleTag, 'RegisterArticleTag'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testAddMultiplModels method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAddMultiplModels () {
|
||||
$Article = ClassRegistry::isKeySet('Article');
|
||||
$this->assertFalse($Article);
|
||||
|
@ -211,7 +221,12 @@ class ClassRegistryTest extends UnitTestCase {
|
|||
$Tag = ClassRegistry::getObject('Tag');
|
||||
$this->assertTrue(is_a($Tag, 'RegisterArticleTag'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testPluginAppModel method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPluginAppModel() {
|
||||
$TestRegistryPluginModel = ClassRegistry::isKeySet('TestRegistryPluginModel');
|
||||
$this->assertFalse($TestRegistryPluginModel);
|
||||
|
|
|
@ -610,7 +610,12 @@ HTML;
|
|||
$this->assertIdentical(trim($line), '');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testCalculateCodeCoverage method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testCalculateCodeCoverage() {
|
||||
$manager =& CodeCoverageManager::getInstance();
|
||||
$data = array(
|
||||
|
|
|
@ -406,7 +406,12 @@ class AppImportTest extends UnitTestCase {
|
|||
$file = App::import('File', 'AnotherNewName', false, array(LIBS), 'config.php');
|
||||
$this->assertFalse($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* testLoadingWithSearchArray method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLoadingWithSearchArray () {
|
||||
$type = array('type' => 'File', 'name' => 'RandomName', 'parent' => false, 'file' => 'config.php', 'search' => array(TEST_CAKE_CORE_INCLUDE_PATH ));
|
||||
$file = App::import($type);
|
||||
|
@ -416,7 +421,12 @@ class AppImportTest extends UnitTestCase {
|
|||
$file = App::import($type);
|
||||
$this->assertFalse($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMultipleLoading method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMultipleLoading() {
|
||||
$toLoad = array('I18n', 'Socket');
|
||||
|
||||
|
|
|
@ -29,10 +29,40 @@
|
|||
App::import('Core', array('Component', 'Controller'));
|
||||
|
||||
if (!class_exists('AppController')) {
|
||||
/**
|
||||
* AppController class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class AppController extends Controller {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'App'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'App';
|
||||
/**
|
||||
* uses property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $uses = array();
|
||||
/**
|
||||
* helpers property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $helpers = array();
|
||||
/**
|
||||
* components property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $components = array('Orange' => array('colour' => 'blood orange'));
|
||||
|
||||
}
|
||||
|
@ -46,10 +76,28 @@ if (!class_exists('AppController')) {
|
|||
* @package cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ParamTestComponent extends Object {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'ParamTest'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'ParamTest';
|
||||
|
||||
/**
|
||||
* components property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $components = array('Banana' => array('config' => 'value'));
|
||||
|
||||
/**
|
||||
* initialize method
|
||||
*
|
||||
* @param mixed $controller
|
||||
* @param mixed $settings
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function initialize(&$controller, $settings) {
|
||||
foreach ($settings as $key => $value) {
|
||||
if (is_numeric($key)) {
|
||||
|
|
|
@ -465,32 +465,57 @@ class AclComponentTest extends CakeTestCase {
|
|||
$this->expectError('DbAcl::allow() - Invalid node');
|
||||
$this->assertFalse($this->Acl->deny('Bobs', 'ROOT/printers/DoesNotExist', 'create'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testStartup method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testStartup() {
|
||||
$controller = new Controller();
|
||||
$this->assertTrue($this->Acl->startup($controller));
|
||||
}
|
||||
|
||||
/* The following tests and AclComponent methods are not fully implemented yet
|
||||
|
||||
/**
|
||||
* testDbSetAro method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDbSetAro() {
|
||||
//This method is not implemented in either IniAcl or DbAcl
|
||||
//$result = $this->Acl->setAro('Samir');
|
||||
//$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDbSetAco method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDbSetAco() {
|
||||
//This method is not implemented in either IniAcl or DbAcl
|
||||
//$result = $this->Acl->getAco('printers');
|
||||
//$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDbGetAro method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDbGetAro() {
|
||||
//This method is not implemented in either IniAcl or DbAcl
|
||||
//$result = $this->Acl->getAro('Samir');
|
||||
//$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDbGetAco method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDbGetAco() {
|
||||
//This method is not implemented in either IniAcl or DbAcl
|
||||
//$result = $this->Acl->getAco('tpsReports');
|
||||
|
@ -539,7 +564,12 @@ class AclComponentTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testIniCheck method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testIniCheck() {
|
||||
Configure::write('Acl.classname', 'IniAclTest');
|
||||
unset($this->Acl);
|
||||
|
@ -559,7 +589,12 @@ class AclComponentTest extends CakeTestCase {
|
|||
|
||||
$this->assertFalse($this->Acl->check('nobody', 'comments'));
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Acl);
|
||||
}
|
||||
|
|
|
@ -633,7 +633,12 @@ class AuthTest extends CakeTestCase {
|
|||
$_SERVER['HTTP_REFERER'] = $backup;
|
||||
$this->Controller->Session->del('Auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* testEmptyUsernameOrPassword method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEmptyUsernameOrPassword() {
|
||||
$this->AuthUser =& new AuthUser();
|
||||
$user['id'] = 1;
|
||||
|
@ -659,7 +664,12 @@ class AuthTest extends CakeTestCase {
|
|||
$this->assertEqual($user, false);
|
||||
$this->Controller->Session->del('Auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* testInjection method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testInjection() {
|
||||
$this->AuthUser =& new AuthUser();
|
||||
Configure::write('debug', 1);
|
||||
|
@ -697,7 +707,12 @@ class AuthTest extends CakeTestCase {
|
|||
$this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue(is_null($this->Controller->Auth->user()));
|
||||
}
|
||||
|
||||
/**
|
||||
* testCustomRoute method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testCustomRoute() {
|
||||
Router::reload();
|
||||
Router::connect('/:lang/:controller/:action/*', array('lang' => null), array('lang' => '[a-z]{2,3}'));
|
||||
|
@ -721,7 +736,12 @@ class AuthTest extends CakeTestCase {
|
|||
$user = $this->Controller->Auth->user();
|
||||
$this->assertTrue(!!$user);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAdminRoute method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAdminRoute() {
|
||||
Router::reload();
|
||||
$admin = Configure::read('Routing.admin');
|
||||
|
@ -750,7 +770,12 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
Configure::write('Routing.admin', $admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAjaxLogin method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAjaxLogin() {
|
||||
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS));
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = "XMLHttpRequest";
|
||||
|
@ -767,7 +792,12 @@ class AuthTest extends CakeTestCase {
|
|||
$this->assertNoPattern('/Added Record/', $result);
|
||||
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testLoginActionRedirect method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLoginActionRedirect() {
|
||||
Router::reload();
|
||||
$admin = Configure::read('Routing.admin');
|
||||
|
@ -798,7 +828,12 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
Configure::write('Routing.admin', $admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Controller, $this->AuthUser);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,12 @@ TEMPDOC;
|
|||
$this->assertEqual($this->Controller->Session->read('Message.email.message'), $expect);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testSendDebug method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSendDebug() {
|
||||
if (@fsockopen('localhost', 25)) {
|
||||
$this->assertTrue(@fsockopen('localhost', 25), 'Local mail server is running');
|
||||
|
@ -253,7 +258,12 @@ TEMPDOC;
|
|||
$this->assertTrue($this->Controller->Email->send('This is the body of the message'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testContentStripping method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testContentStripping() {
|
||||
$content = "Previous content\n--alt-\nContent-TypeContent-Type:: text/html; charsetcharset==utf-8\nContent-Transfer-Encoding: 7bit";
|
||||
$content .= "\n\n<p>My own html content</p>";
|
||||
|
|
|
@ -302,7 +302,12 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
$this->assertFalse($this->RequestHandler->isPut());
|
||||
$this->assertTrue($this->RequestHandler->isDelete());
|
||||
}
|
||||
|
||||
/**
|
||||
* testClientContentPreference method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testClientContentPreference() {
|
||||
$_SERVER['HTTP_ACCEPT'] = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,*/*';
|
||||
$this->_init();
|
||||
|
@ -321,7 +326,12 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
$this->_init();
|
||||
$this->assertEqual($this->RequestHandler->prefers(), 'html');
|
||||
}
|
||||
|
||||
/**
|
||||
* testCustomContent method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testCustomContent() {
|
||||
$_SERVER['HTTP_ACCEPT'] = 'text/x-mobile,text/html;q=0.9,text/plain;q=0.8,*/*;q=0.5';
|
||||
$this->_init();
|
||||
|
@ -334,7 +344,12 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
$this->RequestHandler->startup($this->Controller);
|
||||
$this->assertEqual($this->RequestHandler->prefers(), 'mobile');
|
||||
}
|
||||
|
||||
/**
|
||||
* testClientProperties method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testClientProperties() {
|
||||
$_SERVER['HTTP_HOST'] = 'localhost:80';
|
||||
$this->assertEqual($this->RequestHandler->getReferrer(), 'localhost');
|
||||
|
@ -356,7 +371,12 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
$_SERVER['HTTP_CLIENTADDRESS'] = '10.0.1.2, 10.0.1.1';
|
||||
$this->assertEqual($this->RequestHandler->getClientIP(), '10.0.1.2');
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->RequestHandler);
|
||||
unset($this->Controller);
|
||||
|
|
|
@ -619,11 +619,21 @@ DIGEST;
|
|||
$data['Model3']['valid'] = '0';
|
||||
$this->assertTrue($this->Controller->data == $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* testLoginValidation method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLoginValidation() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testValidateHasManyModel method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testValidateHasManyModel() {
|
||||
$this->Controller->Security->startup($this->Controller);
|
||||
$key = $this->Controller->params['_Token']['key'];
|
||||
|
@ -664,7 +674,12 @@ DIGEST;
|
|||
|
||||
$this->assertTrue($this->Controller->data == $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* testLoginRequest method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLoginRequest() {
|
||||
$this->Controller->Security->startup($this->Controller);
|
||||
$realm = 'cakephp.org';
|
||||
|
@ -679,7 +694,12 @@ DIGEST;
|
|||
$this->assertPattern('/realm="'.$realm.'"/', $result);
|
||||
$this->assertPattern('/qop="auth"/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testGenerateDigestResponseHash method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGenerateDigestResponseHash() {
|
||||
$this->Controller->Security->startup($this->Controller);
|
||||
$realm = 'cakephp.org';
|
||||
|
@ -704,7 +724,12 @@ DIGEST;
|
|||
md5(env('REQUEST_METHOD') . ':' . $data['uri']));
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testLoginCredentials method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLoginCredentials() {
|
||||
$this->Controller->Security->startup($this->Controller);
|
||||
$_SERVER['PHP_AUTH_USER'] = $user = 'Willy Test';
|
||||
|
@ -740,7 +765,12 @@ DIGEST;
|
|||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testParseDigestAuthData method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testParseDigestAuthData() {
|
||||
$this->Controller->Security->startup($this->Controller);
|
||||
$digest = <<<DIGEST
|
||||
|
@ -770,6 +800,13 @@ DIGEST;
|
|||
$result = $this->Controller->Security->parseDigestAuthData('');
|
||||
$this->assertNull($result);
|
||||
}
|
||||
/**
|
||||
* sortFields method
|
||||
*
|
||||
* @param mixed $fields
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __sortFields($fields) {
|
||||
foreach ($fields as $key => $value) {
|
||||
if ($key[0] != '_' && is_array($fields[$key])) {
|
||||
|
|
|
@ -245,7 +245,12 @@ class SessionComponentTest extends CakeTestCase {
|
|||
$this->assertNull($Session->id());
|
||||
unset($_SESSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSessionCheck method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSessionCheck() {
|
||||
$Session =& new SessionComponent();
|
||||
|
||||
|
@ -263,7 +268,12 @@ class SessionComponentTest extends CakeTestCase {
|
|||
Configure::write('Session.start', true);
|
||||
unset($_SESSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSessionFlash method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSessionFlash() {
|
||||
$Session =& new SessionComponent();
|
||||
|
||||
|
@ -281,7 +291,12 @@ class SessionComponentTest extends CakeTestCase {
|
|||
$Session->setFlash('This is a test message', 'non_existing_layout');
|
||||
$this->assertEqual($Session->read('Message.myFlash'), array('message' => 'This is a test message', 'layout' => 'default', 'params' => array()));
|
||||
}
|
||||
|
||||
/**
|
||||
* testSessionDestroy method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSessionDestroy() {
|
||||
$Session =& new SessionComponent();
|
||||
|
||||
|
|
|
@ -564,7 +564,12 @@ class ControllerTest extends CakeTestCase {
|
|||
$MockController->redirect($url, (int) $code, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testMergeVars method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMergeVars() {
|
||||
$this->skipIf(defined('AppControllerExists'), 'MergeVars will be skipped as it needs a non-existent AppController. As the an AppController class exists, this cannot be run.');
|
||||
|
||||
|
@ -591,7 +596,12 @@ class ControllerTest extends CakeTestCase {
|
|||
$this->assertEqual(count(array_diff($TestController->uses, $uses)), 0);
|
||||
$this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* testReferer method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReferer() {
|
||||
$Controller =& new Controller();
|
||||
$_SERVER['HTTP_REFERER'] = 'http://cakephp.org';
|
||||
|
@ -625,20 +635,35 @@ class ControllerTest extends CakeTestCase {
|
|||
$expected = '/some/path';
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSetAction method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSetAction() {
|
||||
$TestController =& new TestController();
|
||||
$TestController->setAction('index', 1, 2);
|
||||
$expected = array('testId' => 1, 'test2Id' => 2);
|
||||
$this->assertidentical($TestController->data, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testUnimplementedIsAuthorized method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testUnimplementedIsAuthorized() {
|
||||
$TestController =& new TestController();
|
||||
$TestController->isAuthorized();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testValidateErrors method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testValidateErrors() {
|
||||
$TestController =& new TestController();
|
||||
$TestController->constructClasses();
|
||||
|
@ -654,7 +679,12 @@ class ControllerTest extends CakeTestCase {
|
|||
$this->assertIdentical($result, $expected);
|
||||
$this->assertEqual($TestController->validate($comment), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* testPostConditions method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPostConditions() {
|
||||
$Controller =& new Controller();
|
||||
|
||||
|
|
|
@ -90,13 +90,28 @@ class TestScaffoldView extends ScaffoldView {
|
|||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ScaffoldViewTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* fixtures property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.post');
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->Controller = new ScaffoldMockController();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetViewFilename method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetViewFilename() {
|
||||
$this->Controller->action = 'index';
|
||||
$ScaffoldView =& new TestScaffoldView($this->Controller);
|
||||
|
@ -108,7 +123,12 @@ class ScaffoldViewTest extends CakeTestCase {
|
|||
$expected = 'cake' . DS . 'libs' . DS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Controller);
|
||||
}
|
||||
|
|
|
@ -198,7 +198,12 @@ class DebuggerTest extends UnitTestCase {
|
|||
$this->assertPattern('/"whatever",/', $result);
|
||||
$this->assertPattern('/"here"/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDump method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDump() {
|
||||
$var = array('People' => array(
|
||||
array(
|
||||
|
@ -219,7 +224,12 @@ class DebuggerTest extends UnitTestCase {
|
|||
$expected = "<pre>array(\n\t\"People\" => array()\n)</pre>";
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
Configure::write('log', true);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,12 @@ class OrangeComponent extends Object {
|
|||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
if (!class_exists('AppController')) {
|
||||
/**
|
||||
* AppController class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class AppController extends Controller {
|
||||
/**
|
||||
* components property
|
||||
|
@ -326,7 +332,12 @@ class TestErrorHandlerTest extends CakeTestCase {
|
|||
$this->assertPattern("/pages\/about.ctp/", $expected);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingLayout method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingLayout() {
|
||||
restore_error_handler();
|
||||
ob_start();
|
||||
|
@ -341,7 +352,12 @@ class TestErrorHandlerTest extends CakeTestCase {
|
|||
$this->assertPattern("/layouts\/my_layout.ctp/", $expected);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingConnection method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingConnection() {
|
||||
ob_start();
|
||||
$TestErrorHandler = new TestErrorHandler('missingConnection', array(
|
||||
|
@ -351,7 +367,12 @@ class TestErrorHandlerTest extends CakeTestCase {
|
|||
$this->assertPattern('/<h2>Missing Database Connection<\/h2>/', $result);
|
||||
$this->assertPattern('/Article requires a database connection/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingHelperFile method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingHelperFile() {
|
||||
ob_start();
|
||||
$TestErrorHandler = new TestErrorHandler('missingHelperFile', array(
|
||||
|
@ -363,7 +384,12 @@ class TestErrorHandlerTest extends CakeTestCase {
|
|||
$this->assertPattern('/Create the class below in file:/', $result);
|
||||
$this->assertPattern('/\/my_custom.php/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingHelperClass method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingHelperClass() {
|
||||
ob_start();
|
||||
$TestErrorHandler = new TestErrorHandler('missingHelperClass', array(
|
||||
|
@ -375,7 +401,12 @@ class TestErrorHandlerTest extends CakeTestCase {
|
|||
$this->assertPattern('/The helper class <em>MyCustomHelper<\/em> can not be found or does not exist./', $result);
|
||||
$this->assertPattern('/\/my_custom.php/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingComponentFile method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingComponentFile() {
|
||||
ob_start();
|
||||
$TestErrorHandler = new TestErrorHandler('missingComponentFile', array(
|
||||
|
@ -388,7 +419,12 @@ class TestErrorHandlerTest extends CakeTestCase {
|
|||
$this->assertPattern('/Create the class <em>SideboxComponent<\/em> in file:/', $result);
|
||||
$this->assertPattern('/\/sidebox.php/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingComponentClass method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingComponentClass() {
|
||||
ob_start();
|
||||
$TestErrorHandler = new TestErrorHandler('missingComponentClass', array(
|
||||
|
@ -401,7 +437,12 @@ class TestErrorHandlerTest extends CakeTestCase {
|
|||
$this->assertPattern('/Create the class <em>SideboxComponent<\/em> in file:/', $result);
|
||||
$this->assertPattern('/\/sidebox.php/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingModel method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingModel() {
|
||||
ob_start();
|
||||
$TestErrorHandler = new TestErrorHandler('missingModel', array(
|
||||
|
|
|
@ -384,7 +384,13 @@ class FileTest extends UnitTestCase {
|
|||
$result = $TmpFile->delete();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* getTmpFile method
|
||||
*
|
||||
* @param bool $paintSkip
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function _getTmpFile($paintSkip = true) {
|
||||
$tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp';
|
||||
if (is_writable(dirname($tmpFile)) && (!file_exists($tmpFile) || is_writable($tmpFile))) {
|
||||
|
@ -406,61 +412,111 @@ class FileTest extends UnitTestCase {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetFullPathIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetFullPathIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getFullPath();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetNameIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetNameIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getName();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testFilenameIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testFilenameIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->filename();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetExtIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetExtIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getExt();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetMd5IsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetMd5IsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getMd5();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetSizeIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetSizeIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getSize();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetOwnerIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetOwnerIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getOwner();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetGroupIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetGroupIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getGroup();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetChmodIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetChmodIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getChmod();
|
||||
$this->assertError();
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetFolderIsDeprecated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetFolderIsDeprecated() {
|
||||
$someFile =& new File('some_file.txt', false);
|
||||
$someFile->getFolder();
|
||||
|
|
|
@ -382,7 +382,12 @@ class FolderTest extends UnitTestCase {
|
|||
$this->assertIdentical($result, $expected);
|
||||
$folder->delete($folder->pwd().DS.'testme');
|
||||
}
|
||||
|
||||
/**
|
||||
* testFindRecursive method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testFindRecursive() {
|
||||
$folder =& new Folder();
|
||||
$folder->cd(TEST_CAKE_CORE_INCLUDE_PATH);
|
||||
|
@ -414,14 +419,24 @@ class FolderTest extends UnitTestCase {
|
|||
$folder->cd(TEST_CAKE_CORE_INCLUDE_PATH.'config');
|
||||
$folder->delete($folder->pwd().DS.'testme');
|
||||
}
|
||||
|
||||
/**
|
||||
* testConstructWithNonExistantPath method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testConstructWithNonExistantPath() {
|
||||
$folder =& new Folder(TEST_CAKE_CORE_INCLUDE_PATH.'config_non_existant', true);
|
||||
$this->assertTrue(is_dir(TEST_CAKE_CORE_INCLUDE_PATH.'config_non_existant'));
|
||||
$folder->cd(TEST_CAKE_CORE_INCLUDE_PATH);
|
||||
$folder->delete($folder->pwd().'config_non_existant');
|
||||
}
|
||||
|
||||
/**
|
||||
* testDirSize method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDirSize() {
|
||||
$folder =& new Folder(TEST_CAKE_CORE_INCLUDE_PATH.'config_non_existant', true);
|
||||
$this->assertEqual($folder->dirSize(), 0);
|
||||
|
|
|
@ -1724,23 +1724,48 @@ class I18nTest extends UnitTestCase {
|
|||
function testMoRulesTwelve() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testPoRulesThirteen method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPoRulesThirteen() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testMoRulesThirteen method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMoRulesThirteen() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testPoRulesFourteen method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPoRulesFourteen() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testMoRulesFourteen method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMoRulesFourteen() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testSetLanguageWithSession method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSetLanguageWithSession () {
|
||||
$_SESSION['Config']['language'] = 'po';
|
||||
$singular = $this->__Singular();
|
||||
|
@ -1775,7 +1800,12 @@ class I18nTest extends UnitTestCase {
|
|||
$this->assertTrue(in_array('25 everything else (po translated)', $plurals));
|
||||
unset($_SESSION['Config']['language']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testNoCoreTranslation method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNoCoreTranslation () {
|
||||
Configure::write('Config.language', 'po');
|
||||
$singular = $this->__Singular();
|
||||
|
@ -1812,7 +1842,12 @@ class I18nTest extends UnitTestCase {
|
|||
$this->assertFalse(in_array('24 everything else (from core translated)', $corePlurals));
|
||||
$this->assertFalse(in_array('25 everything else (from core translated)', $corePlurals));
|
||||
}
|
||||
|
||||
/**
|
||||
* testPoMultipleLineTranslation method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPoMultipleLineTranslation () {
|
||||
Configure::write('Config.language', 'po');
|
||||
$string = <<<EOD
|
||||
|
@ -1830,18 +1865,33 @@ This is the forth line. (translated)
|
|||
EOD;
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testPoNoTranslationNeeded method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPoNoTranslationNeeded () {
|
||||
Configure::write('Config.language', 'po');
|
||||
$result = __('No Translation needed', true);
|
||||
$this->assertEqual($result, 'No Translation needed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Singular method
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __Singular() {
|
||||
$singular = __('Plural Rule 1', true);
|
||||
return $singular;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural method
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __Plural() {
|
||||
$plurals = array();
|
||||
for ($number = 0; $number <= 25; $number++) {
|
||||
|
@ -1849,12 +1899,22 @@ EOD;
|
|||
}
|
||||
return $plurals;
|
||||
}
|
||||
|
||||
/**
|
||||
* singularFromCore method
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __singularFromCore() {
|
||||
$singular = __('Plural Rule 1 (from core)', true);
|
||||
return $singular;
|
||||
}
|
||||
|
||||
/**
|
||||
* pluralFromCore method
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __pluralFromCore() {
|
||||
for ($number = 0; $number <= 25; $number++) {
|
||||
$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', $number, true), $number );
|
||||
|
|
|
@ -190,32 +190,57 @@ class InflectorTest extends UnitTestCase {
|
|||
$expected = 'this-melts-your-face1-2-3';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testVariableNaming method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testVariableNaming() {
|
||||
$this->assertEqual(Inflector::variable('test_field'), 'testField');
|
||||
$this->assertEqual(Inflector::variable('test_fieLd'), 'testFieLd');
|
||||
$this->assertEqual(Inflector::variable('test field'), 'testField');
|
||||
$this->assertEqual(Inflector::variable('Test_field'), 'testField');
|
||||
}
|
||||
|
||||
/**
|
||||
* testClassNaming method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testClassNaming() {
|
||||
$this->assertEqual(Inflector::classify('artists_genres'), 'ArtistsGenre');
|
||||
$this->assertEqual(Inflector::classify('file_systems'), 'FileSystem');
|
||||
$this->assertEqual(Inflector::classify('news'), 'News');
|
||||
}
|
||||
|
||||
/**
|
||||
* testTableNaming method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testTableNaming() {
|
||||
$this->assertEqual(Inflector::tableize('ArtistsGenre'), 'artists_genres');
|
||||
$this->assertEqual(Inflector::tableize('FileSystem'), 'file_systems');
|
||||
$this->assertEqual(Inflector::tableize('News'), 'news');
|
||||
}
|
||||
|
||||
/**
|
||||
* testHumanization method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testHumanization() {
|
||||
$this->assertEqual(Inflector::humanize('posts'), 'Posts');
|
||||
$this->assertEqual(Inflector::humanize('posts_tags'), 'Posts Tags');
|
||||
$this->assertEqual(Inflector::humanize('file_systems'), 'File Systems');
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Inflector);
|
||||
}
|
||||
|
|
|
@ -766,7 +766,12 @@ class BehaviorTest extends CakeTestCase {
|
|||
$Sample->create();
|
||||
$this->assertIdentical($Sample->save($record2), $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testBehaviorDeleteCallbacks method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBehaviorDeleteCallbacks() {
|
||||
$Apple = new Apple();
|
||||
|
||||
|
@ -795,7 +800,12 @@ class BehaviorTest extends CakeTestCase {
|
|||
$this->assertIdentical($results, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testBehaviorOnErrorCallback method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBehaviorOnErrorCallback() {
|
||||
$Apple = new Apple();
|
||||
|
||||
|
@ -810,7 +820,12 @@ class BehaviorTest extends CakeTestCase {
|
|||
$this->assertIdentical(trim(ob_get_clean()), 'onError trigger success');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testBehaviorValidateCallback method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBehaviorValidateCallback() {
|
||||
$Apple = new Apple();
|
||||
|
||||
|
@ -833,7 +848,12 @@ class BehaviorTest extends CakeTestCase {
|
|||
$Apple->validates();
|
||||
$this->assertIdentical($Apple->whitelist, array('unknown', 'name'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testBehaviorValidateMethods method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBehaviorValidateMethods() {
|
||||
$Apple = new Apple();
|
||||
$Apple->Behaviors->attach('Test');
|
||||
|
@ -846,7 +866,12 @@ class BehaviorTest extends CakeTestCase {
|
|||
$result = $Apple->save(array('name' => 'Regular Apple', 'color' => 'Red'));
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testBehaviorMethodDispatching method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBehaviorMethodDispatching() {
|
||||
$Apple = new Apple();
|
||||
$Apple->Behaviors->attach('Test');
|
||||
|
@ -862,7 +887,12 @@ class BehaviorTest extends CakeTestCase {
|
|||
$expected = "Item.name = 'the remote' AND Location.name = 'the couch'";
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testBehaviorMethodDispatchingWithData method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBehaviorMethodDispatchingWithData() {
|
||||
$Apple = new Apple();
|
||||
$Apple->Behaviors->attach('Test');
|
||||
|
@ -871,7 +901,12 @@ class BehaviorTest extends CakeTestCase {
|
|||
$this->assertTrue($Apple->testData());
|
||||
$this->assertTrue($Apple->data['Apple']['field_2']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testBehaviorTrigger method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBehaviorTrigger() {
|
||||
$Apple = new Apple();
|
||||
$Apple->Behaviors->attach('Test');
|
||||
|
@ -893,7 +928,12 @@ class BehaviorTest extends CakeTestCase {
|
|||
$expected = array('TestBehavior', 'Test2Behavior');
|
||||
$this->assertIdentical($Apple->beforeTestResult, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
ClassRegistry::flush();
|
||||
}
|
||||
|
|
|
@ -3171,7 +3171,12 @@ class ContainableTest extends CakeTestCase {
|
|||
$this->assertTrue(Set::matches('/Comment[article_id=1]', $r));
|
||||
$this->assertTrue(Set::matches('/Comment[id=1]', $r));
|
||||
}
|
||||
|
||||
/**
|
||||
* testOriginalAssociations method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testOriginalAssociations() {
|
||||
$this->Article->Comment->Behaviors->attach('Containable');
|
||||
|
||||
|
@ -3246,7 +3251,14 @@ class ContainableTest extends CakeTestCase {
|
|||
));
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* containments method
|
||||
*
|
||||
* @param mixed $Model
|
||||
* @param array $contain
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __containments(&$Model, $contain = array()) {
|
||||
if (!is_array($Model)) {
|
||||
$result = $Model->containments($contain);
|
||||
|
@ -3260,7 +3272,14 @@ class ContainableTest extends CakeTestCase {
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* assertBindings method
|
||||
*
|
||||
* @param mixed $Model
|
||||
* @param array $expected
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __assertBindings(&$Model, $expected = array()) {
|
||||
$expected = array_merge(array('belongsTo' => array(), 'hasOne' => array(), 'hasMany' => array(), 'hasAndBelongsToMany' => array()), $expected);
|
||||
|
||||
|
@ -3268,7 +3287,15 @@ class ContainableTest extends CakeTestCase {
|
|||
$this->assertEqual(array_keys($Model->$binding), $expect);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* bindings method
|
||||
*
|
||||
* @param mixed $Model
|
||||
* @param array $extra
|
||||
* @param bool $output
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __bindings(&$Model, $extra = array(), $output = true) {
|
||||
$relationTypes = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||
|
||||
|
|
|
@ -525,7 +525,12 @@ class TranslateTest extends CakeTestCase {
|
|||
$this->Model->unbindTranslation($translations);
|
||||
$this->Model->bindTranslation(array('title', 'content'), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMultipleUpdate method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMultipleUpdate() {
|
||||
$this->Model->locale = 'eng';
|
||||
$this->Model->validate['title'] = VALID_NOT_EMPTY;
|
||||
|
@ -559,7 +564,12 @@ class TranslateTest extends CakeTestCase {
|
|||
$this->Model->unbindTranslation($translations);
|
||||
$this->Model->bindTranslation(array('title', 'content'), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMixedCreateUpdateWithArrayLocale method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMixedCreateUpdateWithArrayLocale() {
|
||||
$this->Model->locale = array('cze', 'deu');
|
||||
$data = array('TranslatedItem' => array(
|
||||
|
@ -594,7 +604,12 @@ class TranslateTest extends CakeTestCase {
|
|||
$this->Model->unbindTranslation($translations);
|
||||
$this->Model->bindTranslation(array('title', 'content'), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAttachDetach method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAttachDetach() {
|
||||
$Behavior = $this->Model->Behaviors->Translate;
|
||||
|
||||
|
@ -640,7 +655,12 @@ class TranslateTest extends CakeTestCase {
|
|||
$this->Model->unbindTranslation($translations);
|
||||
$this->Model->bindTranslation(array('title', 'content'), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAnotherTranslateTable method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAnotherTranslateTable() {
|
||||
$Model =& new TranslatedItemWithTable();
|
||||
$Model->locale = 'eng';
|
||||
|
|
|
@ -980,7 +980,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$validTree = $this->NumberTree->verify();
|
||||
$this->assertIdentical($validTree, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRemove method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRemove() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(2, 2);
|
||||
|
@ -1006,7 +1011,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$validTree = $this->NumberTree->verify();
|
||||
$this->assertIdentical($validTree, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRemoveLastTopParent method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRemoveLastTopParent() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(2, 2);
|
||||
|
@ -1033,7 +1043,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$validTree = $this->NumberTree->verify();
|
||||
$this->assertIdentical($validTree, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRemoveAndDelete method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRemoveAndDelete() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(2, 2);
|
||||
|
@ -1059,7 +1074,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$validTree = $this->NumberTree->verify();
|
||||
$this->assertIdentical($validTree, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* testChildren method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testChildren() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(2, 2);
|
||||
|
@ -1081,7 +1101,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
array('NumberTree' => array('id' => 7, 'name' => '1.2.2', 'parent_id' => 5, 'lft' => 11, 'rght' => 12)));
|
||||
$this->assertEqual($total, $expects);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCountChildren method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testCountChildren() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(2, 2);
|
||||
|
@ -1096,7 +1121,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$total = $this->NumberTree->childCount();
|
||||
$this->assertEqual($total, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetParentNode method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetParentNode() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(2, 2);
|
||||
|
@ -1108,7 +1138,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$expects = array('NumberTree' => array('name' => '1.2'));
|
||||
$this->assertIdentical($result, $expects);
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetPath method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetPath() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(2, 2);
|
||||
|
@ -1122,7 +1157,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
array('NumberTree' => array('name' => '1.2.2')));
|
||||
$this->assertIdentical($result, $expects);
|
||||
}
|
||||
|
||||
/**
|
||||
* testNoAmbiguousColumn method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNoAmbiguousColumn() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->bindModel(array('belongsTo' => array('Dummy' =>
|
||||
|
@ -1148,7 +1188,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($total, $expects);
|
||||
}
|
||||
|
||||
/**
|
||||
* testReorderTree method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReorderTree() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(3, 3);
|
||||
|
@ -1170,7 +1215,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$sortedNodes = $this->NumberTree->find('list', array('order' => 'lft'));
|
||||
$this->assertIdentical($nodes, $sortedNodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* testGenerateTreeListWithSelfJoin method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGenerateTreeListWithSelfJoin() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->bindModel(array('belongsTo' => array('Dummy' =>
|
||||
|
@ -1181,7 +1231,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$expected = array(1 => '1. Root', 2 => '_1.1', 3 => '__1.1.1', 4 => '__1.1.2', 5 => '_1.2', 6 => '__1.2.1', 7 => '__1.2.2');
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMoveUpWithScope method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMoveUpWithScope() {
|
||||
$this->Ad =& new Ad();
|
||||
$this->Ad->Behaviors->attach('Tree', array('scope'=>'Campaign'));
|
||||
|
@ -1192,7 +1247,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$this->assertEqual(Set::extract('/Ad/id', $result), array(6, 5));
|
||||
$this->assertEqual(Set::extract('/Campaign/id', $result), array(2, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* testMoveDownWithScope method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMoveDownWithScope() {
|
||||
$this->Ad =& new Ad();
|
||||
$this->Ad->Behaviors->attach('Tree', array('scope'=>'Campaign'));
|
||||
|
@ -1203,7 +1263,12 @@ class NumberTreeCase extends CakeTestCase {
|
|||
$this->assertEqual(Set::extract('/Ad/id', $result), array(5, 6));
|
||||
$this->assertEqual(Set::extract('/Campaign/id', $result), array(2, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* testArraySyntax method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testArraySyntax() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(3, 3);
|
||||
|
|
|
@ -273,7 +273,12 @@ class DboAdodbTest extends CakeTestCase {
|
|||
$result = $this->db->value('00010010001');
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testColumns method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testColumns() {
|
||||
|
||||
}
|
||||
|
|
|
@ -229,7 +229,12 @@ class DboMssqlTest extends CakeTestCase {
|
|||
$result = $this->db->value('1,2', 'float');
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDistinctFields method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDistinctFields() {
|
||||
$result = $this->db->fields($this->model, null, array('DISTINCT Car.country_code'));
|
||||
$expected = array('DISTINCT [Car].[country_code] AS [Car__0]');
|
||||
|
@ -239,7 +244,12 @@ class DboMssqlTest extends CakeTestCase {
|
|||
$expected = array('DISTINCT [Car].[country_code] AS [Car__1]');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDistinctWithLimit method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDistinctWithLimit() {
|
||||
$this->db->read($this->model, array(
|
||||
'fields' => array('DISTINCT MssqlTestModel.city', 'MssqlTestModel.country'),
|
||||
|
@ -248,7 +258,12 @@ class DboMssqlTest extends CakeTestCase {
|
|||
$result = $this->db->getLastQuery();
|
||||
$this->assertPattern('/^SELECT DISTINCT TOP 5/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->model);
|
||||
}
|
||||
|
|
|
@ -244,7 +244,12 @@ class DboMysqlTest extends CakeTestCase {
|
|||
$result = $this->db->value('00010010001');
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testTinyintCasting method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testTinyintCasting() {
|
||||
$this->db->cacheSources = $this->db->testing = false;
|
||||
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
|
||||
|
|
|
@ -59,7 +59,12 @@ class DboOracleTest extends CakeTestCase {
|
|||
$r = 'ORA-01756: quoted string not properly terminated';
|
||||
$this->assertEqual($e, $r);
|
||||
}
|
||||
|
||||
/**
|
||||
* testLastErrorConnect method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLastErrorConnect() {
|
||||
$config = $this->db->config;
|
||||
$this->db->config['password'] = 'keepmeout';
|
||||
|
|
|
@ -249,7 +249,12 @@ class DboPostgresTest extends CakeTestCase {
|
|||
$result = $this->db2->value('1,2', 'float');
|
||||
$this->assertIdentical($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testColumnParsing method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testColumnParsing() {
|
||||
$this->assertEqual($this->db2->column('text'), 'text');
|
||||
$this->assertEqual($this->db2->column('date'), 'date');
|
||||
|
@ -258,7 +263,12 @@ class DboPostgresTest extends CakeTestCase {
|
|||
$this->assertEqual($this->db2->column('time without time zone'), 'time');
|
||||
$this->assertEqual($this->db2->column('timestamp without time zone'), 'datetime');
|
||||
}
|
||||
|
||||
/**
|
||||
* testValueQuoting method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testValueQuoting() {
|
||||
$this->assertEqual($this->db2->value('0', 'integer'), "'0'");
|
||||
$this->assertEqual($this->db2->value('', 'integer'), "DEFAULT");
|
||||
|
|
|
@ -2600,7 +2600,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$expected = array('`TestModel`.`field` AS `AnotherName`');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMergeAssociations method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMergeAssociations() {
|
||||
$data = array(
|
||||
'Article2' => array(
|
||||
|
@ -2864,7 +2869,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$this->testDb->__mergeAssociation($data, $merge, 'Tag', 'hasOne');
|
||||
$this->assertEqual($data, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRenderStatement method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRenderStatement() {
|
||||
$result = $this->testDb->renderStatement('select', array(
|
||||
'fields' => 'id', 'table' => 'table', 'conditions' => 'WHERE 1=1',
|
||||
|
@ -2884,7 +2894,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$result = $this->testDb->renderStatement('delete', array('fields' => 'value=2', 'table' => 'table', 'conditions' => 'WHERE 1=1', 'alias' => 'alias', 'joins' => ''));
|
||||
$this->assertPattern('/^\s*DELETE\s+alias\s+FROM\s+table\s+AS\s+alias\s+WHERE\s+1=1\s*$/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testStatements method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testStatements() {
|
||||
$Article =& ClassRegistry::init('Article');
|
||||
|
||||
|
@ -2921,7 +2936,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$result = $this->testDb->getLastQuery();
|
||||
$this->assertPattern('/^\s*INSERT INTO\s+' . $this->testDb->fullTableName('articles') . '\s+\(`field`\)\s+VALUES\s+\(1\),\s*\(2\)\s*$/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSchema method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSchema() {
|
||||
$Schema =& new CakeSchema();
|
||||
$Schema->tables = array(
|
||||
|
@ -2939,7 +2959,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$result = $this->testDb->dropSchema($Schema, 'table');
|
||||
$this->assertPattern('/^\s*DROP TABLE IF EXISTS\s+' . $this->testDb->fullTableName('table') . ';\s*$/s', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMagicMethodQuerying method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMagicMethodQuerying() {
|
||||
$result = $this->testDb->query('findByFieldName', array('value'), $this->Model);
|
||||
$expected = array('TestModel.field_name' => 'value');
|
||||
|
@ -2978,7 +3003,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$result = $this->testDb->query('directCall', false, $this->Model);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testOrderParsing method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testOrderParsing() {
|
||||
$result = $this->testDb->order("ADDTIME(Event.time_begin, '-06:00:00') ASC");
|
||||
$expected = " ORDER BY ADDTIME(`Event`.`time_begin`, '-06:00:00') ASC";
|
||||
|
@ -3040,7 +3070,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$expected = ' ORDER BY `Anuncio`.`destaque` & 2 DESC';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCalculations method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testCalculations() {
|
||||
$result = $this->testDb->calculate($this->Model, 'count');
|
||||
$this->assertEqual($result, 'COUNT(*) AS `count`');
|
||||
|
@ -3069,7 +3104,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$result = $this->testDb->calculate($this->Model, 'min', 'left');
|
||||
$this->assertEqual($result, 'MIN(`left`) AS `left`');
|
||||
}
|
||||
|
||||
/**
|
||||
* testLength method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLength() {
|
||||
$result = $this->testDb->length('varchar(255)');
|
||||
$expected = 255;
|
||||
|
@ -3107,7 +3147,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$expected = null;
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testBuildIndex method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBuildIndex() {
|
||||
$data = array(
|
||||
'PRIMARY' => array('column' => 'id')
|
||||
|
@ -3130,7 +3175,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$expected = array('UNIQUE KEY MyIndex (`id`, `name`)');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testBuildColumn method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBuildColumn() {
|
||||
$this->expectError();
|
||||
$data = array(
|
||||
|
@ -3154,7 +3204,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$expected = '`testName` DEFAULT NULL';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testIntrospectType method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testIntrospectType() {
|
||||
$this->assertEqual($this->testDb->introspectType(0), 'integer');
|
||||
$this->assertEqual($this->testDb->introspectType(2), 'integer');
|
||||
|
@ -3308,7 +3363,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$result = $this->testDb->value('a bc', 'string');
|
||||
$this->assertEqual($result, "'a bc'");
|
||||
}
|
||||
|
||||
/**
|
||||
* testValue method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testValue() {
|
||||
$result = $this->testDb->value('{$__cakeForeignKey__$}');
|
||||
$this->assertEqual($result, '{$__cakeForeignKey__$}');
|
||||
|
@ -3317,12 +3377,22 @@ class DboSourceTest extends CakeTestCase {
|
|||
$expected = array('\'first\'', 2, '\'third\'');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testReconnect method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReconnect() {
|
||||
$this->testDb->reconnect();
|
||||
$this->assertTrue($this->testDb->connected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRealQueries method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRealQueries() {
|
||||
$this->loadFixtures('Apple', 'Article', 'User', 'Comment', 'Tag');
|
||||
|
||||
|
@ -3385,7 +3455,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$this->assertTrue(Set::matches('/Comment[id=2]', $result));
|
||||
$this->assertFalse(Set::matches('/Comment[id=10]', $result));
|
||||
}
|
||||
|
||||
/**
|
||||
* testName method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testName() {
|
||||
$result = $this->testDb->name('name');
|
||||
$expected = '`name`';
|
||||
|
@ -3403,7 +3478,12 @@ class DboSourceTest extends CakeTestCase {
|
|||
$expected = '`(sm)`';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testLog method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLog() {
|
||||
$this->testDb->logQuery('Query 1');
|
||||
$this->testDb->logQuery('Query 2');
|
||||
|
|
|
@ -225,7 +225,12 @@ class DbAroUserTest extends CakeTestModel {
|
|||
* @subpackage cake.tests.cases.libs.controller.components
|
||||
*/
|
||||
class DbAclTest extends DbAcl {
|
||||
|
||||
/**
|
||||
* construct method
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __construct() {
|
||||
$this->Aro =& new DbAroTest();
|
||||
$this->Aro->Permission =& new DbPermissionTest();
|
||||
|
@ -240,14 +245,29 @@ class DbAclTest extends DbAcl {
|
|||
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
|
||||
*/
|
||||
class AclNodeTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* fixtures property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.aro', 'core.aco', 'core.aros_aco', 'core.aco_action', 'core.auth_user');
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
Configure::write('Acl.classname', 'DbAclTest');
|
||||
Configure::write('Acl.database', 'test_suite');
|
||||
}
|
||||
|
||||
/**
|
||||
* testNode method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNode(){
|
||||
$Aco = new DbAcoTest();
|
||||
$result = Set::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id');
|
||||
|
@ -283,7 +303,12 @@ class AclNodeTest extends CakeTestCase {
|
|||
$result = $Aco->node('');
|
||||
$this->assertEqual($result, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* testNodeArrayFind method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNodeArrayFind() {
|
||||
$Aro = new DbAroTest();
|
||||
Configure::write('DbAclbindMode', 'string');
|
||||
|
@ -296,7 +321,12 @@ class AclNodeTest extends CakeTestCase {
|
|||
$expected = array(4);
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testNodeObjectFind method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNodeObjectFind() {
|
||||
$Aro = new DbAroTest();
|
||||
$Model = new DbAroUserTest();
|
||||
|
@ -311,7 +341,12 @@ class AclNodeTest extends CakeTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testNodeAliasParenting method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNodeAliasParenting() {
|
||||
$Aco = new DbAcoTest();
|
||||
$db =& ConnectionManager::getDataSource('test_suite');
|
||||
|
|
|
@ -4305,7 +4305,12 @@ class ModelTest extends CakeTestCase {
|
|||
$expected = array('Apple'=> array('mytime'=> '03:04:04'));
|
||||
$this->assertEqual($TestModel->data, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testTablePrefixSwitching method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testTablePrefixSwitching() {
|
||||
ConnectionManager::create('database1', array_merge($this->db->config, array('prefix' => 'aaa_')));
|
||||
ConnectionManager::create('database2', array_merge($this->db->config, array('prefix' => 'bbb_')));
|
||||
|
@ -4331,7 +4336,12 @@ class ModelTest extends CakeTestCase {
|
|||
$this->assertEqual($this->db->fullTableName($TestModel, false), 'custom_apples');
|
||||
$this->assertEqual($db1->fullTableName($TestModel, false), 'custom_apples');
|
||||
}
|
||||
|
||||
/**
|
||||
* testDynamicBehaviorAttachment method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDynamicBehaviorAttachment() {
|
||||
$this->loadFixtures('Apple');
|
||||
$TestModel =& new Apple();
|
||||
|
@ -4467,7 +4477,12 @@ class ModelTest extends CakeTestCase {
|
|||
$this->_fixtures[$this->_fixtureClassMap[$class]]->drop($db2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testDisplayField method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDisplayField() {
|
||||
$this->loadFixtures('Post', 'Comment', 'Person');
|
||||
$Post = new Post();
|
||||
|
@ -4478,7 +4493,12 @@ class ModelTest extends CakeTestCase {
|
|||
$this->assertEqual($Person->displayField, 'name');
|
||||
$this->assertEqual($Comment->displayField, 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* testSchema method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSchema() {
|
||||
$Post = new Post();
|
||||
|
||||
|
@ -4500,7 +4520,12 @@ class ModelTest extends CakeTestCase {
|
|||
|
||||
$this->assertEqual($Post->getColumnTypes(), array_combine($columns, $types));
|
||||
}
|
||||
|
||||
/**
|
||||
* testOldQuery method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testOldQuery() {
|
||||
$this->loadFixtures('Article');
|
||||
$Article =& new Article();
|
||||
|
@ -4520,7 +4545,12 @@ class ModelTest extends CakeTestCase {
|
|||
$this->assertTrue(isset($this->db->_queryCache[$query]));
|
||||
$this->assertTrue(is_array($results));
|
||||
}
|
||||
|
||||
/**
|
||||
* testPreparedQuery method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPreparedQuery() {
|
||||
$this->loadFixtures('Article');
|
||||
$Article =& new Article();
|
||||
|
@ -4557,7 +4587,12 @@ class ModelTest extends CakeTestCase {
|
|||
isset($result[0][0]['title'])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* testParameterMismatch method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testParameterMismatch() {
|
||||
$this->loadFixtures('Article');
|
||||
$Article =& new Article();
|
||||
|
@ -4570,7 +4605,12 @@ class ModelTest extends CakeTestCase {
|
|||
ob_end_clean();
|
||||
$this->assertEqual($result, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* testVeryStrangeUseCase method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testVeryStrangeUseCase() {
|
||||
if ($this->db->config['driver'] == 'mssql') {
|
||||
return;
|
||||
|
@ -4586,7 +4626,12 @@ class ModelTest extends CakeTestCase {
|
|||
$result = $Article->query($query, $param);
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* testUnderscoreFieldSave method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testUnderscoreFieldSave() {
|
||||
$this->loadFixtures('UnderscoreField');
|
||||
$UnderscoreField =& new UnderscoreField();
|
||||
|
@ -4606,7 +4651,12 @@ class ModelTest extends CakeTestCase {
|
|||
$currentCount = $UnderscoreField->find('count');
|
||||
$this->assertEqual($currentCount, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* testGroupBy method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGroupBy() {
|
||||
$this->loadFixtures('Project', 'Product', 'Thread', 'Message', 'Bid');
|
||||
$Thread =& new Thread();
|
||||
|
@ -4673,7 +4723,12 @@ class ModelTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSaveDateAsFirstEntry method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSaveDateAsFirstEntry() {
|
||||
$this->loadFixtures('Article');
|
||||
|
||||
|
@ -4694,7 +4749,12 @@ class ModelTest extends CakeTestCase {
|
|||
$this->assertEqual($testResult['Article']['created'], '2008-01-01 00:00:00');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* endTest method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function endTest() {
|
||||
ClassRegistry::flush();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -274,8 +274,26 @@ class SchemaComment extends CakeTestModel {
|
|||
* @subpackage cake.tests.cases.libs.model
|
||||
*/
|
||||
class SchemaTag extends CakeTestModel {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'SchemaTag'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'SchemaTag';
|
||||
/**
|
||||
* useTable property
|
||||
*
|
||||
* @var string 'tags'
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'tags';
|
||||
/**
|
||||
* hasAndBelongsToMany property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $hasAndBelongsToMany = array('SchemaPost');
|
||||
}
|
||||
/**
|
||||
|
@ -285,11 +303,41 @@ class SchemaTag extends CakeTestModel {
|
|||
* @subpackage cake.tests.cases.libs.model
|
||||
*/
|
||||
class SchemaDatatype extends CakeTestModel {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'SchemaDatatype'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'SchemaDatatype';
|
||||
/**
|
||||
* useTable property
|
||||
*
|
||||
* @var string 'datatypes'
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'datatypes';
|
||||
}
|
||||
/**
|
||||
* PostsTag class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
*/
|
||||
class PostsTag extends CakeTestModel {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'PostsTag'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'PostsTag';
|
||||
/**
|
||||
* useTable property
|
||||
*
|
||||
* @var string 'posts_tags'
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'posts_tags';
|
||||
}
|
||||
/**
|
||||
|
@ -299,13 +347,28 @@ class PostsTag extends CakeTestModel {
|
|||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class CakeSchemaTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* fixtures property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.post', 'core.tag', 'core.posts_tag', 'core.comment', 'core.datatype');
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->Schema = new TestAppSchema();
|
||||
}
|
||||
|
||||
/**
|
||||
* testSchemaName method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSchemaName() {
|
||||
$Schema = new CakeSchema();
|
||||
$this->assertEqual(strtolower($Schema->name), strtolower(APP_DIR));
|
||||
|
@ -316,14 +379,24 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
|
||||
Configure::write('App.dir', 'app');
|
||||
}
|
||||
|
||||
/**
|
||||
* testSchemaRead method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSchemaRead() {
|
||||
$read = $this->Schema->read(array('connection'=>'test_suite', 'name'=>'TestApp', 'models' => array('SchemaPost', 'SchemaComment', 'SchemaTag', 'SchemaDatatype')));
|
||||
unset($read['tables']['missing']);
|
||||
$this->assertEqual($read['tables'], $this->Schema->tables);
|
||||
$this->assertIdentical($read['tables']['datatypes']['float_field'], $this->Schema->tables['datatypes']['float_field']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSchemaWrite method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSchemaWrite() {
|
||||
|
||||
$write = $this->Schema->write(array('name'=>'MyOtherApp', 'tables'=> $this->Schema->tables, 'path'=> TMP . 'tests'));
|
||||
|
@ -335,7 +408,12 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
$this->assertEqual($this->Schema->tables, $OtherSchema->tables);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testSchemaComparison method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSchemaComparison() {
|
||||
$New = new MyAppSchema();
|
||||
$compare = $New->compare($this->Schema);
|
||||
|
@ -359,13 +437,23 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
|
||||
$this->assertEqual($expected, $compare);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSchemaLoading method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSchemaLoading() {
|
||||
$Other = $this->Schema->load(array('name'=>'MyOtherApp', 'path'=> TMP . 'tests'));
|
||||
$this->assertEqual($Other->name, 'MyOtherApp');
|
||||
$this->assertEqual($Other->tables, $this->Schema->tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSchemaCreateTable method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSchemaCreateTable() {
|
||||
$db =& ConnectionManager::getDataSource('test_suite');
|
||||
$db->query('CREATE TABLE ' . $db->fullTableName('testdescribes') . ' (id int(11) AUTO_INCREMENT, int_null int(10) unsigned NULL, int_not_null int(10) unsigned NOT NULL, primary key(id));');
|
||||
|
@ -382,7 +470,12 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
|
||||
$db->query('DROP TABLE ' . $this->db->fullTableName('testdescribes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Schema);
|
||||
}
|
||||
|
|
|
@ -284,7 +284,12 @@ class ObjectTest extends UnitTestCase {
|
|||
$result = strtolower($this->object->toString());
|
||||
$this->assertEqual($result, 'testobject');
|
||||
}
|
||||
|
||||
/**
|
||||
* testMethodDispatching method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMethodDispatching() {
|
||||
$this->object->emptyMethod();
|
||||
$expected = array('emptyMethod');
|
||||
|
@ -345,7 +350,12 @@ class ObjectTest extends UnitTestCase {
|
|||
$expected[] = array('methodWithOptionalParam' => array(null));
|
||||
$this->assertIdentical($this->object->methodCalls, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRequestAction method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRequestAction(){
|
||||
$result = $this->object->requestAction('');
|
||||
$this->assertFalse($result);
|
||||
|
@ -406,7 +416,12 @@ class ObjectTest extends UnitTestCase {
|
|||
$expected = 25;
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->object);
|
||||
}
|
||||
|
|
|
@ -1279,7 +1279,12 @@ class RouterTest extends UnitTestCase {
|
|||
$expected = array('pass'=>array('contact'), 'named' => array(), 'plugin'=> null, 'controller'=>'pages', 'action'=>'display');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testParsingWithPrefixes method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testParsingWithPrefixes() {
|
||||
$adminParams = array('prefix' => 'admin', 'admin' => true);
|
||||
Router::connect('/admin/:controller', $adminParams);
|
||||
|
@ -1306,7 +1311,12 @@ class RouterTest extends UnitTestCase {
|
|||
$expected = array('admin');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testPassedArgsOrder method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPassedArgsOrder() {
|
||||
Router::connect('/test2/*', array('controller' => 'pages', 'action' => 'display', 2));
|
||||
Router::connect('/test/*', array('controller' => 'pages', 'action' => 'display', 1));
|
||||
|
@ -1342,7 +1352,12 @@ class RouterTest extends UnitTestCase {
|
|||
$expected = array('protected', 'admin');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRegexRouteMatching method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRegexRouteMatching() {
|
||||
Router::connect('/:locale/:controller/:action/*', array(), array('locale' => 'dan|eng'));
|
||||
|
||||
|
|
|
@ -347,7 +347,12 @@ class SanitizeTest extends CakeTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testStripTags method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testStripTags() {
|
||||
$string = '<h2>Headline</h2><p><a href="http://example.com">My Link</a> could go to a bad site</p>';
|
||||
$expected = 'Headline<p>My Link could go to a bad site</p>';
|
||||
|
@ -364,7 +369,12 @@ class SanitizeTest extends CakeTestCase {
|
|||
$result = Sanitize::stripTags($string, 'h2', 'a');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testFormatColumns method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testFormatColumns() {
|
||||
$this->loadFixtures('DataTest', 'Article');
|
||||
|
||||
|
|
|
@ -122,7 +122,12 @@ class SecurityTest extends UnitTestCase {
|
|||
$this->assertIdentical(strlen(Security::hash($key, 'sha256', true)), 32);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* testCipher method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testCipher() {
|
||||
$length = 10;
|
||||
$txt = '';
|
||||
|
|
|
@ -292,7 +292,12 @@ class SessionTest extends CakeTestCase {
|
|||
$this->Session->write('SessionTestCase', 'This is a Test');
|
||||
$this->assertEqual($this->Session->read('SessionTestCase'), 'This is a Test');
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
$this->Session->del('SessionTestCase');
|
||||
unset($this->Session);
|
||||
|
|
|
@ -1600,7 +1600,12 @@ class SetTest extends UnitTestCase {
|
|||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testStrictKeyCheck method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testStrictKeyCheck() {
|
||||
$set = new Set(array('a' => 'hi'));
|
||||
$this->assertFalse($set->check('a.b'));
|
||||
|
|
|
@ -138,13 +138,23 @@ class SocketTest extends UnitTestCase {
|
|||
$this->Socket->connect();
|
||||
$this->assertEqual($this->Socket->read(26), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* testLastError method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testLastError() {
|
||||
$this->Socket = new CakeSocket();
|
||||
$this->Socket->setLastError(4, 'some error here');
|
||||
$this->assertEqual($this->Socket->lastError(), '4: some error here');
|
||||
}
|
||||
|
||||
/**
|
||||
* testReset method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReset() {
|
||||
$config = array(
|
||||
'persistent' => true,
|
||||
|
@ -157,7 +167,12 @@ class SocketTest extends UnitTestCase {
|
|||
$anotherSocket->reset();
|
||||
$this->assertEqual(array(), $anotherSocket->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Socket);
|
||||
}
|
||||
|
|
|
@ -1532,12 +1532,22 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::email('abc.efg@caphpkeinvalid.com', true));
|
||||
$this->assertFalse(Validation::email('abc@example.abcd', true));
|
||||
}
|
||||
|
||||
/**
|
||||
* testEmailCustomRegex method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEmailCustomRegex() {
|
||||
$this->assertTrue(Validation::email('abc.efg@cakephp.org', null, '/^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i'));
|
||||
$this->assertFalse(Validation::email('abc.efg@com.caphpkeinvalid', null, '/^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testEqualTo method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEqualTo() {
|
||||
$this->assertTrue(Validation::equalTo("1", "1"));
|
||||
$this->assertFalse(Validation::equalTo(1, "1"));
|
||||
|
@ -1546,7 +1556,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::equalTo(0, false));
|
||||
$this->assertFalse(Validation::equalTo(null, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* testIp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testIp() {
|
||||
$this->assertTrue(Validation::ip('0.0.0.0'));
|
||||
$this->assertTrue(Validation::ip('192.168.1.156'));
|
||||
|
@ -1555,19 +1570,34 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::ip('127.0.0.a'));
|
||||
$this->assertFalse(Validation::ip('127.0.0.256'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testMaxLength method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMaxLength() {
|
||||
$this->assertTrue(Validation::maxLength('ab', 3));
|
||||
$this->assertTrue(Validation::maxLength('abc', 3));
|
||||
$this->assertFalse(Validation::maxLength('abcd', 3));
|
||||
}
|
||||
|
||||
/**
|
||||
* testMinLength method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMinLength() {
|
||||
$this->assertFalse(Validation::minLength('ab', 3));
|
||||
$this->assertTrue(Validation::minLength('abc', 3));
|
||||
$this->assertTrue(Validation::minLength('abcd', 3));
|
||||
}
|
||||
|
||||
/**
|
||||
* testUrl method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testUrl() {
|
||||
$this->assertTrue(Validation::url('http://www.cakephp.org'));
|
||||
$this->assertTrue(Validation::url('http://cakephp.org'));
|
||||
|
@ -1596,13 +1626,23 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::url('http://this-domain-is-too-loooooong-by-icann-rules-maximum-length-is-63.com'));
|
||||
$this->assertTrue(Validation::url('http://www.domain.com/blogs/index.php?blog=6&tempskin=_rss2'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testInList method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testInList() {
|
||||
$this->assertTrue(Validation::inList('one', array('one', 'two')));
|
||||
$this->assertTrue(Validation::inList('two', array('one', 'two')));
|
||||
$this->assertFalse(Validation::inList('three', array('one', 'two')));
|
||||
}
|
||||
|
||||
/**
|
||||
* testValidNumber method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testValidNumber() {
|
||||
$this->assertTrue(Validation::custom('12345', VALID_NUMBER));
|
||||
$this->assertTrue(Validation::custom('-12345', VALID_NUMBER));
|
||||
|
@ -1623,7 +1663,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::custom('.2345', VALID_NUMBER));
|
||||
$this->assertFalse(Validation::custom('12345.', VALID_NUMBER));
|
||||
}
|
||||
|
||||
/**
|
||||
* testRange method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRange() {
|
||||
$this->assertFalse(Validation::range(20, 100, 1));
|
||||
$this->assertTrue(Validation::range(20, 1, 100));
|
||||
|
@ -1633,7 +1678,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertTrue(Validation::range(-5, -10, 1));
|
||||
$this->assertFalse(Validation::range('word'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testExtension method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testExtension() {
|
||||
$this->assertTrue(Validation::extension('extension.jpeg'));
|
||||
$this->assertTrue(Validation::extension('extension.JPEG'));
|
||||
|
@ -1657,7 +1707,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::extension(array('noextension', 'extension.JPG', 'extension.gif', 'extension.png')));
|
||||
$this->assertFalse(Validation::extension(array('extension.pdf', 'extension.JPG', 'extension.gif', 'extension.png')));
|
||||
}
|
||||
|
||||
/**
|
||||
* testMoney method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMoney() {
|
||||
$this->assertTrue(Validation::money('$100'));
|
||||
$this->assertTrue(Validation::money('$100.11'));
|
||||
|
@ -1684,7 +1739,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::money('100.1€', 'right'));
|
||||
$this->assertFalse(Validation::money('100.1111€', 'right'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testNumeric method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNumeric() {
|
||||
$this->assertFalse(Validation::numeric('teststring'));
|
||||
$this->assertFalse(Validation::numeric('1.1test'));
|
||||
|
@ -1695,7 +1755,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertTrue(Validation::numeric(2.2));
|
||||
$this->assertTrue(Validation::numeric('2.2'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testPhone method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPhone() {
|
||||
$this->assertFalse(Validation::phone('teststring'));
|
||||
$this->assertFalse(Validation::phone('1-(33)-(333)-(4444)'));
|
||||
|
@ -1712,7 +1777,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertTrue(Validation::phone('1.(333).333.4444'));
|
||||
$this->assertTrue(Validation::phone('1-333-333-4444'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testPostal method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPostal() {
|
||||
$this->assertFalse(Validation::postal('111', null, 'de'));
|
||||
$this->assertFalse(Validation::postal('1111', null, 'de'));
|
||||
|
@ -1759,7 +1829,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::postal('13A89-4333'));
|
||||
$this->assertTrue(Validation::postal('13089-3333'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testSsn method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSsn() {
|
||||
$this->assertFalse(Validation::ssn('111-333', null, 'dk'));
|
||||
$this->assertFalse(Validation::ssn('111111-333', null, 'dk'));
|
||||
|
@ -1775,7 +1850,12 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::ssn('111-33-333', null, 'us'));
|
||||
$this->assertTrue(Validation::ssn('111-33-4333', null, 'us'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testUserDefined method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testUserDefined() {
|
||||
$validator = new CustomValidator;
|
||||
$this->assertFalse(Validation::userDefined('33', $validator, 'customValidate'));
|
||||
|
|
|
@ -374,7 +374,12 @@ class HelperTest extends UnitTestCase {
|
|||
$this->assertEqual($this->View->fieldSuffix, null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testFieldSuffixForDate method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testFieldSuffixForDate() {
|
||||
// PHP4 reference hack
|
||||
ClassRegistry::removeObject('view');
|
||||
|
@ -394,7 +399,12 @@ class HelperTest extends UnitTestCase {
|
|||
$this->assertEqual($this->View->association, null);
|
||||
$this->assertEqual($this->View->fieldSuffix, 'month');
|
||||
}
|
||||
|
||||
/**
|
||||
* testMulitDimensionValue method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMulitDimensionValue() {
|
||||
$this->Helper->data = array();
|
||||
for($i = 0; $i < 2; $i++) {
|
||||
|
@ -422,7 +432,12 @@ class HelperTest extends UnitTestCase {
|
|||
$result = $this->Helper->value('0.id');
|
||||
$this->assertEqual($result, 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* testClean method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testClean() {
|
||||
$result = $this->Helper->clean(array());
|
||||
$this->assertEqual($result, null);
|
||||
|
@ -434,7 +449,12 @@ class HelperTest extends UnitTestCase {
|
|||
$this->assertEqual($result, 'with something');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Helper, $this->View);
|
||||
ClassRegistry::flush();
|
||||
|
|
|
@ -611,7 +611,12 @@ class AjaxTest extends CakeTestCase {
|
|||
$this->assertNoPattern('/<script[^<>]+[^type]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*var sliderId = new Control.Slider\(\'sliderId\', \'trackId\', {range:\$R\(10, 30\)}\);\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRemoteFunction method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRemoteFunction() {
|
||||
$result = $this->Ajax->remoteFunction(array('complete' => 'testComplete();'));
|
||||
$expected = 'new Ajax.Request(\'/\', {asynchronous:true, evalScripts:true, onComplete:function(request, json) {testComplete();}})';
|
||||
|
@ -628,7 +633,12 @@ class AjaxTest extends CakeTestCase {
|
|||
$result = $this->Ajax->remoteFunction(array('update' => 'myDiv', 'confirm' => 'Are you sure?'));
|
||||
$expected = 'if (confirm(\'Are you sure?\')) { new Ajax.Updater(\'myDiv\',\'/\', {asynchronous:true, evalScripts:true, requestHeaders:[\'X-Update\', \'myDiv\']}); } else { event.returnValue = false; return false; }';
|
||||
}
|
||||
|
||||
/**
|
||||
* testDiv method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDiv() {
|
||||
$oldXUpdate = env('HTTP_X_UPDATE');
|
||||
|
||||
|
@ -654,7 +664,12 @@ class AjaxTest extends CakeTestCase {
|
|||
|
||||
$_SERVER['HTTP_X_UPDATE'] = $oldXUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* testAfterRender method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAfterRender() {
|
||||
$oldXUpdate = env('HTTP_X_UPDATE');
|
||||
$this->Ajax->Javascript =& new TestJavascriptHelper();
|
||||
|
@ -676,7 +691,12 @@ class AjaxTest extends CakeTestCase {
|
|||
|
||||
$_SERVER['HTTP_X_UPDATE'] = $oldXUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* testEditor method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEditor() {
|
||||
$result = $this->Ajax->editor('myDiv', '/');
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript"[^<>]*>.+<\/script>$/s', $result);
|
||||
|
@ -703,7 +723,12 @@ class AjaxTest extends CakeTestCase {
|
|||
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '.+' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/s', $result);
|
||||
$this->assertPattern('/^.+\s*' . str_replace('/', '\\/', preg_quote('var myVar = new Ajax.InPlaceEditor(\'myDiv\', \'/\', {ajaxOptions:{asynchronous:true, evalScripts:true}});')) . '\s*.+$/s', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Ajax);
|
||||
ClassRegistry::flush();
|
||||
|
|
|
@ -57,7 +57,12 @@ class CacheHelperTest extends UnitTestCase {
|
|||
function setUp() {
|
||||
$this->Cache = new CacheHelper();
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Cache);
|
||||
}
|
||||
|
|
|
@ -3652,7 +3652,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetFormCreate method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testGetFormCreate() {
|
||||
$result = $this->Form->create('Contact', array('type' => 'get'));
|
||||
$this->assertTags($result, array('form' => array('id' => 'ContactAddForm', 'method' => 'get', 'action' => '/contacts/add/')));
|
||||
|
@ -3667,7 +3672,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
$result = $this->Form->text('user_form');
|
||||
$this->assertTags($result, array('input' => array('name' => 'user_form', 'type' => 'text', 'value' => '', 'id' => 'ContactUserForm')));
|
||||
}
|
||||
|
||||
/**
|
||||
* testEditFormWithData method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEditFormWithData() {
|
||||
$this->Form->data = array('Person' => array(
|
||||
'id' => 1,
|
||||
|
@ -3696,7 +3706,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testFormMagicInput method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testFormMagicInput() {
|
||||
$result = $this->Form->create('Contact');
|
||||
$expected = array(
|
||||
|
@ -3839,7 +3854,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testForMagicInputNonExistingNorValidated method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testForMagicInputNonExistingNorValidated() {
|
||||
$result = $this->Form->create('Contact');
|
||||
$expected = array(
|
||||
|
@ -3878,7 +3898,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testFormMagicInputLabel method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testFormMagicInputLabel() {
|
||||
$result = $this->Form->create('Contact');
|
||||
$expected = array(
|
||||
|
@ -3956,7 +3981,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testFormEnd method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testFormEnd() {
|
||||
$this->assertEqual($this->Form->end(), '</form>');
|
||||
|
||||
|
@ -4014,7 +4044,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMultipleFormWithIdFields method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMultipleFormWithIdFields() {
|
||||
$this->Form->create('UserForm');
|
||||
|
||||
|
@ -4027,7 +4062,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
$result = $this->Form->input('MyOther.id');
|
||||
$this->assertTags($result, array('input' => array('type' => 'hidden', 'name' => 'data[MyOther][id]', 'value' => '', 'id' => 'MyOtherId')));
|
||||
}
|
||||
|
||||
/**
|
||||
* testDbLessModel method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDbLessModel() {
|
||||
$this->Form->create('TestMail');
|
||||
|
||||
|
@ -4055,7 +4095,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
ClassRegistry::removeObject('view');
|
||||
ClassRegistry::removeObject('Contact');
|
||||
|
@ -4068,7 +4113,13 @@ class FormHelperTest extends CakeTestCase {
|
|||
ClassRegistry::removeObject('ValidateProfile');
|
||||
unset($this->Form->Html, $this->Form, $this->Controller, $this->View);
|
||||
}
|
||||
|
||||
/**
|
||||
* sortFields method
|
||||
*
|
||||
* @param mixed $fields
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __sortFields($fields) {
|
||||
foreach ($fields as $key => $value) {
|
||||
if ($key{0} !== '_') {
|
||||
|
|
|
@ -757,7 +757,12 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected = "<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>";
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testTag method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testTag() {
|
||||
$result = $this->Html->tag('div');
|
||||
$this->assertTags($result, '<div');
|
||||
|
@ -771,7 +776,12 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$result = $this->Html->tag('div', '<text>', 'class-name', true);
|
||||
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testDiv method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDiv() {
|
||||
$result = $this->Html->div('class-name');
|
||||
$this->assertTags($result, array('div' => array('class' => 'class-name')));
|
||||
|
@ -783,7 +793,12 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testPara method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPara() {
|
||||
$result = $this->Html->para('class-name');
|
||||
$this->assertTags($result, array('p' => array('class' => 'class-name')));
|
||||
|
@ -794,7 +809,12 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$result = $this->Html->para('class-name', '<text>', array(), true);
|
||||
$this->assertTags($result, array('p' => array('class' => 'class-name'), '<text>', '/p'));
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Html);
|
||||
}
|
||||
|
|
|
@ -577,7 +577,12 @@ class JavascriptTest extends UnitTestCase {
|
|||
$result = $this->Javascript->getCache();
|
||||
$this->assertTrue(empty($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* testEscapeScript method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEscapeScript() {
|
||||
$result = $this->Javascript->escapeScript('');
|
||||
$expected = '';
|
||||
|
@ -599,7 +604,12 @@ class JavascriptTest extends UnitTestCase {
|
|||
$expected = 'CakePHP: \\\'Rapid Development Framework\\\'';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testEscapeString method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEscapeString() {
|
||||
$result = $this->Javascript->escapeString('');
|
||||
$expected = '';
|
||||
|
@ -621,7 +631,12 @@ class JavascriptTest extends UnitTestCase {
|
|||
$expected = 'CakePHP: \\\'Rapid Development Framework\\\'';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAfterRender method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAfterRender() {
|
||||
$this->Javascript->cacheEvents();
|
||||
$result = $this->Javascript->event('myId', 'click', 'something();');
|
||||
|
|
|
@ -57,7 +57,12 @@ class JsTest extends UnitTestCase {
|
|||
function setUp() {
|
||||
$this->Js = new JsHelper();
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Js);
|
||||
}
|
||||
|
|
|
@ -312,7 +312,12 @@ class NumberTest extends UnitTestCase {
|
|||
$expected = sprintf("%01.2f", $float/1024/1024/1024/1024).' TB';
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testToPercentage method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testToPercentage() {
|
||||
$result = $this->Number->toPercentage(45, 0);
|
||||
$expected = '45%';
|
||||
|
@ -333,7 +338,12 @@ class NumberTest extends UnitTestCase {
|
|||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Number);
|
||||
}
|
||||
|
|
|
@ -511,7 +511,12 @@ class PaginatorTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testHasPage method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testHasPage() {
|
||||
$result = $this->Paginator->hasPage('Article', 15);
|
||||
$this->assertFalse($result);
|
||||
|
@ -525,7 +530,12 @@ class PaginatorTest extends UnitTestCase {
|
|||
$result = $this->Paginator->hasPage(2);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Paginator);
|
||||
}
|
||||
|
|
|
@ -38,17 +38,32 @@ App::import('Helper', array('Rss', 'Time'));
|
|||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
*/
|
||||
class RssTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->Rss =& new RssHelper();
|
||||
$this->Rss->Time =& new TimeHelper();
|
||||
$this->Rss->beforeRender();
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Rss);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAddNamespace method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAddNamespace() {
|
||||
$this->Rss->addNs('custom', 'http://example.com/dtd.xml');
|
||||
$manager =& XmlManager::getInstance();
|
||||
|
@ -56,7 +71,12 @@ class RssTest extends CakeTestCase {
|
|||
$expected = array('custom' => 'http://example.com/dtd.xml');
|
||||
$this->assertEqual($manager->namespaces, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRemoveNamespace method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRemoveNamespace() {
|
||||
$this->Rss->addNs('custom', 'http://example.com/dtd.xml');
|
||||
$this->Rss->addNs('custom2', 'http://example.com/dtd2.xml');
|
||||
|
@ -69,7 +89,12 @@ class RssTest extends CakeTestCase {
|
|||
$expected = array('custom2' => 'http://example.com/dtd2.xml');
|
||||
$this->assertEqual($manager->namespaces, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDocument method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDocument() {
|
||||
$res = $this->Rss->document();
|
||||
$this->assertPattern('/^<rss version="2.0" \/>$/', $res);
|
||||
|
@ -85,7 +110,12 @@ class RssTest extends CakeTestCase {
|
|||
$this->assertPattern('/<rss[^<>]+contrived="parameter"[^<>]*>/', $res);
|
||||
$this->assertNoPattern('/<rss[^<>]+[^version|contrived]=[^<>]*>/', $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* testChannel method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testChannel() {
|
||||
$attrib = array('a' => '1', 'b' => '2');
|
||||
$elements['title'] = 'title';
|
||||
|
@ -99,7 +129,12 @@ class RssTest extends CakeTestCase {
|
|||
$this->assertPattern('/<description \/>/', $res);
|
||||
$this->assertPattern('/content<\/channel>$/', $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* testChannelElementLevelAttrib method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testChannelElementLevelAttrib() {
|
||||
$attrib = array();
|
||||
$elements['title'] = 'title';
|
||||
|
@ -113,7 +148,12 @@ class RssTest extends CakeTestCase {
|
|||
$this->assertPattern('/<description \/>/', $res);
|
||||
$this->assertPattern('/content<\/channel>$/', $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* testItems method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testItems() {
|
||||
$items = array(
|
||||
array('title' => 'title1', 'guid' => 'http://www.example.com/guid1', 'link' => 'http://www.example.com/link1', 'description' => 'description1'),
|
||||
|
@ -139,7 +179,12 @@ class RssTest extends CakeTestCase {
|
|||
$result = $this->Rss->items(array());
|
||||
$this->assertEqual($result, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* testItem method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testItem() {
|
||||
$result = $this->Rss->item(null, array("title"=>"My title","description"=>"My description","link"=>"http://www.google.com/"));
|
||||
$expecting = '<item><title>My title</title><description>My description</description><link>http://www.google.com/</link><guid>http://www.google.com/</guid></item>';
|
||||
|
@ -212,10 +257,20 @@ class RssTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testTime method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testTime() {
|
||||
}
|
||||
|
||||
/**
|
||||
* testElementAttrNotInParent method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testElementAttrNotInParent() {
|
||||
$attributes = array('title' => 'Some Title', 'link' => 'http://link.com', 'description' => 'description');
|
||||
$elements = array('enclosure' => array('url' => 'http://test.com'));
|
||||
|
|
|
@ -180,7 +180,12 @@ class SessionHelperTest extends CakeTestCase {
|
|||
$result = $this->Session->id();
|
||||
$this->assertEqual($id, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testError method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testError() {
|
||||
$result = $this->Session->error();
|
||||
$this->assertFalse($result);
|
||||
|
@ -190,7 +195,12 @@ class SessionHelperTest extends CakeTestCase {
|
|||
$expected = "CauseError doesn't exist";
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDisabling method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDisabling() {
|
||||
Configure::write('Session.start', false);
|
||||
$this->Session = new SessionHelper();
|
||||
|
@ -206,7 +216,12 @@ class SessionHelperTest extends CakeTestCase {
|
|||
ob_clean();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testValid method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testValid() {
|
||||
//wierd it always ends up false in the test suite
|
||||
//$this->assertFalse($this->Session->valid());
|
||||
|
|
|
@ -254,7 +254,12 @@ class TextTest extends UnitTestCase {
|
|||
$result = $this->Text->highlight($text, array('test'), '<b>\1</b>');
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testExcerpt method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testExcerpt() {
|
||||
$text = 'This is a phrase with test text to play with';
|
||||
|
||||
|
@ -278,7 +283,12 @@ class TextTest extends UnitTestCase {
|
|||
$result = $this->Text->excerpt($text, 'phrase', 2, '...');
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testExcerptCaseInsensitivity method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testExcerptCaseInsensitivity() {
|
||||
$text = 'This is a phrase with test text to play with';
|
||||
|
||||
|
@ -290,7 +300,12 @@ class TextTest extends UnitTestCase {
|
|||
$result = $this->Text->excerpt($text, 'NOT_FOUND', 9, '...');
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testListGeneration method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testListGeneration() {
|
||||
$result = $this->Text->toList(array('Larry', 'Curly', 'Moe'));
|
||||
$this->assertEqual($result, 'Larry, Curly and Moe');
|
||||
|
@ -298,7 +313,12 @@ class TextTest extends UnitTestCase {
|
|||
$result = $this->Text->toList(array('Dusty', 'Lucky', 'Ned'), 'y');
|
||||
$this->assertEqual($result, 'Dusty, Lucky y Ned');
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Text);
|
||||
}
|
||||
|
|
|
@ -525,7 +525,12 @@ class TimeTest extends UnitTestCase {
|
|||
$result = $this->Time->isThisYear(mktime(0, 0, 0, rand(1, 12), rand(1, 28), date('Y')));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testOfWasYesterday method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testOfWasYesterday() {
|
||||
$result = $this->Time->wasYesterday('+1 day');
|
||||
$this->assertFalse($result);
|
||||
|
@ -540,7 +545,12 @@ class TimeTest extends UnitTestCase {
|
|||
$result = $this->Time->wasYesterday('-2 days');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testOfIsTomorrow method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testOfIsTomorrow() {
|
||||
$result = $this->Time->isTomorrow('+1 day');
|
||||
$this->assertTrue($result);
|
||||
|
@ -551,7 +561,12 @@ class TimeTest extends UnitTestCase {
|
|||
$result = $this->Time->isTomorrow('-1 day');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testOfWasWithinLast method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testOfWasWithinLast() {
|
||||
$this->assertTrue($this->Time->wasWithinLast('1 day', '-1 day'));
|
||||
$this->assertTrue($this->Time->wasWithinLast('1 week', '-1 week'));
|
||||
|
@ -591,7 +606,12 @@ class TimeTest extends UnitTestCase {
|
|||
$this->assertTrue($this->Time->wasWithinLast('1 ', '-1 minute'));
|
||||
$this->assertTrue($this->Time->wasWithinLast('1 ', '-23 hours -59 minutes -59 seconds'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testUserOffset method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testUserOffset() {
|
||||
$timezoneServer = new DateTimeZone(date_default_timezone_get());
|
||||
$timeServer = new DateTime('now', $timezoneServer);
|
||||
|
@ -601,7 +621,12 @@ class TimeTest extends UnitTestCase {
|
|||
$result = $this->Time->fromString(time(), $yourTimezone);
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Time);
|
||||
}
|
||||
|
|
|
@ -31,14 +31,36 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
|||
}
|
||||
|
||||
uses('view'.DS.'helpers'.DS.'app_helper', 'controller'.DS.'controller', 'model'.DS.'model', 'view'.DS.'helper', 'view'.DS.'helpers'.DS.'xml');
|
||||
|
||||
/**
|
||||
* TestXml class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
*/
|
||||
class TestXml extends Object {
|
||||
/**
|
||||
* content property
|
||||
*
|
||||
* @var string ''
|
||||
* @access public
|
||||
*/
|
||||
var $content = '';
|
||||
|
||||
/**
|
||||
* construct method
|
||||
*
|
||||
* @param mixed $content
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function __construct($content) {
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function toString() {
|
||||
return $this->content;
|
||||
}
|
||||
|
@ -50,12 +72,22 @@ class TestXml extends Object {
|
|||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
*/
|
||||
class XmlHelperTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->Xml =& new XmlHelper();
|
||||
$this->Xml->beforeRender();
|
||||
}
|
||||
|
||||
/**
|
||||
* testAddNamespace method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAddNamespace() {
|
||||
$this->Xml->addNs('custom', 'http://example.com/dtd.xml');
|
||||
$manager =& XmlManager::getInstance();
|
||||
|
@ -63,7 +95,12 @@ class XmlHelperTest extends UnitTestCase {
|
|||
$expected = array('custom' => 'http://example.com/dtd.xml');
|
||||
$this->assertEqual($manager->namespaces, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRemoveNamespace method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRemoveNamespace() {
|
||||
$this->Xml->addNs('custom', 'http://example.com/dtd.xml');
|
||||
$this->Xml->addNs('custom2', 'http://example.com/dtd2.xml');
|
||||
|
@ -76,13 +113,23 @@ class XmlHelperTest extends UnitTestCase {
|
|||
$expected = array('custom2' => 'http://example.com/dtd2.xml');
|
||||
$this->assertEqual($manager->namespaces, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRenderZeroElement method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRenderZeroElement() {
|
||||
$result = $this->Xml->elem('count', null, 0);
|
||||
$expected = '<count>0</count>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRenderElementWithNamespace method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRenderElementWithNamespace() {
|
||||
$result = $this->Xml->elem('count', array('namespace' => 'myNameSpace'), 'content');
|
||||
$expected = '<myNameSpace:count>content</myNameSpace:count>';
|
||||
|
@ -96,7 +143,12 @@ class XmlHelperTest extends UnitTestCase {
|
|||
$result .= $this->Xml->closeElem();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRenderElementWithComplexContent method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRenderElementWithComplexContent() {
|
||||
$result = $this->Xml->elem('count', array('namespace' => 'myNameSpace'), array('contrived' => 'content'));
|
||||
$expected = '<myNameSpace:count><content /></myNameSpace:count>';
|
||||
|
@ -106,7 +158,12 @@ class XmlHelperTest extends UnitTestCase {
|
|||
$expected = '<myNameSpace:count><![CDATA[content]]></myNameSpace:count>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSerialize method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSerialize() {
|
||||
$data = array(
|
||||
'test1' => 'test with no quotes',
|
||||
|
@ -124,7 +181,12 @@ class XmlHelperTest extends UnitTestCase {
|
|||
$expected = '<std_class test1="test with no quotes" test2="test without double quotes" />';
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testHeader method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testHeader() {
|
||||
$expectedDefaultEncoding = Configure::read('App.encoding');
|
||||
if (empty($expectedDefaultEncoding)) {
|
||||
|
@ -157,7 +219,12 @@ class XmlHelperTest extends UnitTestCase {
|
|||
$expected = '<?xml encoding="UTF-8" someOther="value" ?>';
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->Xml);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,12 @@ class ThemeViewTest extends UnitTestCase {
|
|||
$result = $ThemeView->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingView method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingView() {
|
||||
$this->Controller->plugin = null;
|
||||
$this->Controller->name = 'Pages';
|
||||
|
@ -233,7 +238,12 @@ class ThemeViewTest extends UnitTestCase {
|
|||
$this->assertPattern("/PagesController::/", $expected);
|
||||
$this->assertPattern("/views\/themed\/my_theme\/pages\/does_not_exist.ctp/", $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMissingLayout method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMissingLayout() {
|
||||
$this->Controller->plugin = null;
|
||||
$this->Controller->name = 'Posts';
|
||||
|
@ -250,7 +260,12 @@ class ThemeViewTest extends UnitTestCase {
|
|||
$this->assertPattern("/Missing Layout/", $expected);
|
||||
$this->assertPattern("/views\/themed\/my_theme\/layouts\/whatever.ctp/", $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->ThemeView);
|
||||
unset($this->PostsController);
|
||||
|
|
|
@ -469,7 +469,12 @@ class ViewTest extends CakeTestCase {
|
|||
$this->assertPattern('/modified in the afterlife/', $result);
|
||||
$this->assertPattern('/This is my view output/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRenderLoadHelper method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRenderLoadHelper() {
|
||||
$this->PostsController->helpers = array('Html', 'Form', 'Ajax');
|
||||
$View = new TestView($this->PostsController);
|
||||
|
@ -496,7 +501,12 @@ class ViewTest extends CakeTestCase {
|
|||
$this->assertTrue(is_object($helpers['ajax']->Html));
|
||||
$this->assertTrue(is_object($helpers['testPluginHelper']->TestPluginOtherHelper));
|
||||
}
|
||||
|
||||
/**
|
||||
* testRender method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRender() {
|
||||
$View = new TestView($this->PostsController);
|
||||
$result = str_replace(array("\t", "\r\n", "\n"), "", $View->render('index'));
|
||||
|
@ -566,7 +576,12 @@ class ViewTest extends CakeTestCase {
|
|||
$this->assertFalse(empty($result));
|
||||
@unlink($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSet method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSet() {
|
||||
$View = new TestView($this->PostsController);
|
||||
$View->viewVars = array();
|
||||
|
@ -589,7 +604,12 @@ class ViewTest extends CakeTestCase {
|
|||
$View->set(array('key3' => 'value3'));
|
||||
$this->assertIdentical($View->getVar('key3'), 'value3');
|
||||
}
|
||||
|
||||
/**
|
||||
* testEntityReference method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEntityReference() {
|
||||
$View = new TestView($this->PostsController);
|
||||
$View->model = 'Post';
|
||||
|
@ -600,7 +620,12 @@ class ViewTest extends CakeTestCase {
|
|||
$View->field = 'user_id';
|
||||
$this->assertEqual($View->entity(), array('Comment', 'user_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testBadExt method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testBadExt() {
|
||||
$this->PostsController->action = 'something';
|
||||
$this->PostsController->ext = '.whatever';
|
||||
|
@ -614,7 +639,12 @@ class ViewTest extends CakeTestCase {
|
|||
$this->assertPattern("/<em>PostsController::<\/em><em>something\(\)<\/em>/", $result);
|
||||
$this->assertPattern("/posts\/this_is_missing.whatever/", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
unset($this->View);
|
||||
unset($this->PostsController);
|
||||
|
|
|
@ -462,28 +462,48 @@ class XmlTest extends UnitTestCase {
|
|||
$result = $xml->toString(array('header' => false, 'cdata' => false));
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSimpleParsing method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSimpleParsing() {
|
||||
$source = '<response><hello><![CDATA[happy world]]></hello><goodbye><![CDATA[cruel world]]></goodbye></response>';
|
||||
$xml = new Xml($source);
|
||||
$result = $xml->toString();
|
||||
$this->assertEqual($source, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMixedParsing method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMixedParsing() {
|
||||
$source = '<response><body><hello><![CDATA[happy world]]></hello><![CDATA[in between]]><goodbye><![CDATA[cruel world]]></goodbye></body></response>';
|
||||
$xml = new Xml($source);
|
||||
$result = $xml->toString();
|
||||
$this->assertEqual($source, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testComplexParsing method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testComplexParsing() {
|
||||
$source = '<projects><project><id>1</id><title/><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1</job_type_id><industry_id>1</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name>Touch Screen Kiosk</name></job_type><industry><id>1</id><name>Financial</name></industry></project><project><id>2</id><title /><client_id>2</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>2</job_type_id><industry_id>2</industry_id><modified>2007-11-26 14:48:36</modified><created /><style><id /><name /></style><job_type><id>2</id><name>Awareness Campaign</name></job_type><industry><id>2</id><name>Education</name></industry></project></projects>';
|
||||
$xml = new Xml($source);
|
||||
$result = $xml->toString(array('cdata' => false));
|
||||
$this->assertEqual($source, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testNamespaceParsing method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNamespaceParsing() {
|
||||
$source = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>';
|
||||
$xml = new Xml($source);
|
||||
|
@ -497,7 +517,12 @@ class XmlTest extends UnitTestCase {
|
|||
$children = $children[0]->children('rule');
|
||||
$this->assertEqual($children[0]->namespace, 'b');
|
||||
}
|
||||
|
||||
/**
|
||||
* testNamespaces method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNamespaces() {
|
||||
$source = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>';
|
||||
$xml = new Xml($source);
|
||||
|
|
6
cake/tests/fixtures/aco_action_fixture.php
vendored
6
cake/tests/fixtures/aco_action_fixture.php
vendored
|
@ -55,6 +55,12 @@ class AcoActionFixture extends CakeTestFixture {
|
|||
'lft' => array('type' => 'integer', 'length' => 10, 'null' => true),
|
||||
'rght' => array('type' => 'integer', 'length' => 10, 'null' => true)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array();
|
||||
}
|
||||
|
||||
|
|
7
cake/tests/fixtures/ad_fixture.php
vendored
7
cake/tests/fixtures/ad_fixture.php
vendored
|
@ -30,6 +30,12 @@
|
|||
* @subpackage cake.tests.fixtures
|
||||
*/
|
||||
class AdFixture extends CakeTestFixture {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'Ad'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'Ad';
|
||||
/**
|
||||
* fields property
|
||||
|
@ -60,6 +66,5 @@ class AdFixture extends CakeTestFixture {
|
|||
array( 'id' => 6, 'parent_id' => NULL, 'lft' => 10, 'rght' => 11, 'campaign_id' => 2, 'name' => 'Alborg' ),
|
||||
array( 'id' => 7, 'parent_id' => NULL, 'lft' => 13, 'rght' => 14, 'campaign_id' => 3, 'name' => 'New York' ),
|
||||
);
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -52,6 +52,12 @@ class AdvertisementFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('title' => 'First Ad', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
|
||||
array('title' => 'Second Ad', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31')
|
||||
|
|
|
@ -52,6 +52,12 @@ class AnotherArticleFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('title' => 'First Article', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
|
||||
array('title' => 'Second Article', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
|
||||
|
|
6
cake/tests/fixtures/apple_fixture.php
vendored
6
cake/tests/fixtures/apple_fixture.php
vendored
|
@ -56,6 +56,12 @@ class AppleFixture extends CakeTestFixture {
|
|||
'modified' => 'datetime',
|
||||
'mytime' => 'time'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('apple_id' => 2, 'color' => 'Red 1', 'name' => 'Red Apple 1', 'created' => '2006-11-22 10:38:58', 'date' => '1951-01-04', 'modified' => '2006-12-01 13:31:26', 'mytime' => '22:57:17'),
|
||||
array('apple_id' => 1, 'color' => 'Bright Red 1', 'name' => 'Bright Red Apple', 'created' => '2006-11-22 10:43:13', 'date' => '2014-01-01', 'modified' => '2006-11-30 18:38:10', 'mytime' => '22:57:17'),
|
||||
|
|
7
cake/tests/fixtures/aro_fixture.php
vendored
7
cake/tests/fixtures/aro_fixture.php
vendored
|
@ -55,7 +55,12 @@ class AroFixture extends CakeTestFixture {
|
|||
'lft' => array('type' => 'integer', 'length' => 10, 'null' => true),
|
||||
'rght' => array('type' => 'integer', 'length' => 10, 'null' => true)
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 8),
|
||||
array('parent_id' => '1', 'model' => 'Group', 'foreign_key' => '1', 'alias' => 'admins', 'lft' => 2, 'rght' => 7),
|
||||
|
|
6
cake/tests/fixtures/aros_aco_fixture.php
vendored
6
cake/tests/fixtures/aros_aco_fixture.php
vendored
|
@ -55,6 +55,12 @@ class ArosAcoFixture extends CakeTestFixture {
|
|||
'_update' => array('type' => 'string', 'length' => 2, 'default' => 0),
|
||||
'_delete' => array('type' => 'string', 'length' => 2, 'default' => 0)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,12 @@ class ArticleFeaturedFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('user_id' => 1, 'title' => 'First Article', 'body' => 'First Article Body', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
|
||||
array('user_id' => 3, 'title' => 'Second Article', 'body' => 'Second Article Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
|
||||
|
|
6
cake/tests/fixtures/article_fixture.php
vendored
6
cake/tests/fixtures/article_fixture.php
vendored
|
@ -55,6 +55,12 @@ class ArticleFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('user_id' => 1, 'title' => 'First Article', 'body' => 'First Article Body', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
|
||||
array('user_id' => 3, 'title' => 'Second Article', 'body' => 'Second Article Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
|
||||
|
|
6
cake/tests/fixtures/articles_tag_fixture.php
vendored
6
cake/tests/fixtures/articles_tag_fixture.php
vendored
|
@ -51,6 +51,12 @@ class ArticlesTagFixture extends CakeTestFixture {
|
|||
'tag_id' => array('type' => 'integer', 'null' => false),
|
||||
'indexes' => array('UNIQUE_TAG' => array('column'=> array('article_id', 'tag_id'), 'unique'=>1))
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('article_id' => 1, 'tag_id' => 1),
|
||||
array('article_id' => 1, 'tag_id' => 2),
|
||||
|
|
6
cake/tests/fixtures/attachment_fixture.php
vendored
6
cake/tests/fixtures/attachment_fixture.php
vendored
|
@ -53,6 +53,12 @@ class AttachmentFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('comment_id' => 5, 'attachment' => 'attachment.zip', 'created' => '2007-03-18 10:51:23', 'updated' => '2007-03-18 10:53:31')
|
||||
);
|
||||
|
|
6
cake/tests/fixtures/auth_user_fixture.php
vendored
6
cake/tests/fixtures/auth_user_fixture.php
vendored
|
@ -53,6 +53,12 @@ class AuthUserFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('username' => 'mariano', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
|
||||
array('username' => 'nate', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
|
||||
|
|
6
cake/tests/fixtures/author_fixture.php
vendored
6
cake/tests/fixtures/author_fixture.php
vendored
|
@ -53,6 +53,12 @@ class AuthorFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('user' => 'mariano', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
|
||||
array('user' => 'nate', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
|
||||
|
|
6
cake/tests/fixtures/bid_fixture.php
vendored
6
cake/tests/fixtures/bid_fixture.php
vendored
|
@ -51,6 +51,12 @@ class BidFixture extends CakeTestFixture {
|
|||
'message_id' => array('type' => 'integer', 'null' => false),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('message_id' => 1, 'name' => 'Bid 1.1'),
|
||||
array('message_id' => 1, 'name' => 'Bid 1.2'),
|
||||
|
|
6
cake/tests/fixtures/callback_fixture.php
vendored
6
cake/tests/fixtures/callback_fixture.php
vendored
|
@ -53,6 +53,12 @@ class CallbackFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('user' => 'user1', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
|
||||
array('user' => 'user2', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:20:23', 'updated' => '2007-03-17 01:22:31'),
|
||||
|
|
13
cake/tests/fixtures/campaign_fixture.php
vendored
13
cake/tests/fixtures/campaign_fixture.php
vendored
|
@ -30,6 +30,12 @@
|
|||
* @subpackage cake.tests.fixtures
|
||||
*/
|
||||
class CampaignFixture extends CakeTestFixture {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'Campaign'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'Campaign';
|
||||
/**
|
||||
* fields property
|
||||
|
@ -41,7 +47,12 @@ class CampaignFixture extends CakeTestFixture {
|
|||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'length' => 255, 'null' => false),
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array( 'id' => 1 , 'name' => 'Hurtigruten' ),
|
||||
array( 'id' => 2 , 'name' => 'Colorline' ),
|
||||
|
|
6
cake/tests/fixtures/category_fixture.php
vendored
6
cake/tests/fixtures/category_fixture.php
vendored
|
@ -53,6 +53,12 @@ class CategoryFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('parent_id' => 0, 'name' => 'Category 1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
|
||||
array('parent_id' => 1, 'name' => 'Category 1.1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
|
||||
|
|
|
@ -53,6 +53,12 @@ class CategoryThreadFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('parent_id' => 0, 'name' => 'Category 1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
|
||||
array('parent_id' => 1, 'name' => 'Category 1.1', 'created' => '2007-03-18 15:30:23', 'updated' => '2007-03-18 15:32:31'),
|
||||
|
|
6
cake/tests/fixtures/comment_fixture.php
vendored
6
cake/tests/fixtures/comment_fixture.php
vendored
|
@ -55,6 +55,12 @@ class CommentFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('id' => 1, 'article_id' => 1, 'user_id' => 2, 'comment' => 'First Comment for First Article', 'published' => 'Y', 'created' => '2007-03-18 10:45:23', 'updated' => '2007-03-18 10:47:31'),
|
||||
array('id' => 2, 'article_id' => 1, 'user_id' => 4, 'comment' => 'Second Comment for First Article', 'published' => 'Y', 'created' => '2007-03-18 10:47:23', 'updated' => '2007-03-18 10:49:31'),
|
||||
|
|
6
cake/tests/fixtures/data_test_fixture.php
vendored
6
cake/tests/fixtures/data_test_fixture.php
vendored
|
@ -54,6 +54,12 @@ class DataTestFixture extends CakeTestFixture {
|
|||
'created' => array('type' => 'datetime', 'default' => null),
|
||||
'updated' => array('type' => 'datetime', 'default' => null)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array();
|
||||
}
|
||||
|
||||
|
|
7
cake/tests/fixtures/datatype_fixture.php
vendored
7
cake/tests/fixtures/datatype_fixture.php
vendored
|
@ -50,7 +50,12 @@ class DatatypeFixture extends CakeTestFixture {
|
|||
'id' => array('type' => 'integer', 'null'=> false, 'default'=> 0, 'key' => 'primary'),
|
||||
'float_field' => array('type' => 'float', 'length' => '5,2', 'null' => false, 'default' => null),
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('id' => 1, 'float_field' => 42.23),
|
||||
);
|
||||
|
|
6
cake/tests/fixtures/dependency_fixture.php
vendored
6
cake/tests/fixtures/dependency_fixture.php
vendored
|
@ -53,6 +53,12 @@ class DependencyFixture extends CakeTestFixture {
|
|||
'child_id' => 'integer',
|
||||
'parent_id' => 'integer'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('child_id' => 1, 'parent_id' => 2),
|
||||
);
|
||||
|
|
6
cake/tests/fixtures/device_fixture.php
vendored
6
cake/tests/fixtures/device_fixture.php
vendored
|
@ -52,6 +52,12 @@ class DeviceFixture extends CakeTestFixture {
|
|||
'name' => array('type' => 'string', 'null' => false),
|
||||
'typ' => array('type' => 'integer', 'null' => false),
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('device_type_id' => 1, 'name' => 'Device 1', 'typ' => 1),
|
||||
array('device_type_id' => 1, 'name' => 'Device 2', 'typ' => 1),
|
||||
|
|
|
@ -50,6 +50,12 @@ class DeviceTypeCategoryFixture extends CakeTestFixture {
|
|||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('name' => 'DeviceTypeCategory 1')
|
||||
);
|
||||
|
|
6
cake/tests/fixtures/device_type_fixture.php
vendored
6
cake/tests/fixtures/device_type_fixture.php
vendored
|
@ -57,6 +57,12 @@ class DeviceTypeFixture extends CakeTestFixture {
|
|||
'name' => array('type' => 'string', 'null' => false),
|
||||
'order' => array('type' => 'integer', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('device_type_category_id' => 1, 'feature_set_id' => 1, 'exterior_type_category_id' => 1, 'image_id' => 1, 'extra1_id' => 1, 'extra2_id' => 1, 'name' => 'DeviceType 1', 'order' => 0)
|
||||
);
|
||||
|
|
|
@ -50,6 +50,12 @@ class DocumentDirectoryFixture extends CakeTestFixture {
|
|||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('name' => 'DocumentDirectory 1')
|
||||
);
|
||||
|
|
6
cake/tests/fixtures/document_fixture.php
vendored
6
cake/tests/fixtures/document_fixture.php
vendored
|
@ -51,6 +51,12 @@ class DocumentFixture extends CakeTestFixture {
|
|||
'document_directory_id' => array('type' => 'integer', 'null' => false),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('document_directory_id' => 1, 'name' => 'Document 1')
|
||||
);
|
||||
|
|
|
@ -51,6 +51,12 @@ class ExteriorTypeCategoryFixture extends CakeTestFixture {
|
|||
'image_id' => array('type' => 'integer', 'null' => false),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('image_id' => 1, 'name' => 'ExteriorTypeCategory 1')
|
||||
);
|
||||
|
|
6
cake/tests/fixtures/feature_set_fixture.php
vendored
6
cake/tests/fixtures/feature_set_fixture.php
vendored
|
@ -50,6 +50,12 @@ class FeatureSetFixture extends CakeTestFixture {
|
|||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('name' => 'FeatureSet 1')
|
||||
);
|
||||
|
|
6
cake/tests/fixtures/featured_fixture.php
vendored
6
cake/tests/fixtures/featured_fixture.php
vendored
|
@ -55,6 +55,12 @@ class FeaturedFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('article_featured_id' => 1, 'category_id' => 1, 'published_date' => '2007-03-31 10:39:23', 'end_date' => '2007-05-15 10:39:23', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
|
||||
array('article_featured_id' => 2, 'category_id' => 1, 'published_date' => '2007-03-31 10:39:23', 'end_date' => '2007-05-15 10:39:23', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
|
||||
|
|
6
cake/tests/fixtures/home_fixture.php
vendored
6
cake/tests/fixtures/home_fixture.php
vendored
|
@ -54,6 +54,12 @@ class HomeFixture extends CakeTestFixture {
|
|||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('another_article_id' => 1, 'advertisement_id' => 1, 'title' => 'First Home', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
|
||||
array('another_article_id' => 3, 'advertisement_id' => 1, 'title' => 'Second Home', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31')
|
||||
|
|
6
cake/tests/fixtures/image_fixture.php
vendored
6
cake/tests/fixtures/image_fixture.php
vendored
|
@ -50,6 +50,12 @@ class ImageFixture extends CakeTestFixture {
|
|||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('name' => 'Image 1'),
|
||||
array('name' => 'Image 2'),
|
||||
|
|
6
cake/tests/fixtures/item_fixture.php
vendored
6
cake/tests/fixtures/item_fixture.php
vendored
|
@ -52,6 +52,12 @@ class ItemFixture extends CakeTestFixture {
|
|||
'published' => array('type' => 'boolean', 'null' => false),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('syfile_id' => 1, 'published' => 0, 'name' => 'Item 1'),
|
||||
array('syfile_id' => 2, 'published' => 0, 'name' => 'Item 2'),
|
||||
|
|
|
@ -51,6 +51,12 @@ class ItemsPortfolioFixture extends CakeTestFixture {
|
|||
'item_id' => array('type' => 'integer', 'null' => false),
|
||||
'portfolio_id' => array('type' => 'integer', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('item_id' => 1, 'portfolio_id' => 1),
|
||||
array('item_id' => 2, 'portfolio_id' => 2),
|
||||
|
|
7
cake/tests/fixtures/join_a_b_fixture.php
vendored
7
cake/tests/fixtures/join_a_b_fixture.php
vendored
|
@ -54,7 +54,12 @@ class JoinABFixture extends CakeTestFixture {
|
|||
'created' => array('type' => 'datetime', 'null' => true),
|
||||
'updated' => array('type' => 'datetime', 'null' => true)
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('join_a_id' => 1, 'join_b_id' => 2, 'other' => 'Data for Join A 1 Join B 2', 'created' => '2008-01-03 10:56:33', 'updated' => '2008-01-03 10:56:33'),
|
||||
array('join_a_id' => 2, 'join_b_id' => 3, 'other' => 'Data for Join A 2 Join B 3', 'created' => '2008-01-03 10:56:34', 'updated' => '2008-01-03 10:56:34'),
|
||||
|
|
7
cake/tests/fixtures/join_a_c_fixture.php
vendored
7
cake/tests/fixtures/join_a_c_fixture.php
vendored
|
@ -54,7 +54,12 @@ class JoinACFixture extends CakeTestFixture {
|
|||
'created' => array('type' => 'datetime', 'null' => true),
|
||||
'updated' => array('type' => 'datetime', 'null' => true)
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('join_a_id' => 1, 'join_c_id' => 2, 'other' => 'Data for Join A 1 Join C 2', 'created' => '2008-01-03 10:57:22', 'updated' => '2008-01-03 10:57:22'),
|
||||
array('join_a_id' => 2, 'join_c_id' => 3, 'other' => 'Data for Join A 2 Join C 3', 'created' => '2008-01-03 10:57:23', 'updated' => '2008-01-03 10:57:23'),
|
||||
|
|
7
cake/tests/fixtures/join_a_fixture.php
vendored
7
cake/tests/fixtures/join_a_fixture.php
vendored
|
@ -53,7 +53,12 @@ class JoinAFixture extends CakeTestFixture {
|
|||
'created' => array('type' => 'datetime', 'null' => true),
|
||||
'updated' => array('type' => 'datetime', 'null' => true)
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('name' => 'Join A 1', 'body' => 'Join A 1 Body', 'created' => '2008-01-03 10:54:23', 'updated' => '2008-01-03 10:54:23'),
|
||||
array('name' => 'Join A 2', 'body' => 'Join A 2 Body', 'created' => '2008-01-03 10:54:24', 'updated' => '2008-01-03 10:54:24'),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue