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:
AD7six 2008-06-05 15:20:45 +00:00
parent e3fea51329
commit a978fb2661
133 changed files with 3641 additions and 787 deletions

View file

@ -30,17 +30,17 @@ require_once CAKE.'dispatcher.php';
App::import('Core', 'AppController');
/**
* TestDispatcher class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class TestDispatcher extends Dispatcher {
/**
* invoke method
*
* @param mixed $controller
* @param mixed $params
* @param mixed $missingAction
*
* @param mixed $controller
* @param mixed $params
* @param mixed $missingAction
* @access protected
* @return void
*/
@ -65,8 +65,8 @@ class TestDispatcher extends Dispatcher {
}
/**
* cakeError method
*
* @param mixed $filename
*
* @param mixed $filename
* @access public
* @return void
*/
@ -77,7 +77,7 @@ class TestDispatcher extends Dispatcher {
}
/**
* MyPluginAppController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
@ -86,28 +86,28 @@ class MyPluginAppController extends AppController {
}
/**
* MyPluginController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class MyPluginController extends MyPluginAppController {
/**
* name property
*
*
* @var string 'MyPlugin'
* @access public
*/
var $name = 'MyPlugin';
/**
* uses property
*
*
* @var array
* @access public
*/
var $uses = array();
/**
* index method
*
*
* @access public
* @return void
*/
@ -116,7 +116,7 @@ class MyPluginController extends MyPluginAppController {
}
/**
* add method
*
*
* @access public
* @return void
*/
@ -125,8 +125,8 @@ class MyPluginController extends MyPluginAppController {
}
/**
* admin_add method
*
* @param mixed $id
*
* @param mixed $id
* @access public
* @return void
*/
@ -136,29 +136,29 @@ class MyPluginController extends MyPluginAppController {
}
/**
* SomePagesController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class SomePagesController extends AppController {
/**
* name property
*
*
* @var string 'SomePages'
* @access public
*/
var $name = 'SomePages';
/**
* uses property
*
*
* @var array
* @access public
*/
var $uses = array();
/**
* display method
*
* @param mixed $page
*
* @param mixed $page
* @access public
* @return void
*/
@ -167,7 +167,7 @@ class SomePagesController extends AppController {
}
/**
* index method
*
*
* @access public
* @return void
*/
@ -177,29 +177,29 @@ class SomePagesController extends AppController {
}
/**
* OtherPagesController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class OtherPagesController extends MyPluginAppController {
/**
* name property
*
*
* @var string 'OtherPages'
* @access public
*/
var $name = 'OtherPages';
/**
* uses property
*
*
* @var array
* @access public
*/
var $uses = array();
/**
* display method
*
* @param mixed $page
*
* @param mixed $page
* @access public
* @return void
*/
@ -208,7 +208,7 @@ class OtherPagesController extends MyPluginAppController {
}
/**
* index method
*
*
* @access public
* @return void
*/
@ -218,28 +218,28 @@ class OtherPagesController extends MyPluginAppController {
}
/**
* TestDispatchPagesController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class TestDispatchPagesController extends AppController {
/**
* name property
*
*
* @var string 'TestDispatchPages'
* @access public
*/
var $name = 'TestDispatchPages';
/**
* uses property
*
*
* @var array
* @access public
*/
var $uses = array();
/**
* admin_index method
*
*
* @access public
* @return void
*/
@ -249,7 +249,7 @@ class TestDispatchPagesController extends AppController {
}
/**
* ArticlesTestAppController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
@ -258,28 +258,28 @@ class ArticlesTestAppController extends AppController {
}
/**
* ArticlesTestController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class ArticlesTestController extends ArticlesTestAppController {
/**
* name property
*
*
* @var string 'ArticlesTest'
* @access public
*/
var $name = 'ArticlesTest';
/**
* uses property
*
*
* @var array
* @access public
*/
var $uses = array();
/**
* admin_index method
*
*
* @access public
* @return void
*/
@ -289,35 +289,35 @@ class ArticlesTestController extends ArticlesTestAppController {
}
/**
* SomePostsController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class SomePostsController extends AppController {
/**
* name property
*
*
* @var string 'SomePosts'
* @access public
*/
var $name = 'SomePosts';
/**
* uses property
*
*
* @var array
* @access public
*/
var $uses = array();
/**
* autoRender property
*
*
* @var bool false
* @access public
*/
var $autoRender = false;
/**
* beforeFilter method
*
*
* @access public
* @return void
*/
@ -327,7 +327,7 @@ class SomePostsController extends AppController {
}
/**
* index method
*
*
* @access public
* @return void
*/
@ -337,49 +337,49 @@ class SomePostsController extends AppController {
}
/**
* TestCachedPagesController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class TestCachedPagesController extends AppController {
/**
* name property
*
*
* @var string 'TestCachedPages'
* @access public
*/
var $name = 'TestCachedPages';
/**
* uses property
*
*
* @var array
* @access public
*/
var $uses = array();
/**
* helpers property
*
*
* @var array
* @access public
*/
var $helpers = array('Cache');
/**
* cacheAction property
*
*
* @var array
* @access public
*/
var $cacheAction = array('index'=> '+2 sec', 'test_nocache_tags'=>'+2 sec');
/**
* viewPath property
*
*
* @var string 'posts'
* @access public
*/
var $viewPath = 'posts';
/**
* index method
*
*
* @access public
* @return void
*/
@ -388,39 +388,39 @@ class TestCachedPagesController extends AppController {
}
/**
* test_nocache_tags method
*
*
* @access public
* @return void
*/
function test_nocache_tags() {
//$this->cacheAction = '+2 sec';
//$this->cacheAction = '+2 sec';
$this->render();
}
}
/**
* TimesheetsController class
*
*
* @package cake
* @subpackage cake.tests.cases
*/
class TimesheetsController extends AppController {
/**
* name property
*
*
* @var string 'Timesheets'
* @access public
*/
var $name = 'Timesheets';
/**
* uses property
*
*
* @var array
* @access public
*/
var $uses = array();
/**
* index method
*
*
* @access public
* @return void
*/
@ -437,7 +437,7 @@ class TimesheetsController extends AppController {
class DispatcherTest extends UnitTestCase {
/**
* setUp method
*
*
* @access public
* @return void
*/
@ -452,7 +452,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testParseParamsWithoutZerosAndEmptyPost method
*
*
* @access public
* @return void
*/
@ -468,7 +468,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testParseParamsReturnsPostedData method
*
*
* @access public
* @return void
*/
@ -481,7 +481,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testParseParamsWithSingleZero method
*
*
* @access public
* @return void
*/
@ -496,7 +496,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testParseParamsWithManySingleZeros method
*
*
* @access public
* @return void
*/
@ -512,7 +512,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testParseParamsWithManyZerosInEachSectionOfUrl method
*
*
* @access public
* @return void
*/
@ -528,7 +528,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl method
*
*
* @access public
* @return void
*/
@ -542,9 +542,9 @@ class DispatcherTest extends UnitTestCase {
$this->assertPattern('/\\A(?:000030)\\z/', $test['pass'][4]);
$this->assertPattern('/\\A(?:0000400)\\z/', $test['pass'][5]);
}
/**
/**
* testQueryStringOnRoot method
*
*
* @access public
* @return void
*/
@ -558,8 +558,8 @@ class DispatcherTest extends UnitTestCase {
$this->assertPattern('/home/',$result['action']);
$this->assertTrue(isset($result['url']['sleep']));
$this->assertTrue(isset($result['url']['coffee']));
$Dispatcher =& new Dispatcher();
$uri = '/?coffee=life&sleep=sissy';
$result = $Dispatcher->parseParams($uri);
@ -568,12 +568,12 @@ class DispatcherTest extends UnitTestCase {
$this->assertTrue(isset($result['url']['sleep']));
$this->assertTrue(isset($result['url']['coffee']));
$this->assertEqual($result['url']['coffee'], 'life');
$_GET = $this->_get;
$_GET = $this->_get;
}
/**
* testFileUploadArrayStructure method
*
*
* @access public
* @return void
*/
@ -672,7 +672,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testGetUrl method
*
*
* @access public
* @return void
*/
@ -706,11 +706,11 @@ class DispatcherTest extends UnitTestCase {
$result = $Dispatcher->getUrl($uri);
$expected = '?/home';
$this->assertEqual($expected, $result);
}
/**
* testBaseUrlAndWebrootWithModRewrite method
*
*
* @access public
* @return void
*/
@ -785,7 +785,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testBaseUrlwithModRewriteAlias method
*
*
* @access public
* @return void
*/
@ -819,7 +819,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testBaseUrlAndWebrootWithBaseUrl method
*
*
* @access public
* @return void
*/
@ -888,7 +888,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testBaseUrlAndWebrootWithBase method
*
*
* @access public
* @return void
*/
@ -918,7 +918,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testMissingController method
*
*
* @access public
* @return void
*/
@ -933,7 +933,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testPrivate method
*
*
* @access public
* @return void
*/
@ -948,7 +948,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testMissingAction method
*
*
* @access public
* @return void
*/
@ -963,7 +963,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testDispatch method
*
*
* @access public
* @return void
*/
@ -1012,7 +1012,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testAdminDispatch method
*
*
* @access public
* @return void
*/
@ -1042,7 +1042,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testPluginDispatch method
*
*
* @access public
* @return void
*/
@ -1087,7 +1087,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testAutomaticPluginDispatch method
*
*
* @access public
* @return void
*/
@ -1124,7 +1124,7 @@ class DispatcherTest extends UnitTestCase {
}
/**
* testAutomaticPluginControllerDispatch method
*
*
* @access public
* @return void
*/
@ -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();
@ -1261,17 +1281,22 @@ class DispatcherTest extends UnitTestCase {
$Dispatcher->cached('css/test_asset.css');
$result = ob_get_clean();
$this->assertEqual('this is the test asset css file', $result);
Configure::write('debug', 0);
$Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/test_plugin_asset.css');
ob_start();
$Dispatcher->cached('test_plugin/css/test_plugin_asset.css');
$result = ob_get_clean();
$this->assertEqual('this is the test plugin asset css file', $result);
header('Content-type: text/html'); //reset the header content-type without page can render as plain text.
}
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;
}

View file

@ -38,7 +38,7 @@ if (!class_exists('Cache')) {
class CacheTest extends CakeTestCase {
/**
* start method
*
*
* @access public
* @return void
*/
@ -48,7 +48,7 @@ class CacheTest extends CakeTestCase {
}
/**
* end method
*
*
* @access public
* @return void
*/
@ -57,7 +57,7 @@ class CacheTest extends CakeTestCase {
}
/**
* testConfig method
*
*
* @access public
* @return void
*/
@ -68,7 +68,7 @@ class CacheTest extends CakeTestCase {
}
/**
* testConfigChange method
*
*
* @access public
* @return void
*/
@ -81,7 +81,7 @@ class CacheTest extends CakeTestCase {
}
/**
* testWritingWithConfig method
*
*
* @access public
* @return void
*/
@ -104,7 +104,7 @@ class CacheTest extends CakeTestCase {
}
/**
* testInitSettings method
*
*
* @access public
* @return void
*/
@ -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'));

View file

@ -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');
}

View file

@ -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);

View file

@ -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');
}

View file

@ -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');
}

View file

@ -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);

View file

@ -46,7 +46,7 @@ class CodeCoverageManagerTest extends UnitTestCase {
}
/**
* testNoTestCaseSupplied method
*
*
* @access public
* @return void
*/
@ -71,8 +71,8 @@ class CodeCoverageManagerTest extends UnitTestCase {
$contents = $folder->ls();
/**
* remove method
*
* @param mixed $var
*
* @param mixed $var
* @access public
* @return void
*/
@ -90,7 +90,7 @@ class CodeCoverageManagerTest extends UnitTestCase {
}
/**
* testGetTestObjectFileNameFromTestCaseFile method
*
*
* @access public
* @return void
*/
@ -127,7 +127,7 @@ class CodeCoverageManagerTest extends UnitTestCase {
}
/**
* testOfHtmlReport method
*
*
* @access public
* @return void
*/
@ -136,19 +136,19 @@ class CodeCoverageManagerTest extends UnitTestCase {
$code = <<<PHP
/**
* Set class
*
*
* @package cake
* @subpackage cake.tests.cases.libs
*/
class Set extends Object {
/**
/**
* Value of the Set object.
*
* @var array
* @access public
*/
var \$value = array();
/**
/**
* Constructor. Defaults to an empty array.
*
* @access public
@ -160,7 +160,7 @@ class CodeCoverageManagerTest extends UnitTestCase {
\$this->value = func_get_args();
}
}
/**
/**
* Returns the contents of the Set object
*
* @return array
@ -169,7 +169,7 @@ class CodeCoverageManagerTest extends UnitTestCase {
function &get() {
return \$this->value;
}
/**
/**
* This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive. The difference
* to the two is that if an array key contains another array then the function behaves recursive (unlike array_merge)
* but does not do if for keys containing strings (unlike array_merge_recursive). See the unit test for more information.
@ -284,7 +284,7 @@ PHP;
}
/**
* testOfHtmlDiffReport method
*
*
* @access public
* @return void
*/
@ -293,19 +293,19 @@ PHP;
$code = <<<PHP
/**
* Set class
*
*
* @package cake
* @subpackage cake.tests.cases.libs
*/
class Set extends Object {
/**
/**
* Value of the Set object.
*
* @var array
* @access public
*/
var \$value = array();
/**
/**
* Constructor. Defaults to an empty array.
*
* @access public
@ -317,7 +317,7 @@ PHP;
\$this->value = func_get_args();
}
}
/**
/**
* Returns the contents of the Set object
*
* @return array
@ -326,7 +326,7 @@ PHP;
function &get() {
return \$this->value;
}
/**
/**
* This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive. The difference
* to the two is that if an array key contains another array then the function behaves recursive (unlike array_merge)
* but does not do if for keys containing strings (unlike array_merge_recursive). See the unit test for more information.
@ -543,7 +543,7 @@ PHP;
}
/**
* testArrayStrrpos method
*
*
* @access public
* @return void
*/
@ -575,7 +575,7 @@ PHP;
}
/**
* testGetExecutableLines method
*
*
* @access public
* @return void
*/
@ -610,7 +610,12 @@ HTML;
$this->assertIdentical(trim($line), '');
}
}
/**
* testCalculateCodeCoverage method
*
* @access public
* @return void
*/
function testCalculateCodeCoverage() {
$manager =& CodeCoverageManager::getInstance();
$data = array(

View file

@ -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');

View file

@ -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)) {

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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>";

View file

@ -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);

View file

@ -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])) {

View file

@ -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();

View file

@ -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();

View file

@ -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);
}

View file

@ -35,10 +35,10 @@ App::import('Core', 'Debugger');
*/
class DebuggerTest extends UnitTestCase {
//do not move code below or it change line numbers which are used in the tests
//do not move code below or it change line numbers which are used in the tests
/**
* setUp method
*
*
* @access public
* @return void
*/
@ -52,9 +52,9 @@ class DebuggerTest extends UnitTestCase {
}
}
}
/**
/**
* testDocRef method
*
*
* @access public
* @return void
*/
@ -66,7 +66,7 @@ class DebuggerTest extends UnitTestCase {
}
/**
* testOutput method
*
*
* @access public
* @return void
*/
@ -76,22 +76,22 @@ class DebuggerTest extends UnitTestCase {
$this->assertEqual($result, '');
$out .= '';
$result = Debugger::output(true);
$this->assertEqual($result[0]['error'], 'Notice');
$this->assertEqual($result[0]['description'], 'Undefined variable: out');
$this->assertPattern('/DebuggerTest::testOutput/', $result[0]['trace']);
$this->assertPattern('/SimpleInvoker::invoke/', $result[0]['trace']);
ob_start();
Debugger::output('txt');
$other .= '';
$result = ob_get_clean();
$this->assertPattern('/Undefined variable: other/', $result);
$this->assertPattern('/Context:/', $result);
$this->assertPattern('/DebuggerTest::testOutput/', $result);
$this->assertPattern('/SimpleInvoker::invoke/', $result);
ob_start();
Debugger::output('html');
$wrong .= '';
@ -99,7 +99,7 @@ class DebuggerTest extends UnitTestCase {
$this->assertPattern('/<pre class="cake-debug">.+<\/pre>/', $result);
$this->assertPattern('/<b>Notice<\/b>/', $result);
$this->assertPattern('/variable: wrong/', $result);
ob_start();
Debugger::output('js');
$buzz .= '';
@ -108,12 +108,12 @@ class DebuggerTest extends UnitTestCase {
$this->assertPattern('/<b>Notice<\/b>/', $result);
$this->assertPattern('/Undefined variable: buzz/', $result);
$this->assertPattern('/<a[^>]+>Code<\/a>/', $result);
$this->assertPattern('/<a[^>]+>Context<\/a>/', $result);
$this->assertPattern('/<a[^>]+>Context<\/a>/', $result);
set_error_handler('simpleTestErrorHandler');
}
/**
* testTrimPath method
*
*
* @access public
* @return void
*/
@ -123,7 +123,7 @@ class DebuggerTest extends UnitTestCase {
}
/**
* testExportVar method
*
*
* @access public
* @return void
*/
@ -174,7 +174,7 @@ class DebuggerTest extends UnitTestCase {
}
/**
* testLog method
*
*
* @access public
* @return void
*/
@ -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(
@ -210,7 +215,7 @@ class DebuggerTest extends UnitTestCase {
'name' => 'Shaft',
'coat' => 'black',
'hair' => 'black'
)
)
)
);
ob_start();
@ -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);
}

View file

@ -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(

View file

@ -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();

View file

@ -37,14 +37,14 @@ App::import('Core', 'File');
class FolderTest extends UnitTestCase {
/**
* Folder property
*
*
* @var mixed null
* @access public
*/
var $Folder = null;
/**
* testBasic method
*
*
* @access public
* @return void
*/
@ -65,7 +65,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testInPath method
*
*
* @access public
* @return void
*/
@ -92,7 +92,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testOperations method
*
*
* @access public
* @return void
*/
@ -155,7 +155,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testRealPathForWebroot method
*
*
* @access public
* @return void
*/
@ -165,7 +165,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testZeroAsDirectory method
*
*
* @access public
* @return void
*/
@ -188,7 +188,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testFolderRead method
*
*
* @access public
* @return void
*/
@ -200,7 +200,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testFolderTree method
*
*
* @access public
* @return void
*/
@ -240,7 +240,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testWindowsPath method
*
*
* @access public
* @return void
*/
@ -251,7 +251,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testIsAbsolute method
*
*
* @access public
* @return void
*/
@ -263,7 +263,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testIsSlashTerm method
*
*
* @access public
* @return void
*/
@ -275,7 +275,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testStatic method
*
*
* @access public
* @return void
*/
@ -285,7 +285,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testNormalizePath method
*
*
* @access public
* @return void
*/
@ -304,7 +304,7 @@ class FolderTest extends UnitTestCase {
}
/**
* correctSlashFor method
*
*
* @access public
* @return void
*/
@ -323,7 +323,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testInCakePath method
*
*
* @access public
* @return void
*/
@ -347,7 +347,7 @@ class FolderTest extends UnitTestCase {
}
/**
* testFind method
*
*
* @access public
* @return void
*/
@ -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);

View file

@ -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 );

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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');
@ -3302,4 +3329,4 @@ class ContainableTest extends CakeTestCase {
}
}
?>
?>

View file

@ -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';

View file

@ -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);

View file

@ -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() {
}

View file

@ -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);
}

View file

@ -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));');

View file

@ -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';

View file

@ -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");

View file

@ -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');

View file

@ -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');

View file

@ -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

View file

@ -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);
}

View file

@ -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);
}

View file

@ -41,7 +41,7 @@ if (!defined('FULL_BASE_URL')) {
class RouterTest extends UnitTestCase {
/**
* setUp method
*
*
* @access public
* @return void
*/
@ -51,7 +51,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testReturnedInstanceReference method
*
*
* @access public
* @return void
*/
@ -62,7 +62,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testFullBaseURL method
*
*
* @access public
* @return void
*/
@ -72,7 +72,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testRouteWriting method
*
*
* @access public
* @return void
*/
@ -132,7 +132,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testRouteDefaultParams method
*
*
* @access public
* @return void
*/
@ -142,7 +142,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testRouterIdentity method
*
*
* @access public
* @return void
*/
@ -152,7 +152,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testResourceRoutes method
*
*
* @access public
* @return void
*/
@ -208,7 +208,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testMultipleResourceRoute method
*
*
* @access public
* @return void
*/
@ -225,7 +225,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testUrlNormalization method
*
*
* @access public
* @return void
*/
@ -249,7 +249,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testUrlGeneration method
*
*
* @access public
* @return void
*/
@ -596,7 +596,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testUrlGenerationWithPrefix method
*
*
* @access public
* @return void
*/
@ -623,7 +623,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testUrlGenerationWithExtensions method
*
*
* @access public
* @return void
*/
@ -647,7 +647,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testPluginUrlGeneration method
*
*
* @access public
* @return void
*/
@ -668,7 +668,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testUrlParsing method
*
*
* @access public
* @return void
*/
@ -811,7 +811,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testUuidRoutes method
*
*
* @access public
* @return void
*/
@ -827,7 +827,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testRouteSymmetry method
*
*
* @access public
* @return void
*/
@ -865,7 +865,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testAdminRouting method
*
*
* @access public
* @return void
*/
@ -930,7 +930,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testExtensionParsingSetting method
*
*
* @access public
* @return void
*/
@ -943,7 +943,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testExtensionParsing method
*
*
* @access public
* @return void
*/
@ -984,7 +984,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testQuerystringGeneration method
*
*
* @access public
* @return void
*/
@ -1000,7 +1000,7 @@ class RouterTest extends UnitTestCase {
$result = Router::url(array('controller' => 'posts', 'action'=>'index', '0', '?' => array('var' => 'test', 'var2' => 'test2', 'more' => 'test data')));
$this->assertEqual($result, $expected);
// Test bug #4614
// Test bug #4614
$restore = ini_get('arg_separator.output');
ini_set('arg_separator.output', '&amp;');
$result = Router::url(array('controller' => 'posts', 'action'=>'index', '0', '?' => array('var' => 'test', 'var2' => 'test2', 'more' => 'test data')));
@ -1009,7 +1009,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testConnectNamed method
*
*
* @access public
* @return void
*/
@ -1020,7 +1020,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testNamedArgsUrlGeneration method
*
*
* @access public
* @return void
*/
@ -1073,7 +1073,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testNamedArgsUrlParsing method
*
*
* @access public
* @return void
*/
@ -1139,7 +1139,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testUrlGenerationWithPrefixes method
*
*
* @access public
* @return void
*/
@ -1168,7 +1168,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testRemoveBase method
*
*
* @access public
* @return void
*/
@ -1192,7 +1192,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testParamsUrlParsing method
*
*
* @access public
* @return void
*/
@ -1220,7 +1220,7 @@ class RouterTest extends UnitTestCase {
}
/**
* testPagesUrlParsing method
*
*
* @access public
* @return void
*/
@ -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'));

View file

@ -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');

View file

@ -36,23 +36,23 @@ App::import('Core', 'Security');
class SecurityTest extends UnitTestCase {
/**
* sut property
*
*
* @var mixed null
* @access public
*/
var $sut = null;
/**
/**
* setUp method
*
*
* @access public
* @return void
*/
function setUp() {
$this->sut =& Security::getInstance();
}
/**
/**
* testInactiveMins method
*
*
* @access public
* @return void
*/
@ -66,18 +66,18 @@ class SecurityTest extends UnitTestCase {
Configure::write('Security.level', 'low');
$this->assertEqual(300, Security::inactiveMins());
}
/**
/**
* testGenerateAuthkey method
*
*
* @access public
* @return void
*/
function testGenerateAuthkey() {
$this->assertEqual(strlen(Security::generateAuthKey()), 40);
}
/**
/**
* testValidateAuthKey method
*
*
* @access public
* @return void
*/
@ -87,7 +87,7 @@ class SecurityTest extends UnitTestCase {
}
/**
* testHash method
*
*
* @access public
* @return void
*/
@ -122,11 +122,16 @@ class SecurityTest extends UnitTestCase {
$this->assertIdentical(strlen(Security::hash($key, 'sha256', true)), 32);
}
}
/**
* testCipher method
*
* @access public
* @return void
*/
function testCipher() {
$length = 10;
$txt = '';
for ($i = 0; $i < $length; $i++) {
for ($i = 0; $i < $length; $i++) {
$txt .= rand(0, 255);
}
$key = 'my_key';

View file

@ -34,10 +34,10 @@ App::import('Core', 'Session');
* @subpackage cake.tests.cases.libs
*/
class SessionTest extends CakeTestCase {
var $fixtures = array('core.session'); //using fixtures really messes things up. but should eventually be used.
/**
var $fixtures = array('core.session');//using fixtures really messes things up. but should eventually be used.
/**
* setUp method
*
*
* @access public
* @return void
*/
@ -52,7 +52,7 @@ class SessionTest extends CakeTestCase {
}
/**
* testCheck method
*
*
* @access public
* @return void
*/
@ -62,9 +62,9 @@ class SessionTest extends CakeTestCase {
$this->assertFalse($this->Session->check('NotExistingSessionTestCase'), false);
}
/**
/**
* testSimpleRead method
*
*
* @access public
* @return void
*/
@ -72,22 +72,22 @@ class SessionTest extends CakeTestCase {
$this->Session->write('testing', '1,2,3');
$result = $this->Session->read('testing');
$this->assertEqual($result, '1,2,3');
$this->Session->write('testing', array('1' => 'one', '2' => 'two','3' => 'three'));
$result = $this->Session->read('testing.1');
$this->assertEqual($result, 'one');
$result = $this->Session->read('testing');
$this->assertEqual($result, array('1' => 'one', '2' => 'two', '3' => 'three'));
$result = $this->Session->read();
$this->assertTrue(isset($result['testing']));
$this->assertTrue(isset($result['Config']));
$this->assertTrue(isset($result['Config']['userAgent']));
}
/**
/**
* testId method
*
*
* @access public
* @return void
*/
@ -95,27 +95,27 @@ class SessionTest extends CakeTestCase {
$expected = session_id();
$result = $this->Session->id();
$this->assertEqual($result, $expected);
$this->Session->id('MySessionId');
$result = $this->Session->id();
$this->assertEqual($result, 'MySessionId');
}
/**
/**
* testStarted method
*
*
* @access public
* @return void
*/
function testStarted() {
$this->assertTrue($this->Session->started());
unset($_SESSION);
$this->assertFalse($this->Session->started());
$this->assertFalse($this->Session->started());
$this->assertTrue($this->Session->start());
}
/**
/**
* testError method
*
*
* @access public
* @return void
*/
@ -123,14 +123,14 @@ class SessionTest extends CakeTestCase {
$this->Session->read('Does.not.exist');
$result = $this->Session->error();
$this->assertEqual($result, "Does.not.exist doesn't exist");
$this->Session->del('Failing.delete');
$result = $this->Session->error();
$this->assertEqual($result, "Failing.delete doesn't exist");
}
/**
/**
* testDel method
*
*
* @access public
* @return void
*/
@ -139,34 +139,34 @@ class SessionTest extends CakeTestCase {
$this->assertTrue($this->Session->del('Delete.me'));
$this->assertFalse($this->Session->check('Delete.me'));
$this->assertTrue($this->Session->check('Delete'));
$this->assertTrue($this->Session->write('Clearing.sale', 'everything must go'));
$this->assertTrue($this->Session->del('Clearing'));
$this->assertFalse($this->Session->check('Clearing.sale'));
$this->assertFalse($this->Session->check('Clearing'));
}
/**
/**
* testWatchVar method
*
*
* @access public
* @return void
*/
function testWatchVar() {
$this->assertFalse($this->Session->watch(null));
$this->Session->write('Watching', "I'm watching you");
$this->Session->watch('Watching');
$this->expectError('Writing session key {Watching}: "They found us!"');
$this->Session->write('Watching', 'They found us!');
$this->Session->write('Watching', 'They found us!');
$this->expectError('Deleting session key {Watching}');
$this->Session->del('Watching');
$this->assertFalse($this->Session->watch('Invalid.key'));
$this->assertFalse($this->Session->watch('Invalid.key'));
}
/**
/**
* testIgnore method
*
*
* @access public
* @return void
*/
@ -176,9 +176,9 @@ class SessionTest extends CakeTestCase {
$this->Session->ignore('Watching');
$this->assertTrue($this->Session->write('Watching', 'They found us!'));
}
/**
/**
* testDestroy method
*
*
* @access public
* @return void
*/
@ -189,9 +189,9 @@ class SessionTest extends CakeTestCase {
$this->assertFalse($this->Session->check('bulletProof'));
$this->assertNotEqual($id, $this->Session->id());
}
/**
/**
* testCheckingSavedEmpty method
*
*
* @access public
* @return void
*/
@ -210,7 +210,7 @@ class SessionTest extends CakeTestCase {
}
/**
* testCheckKeyWithSpaces method
*
*
* @access public
* @return void
*/
@ -224,7 +224,7 @@ class SessionTest extends CakeTestCase {
}
/**
* testReadingSavedEmpty method
*
*
* @access public
* @return void
*/
@ -244,7 +244,7 @@ class SessionTest extends CakeTestCase {
}
/**
* testCheckUserAgentFalse method
*
*
* @access public
* @return void
*/
@ -255,7 +255,7 @@ class SessionTest extends CakeTestCase {
}
/**
* testCheckUserAgentTrue method
*
*
* @access public
* @return void
*/
@ -266,7 +266,7 @@ class SessionTest extends CakeTestCase {
}
/**
* testReadAndWriteWithDatabaseStorage method
*
*
* @access public
* @return void
*/
@ -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);

View file

@ -37,7 +37,7 @@ App::import('Core', 'Set');
class SetTest extends UnitTestCase {
/**
* testNumericKeyExtraction method
*
*
* @access public
* @return void
*/
@ -48,7 +48,7 @@ class SetTest extends UnitTestCase {
}
/**
* testEnum method
*
*
* @access public
* @return void
*/
@ -57,17 +57,17 @@ class SetTest extends UnitTestCase {
$this->assertIdentical($result, 'two');
$result = Set::enum(2, 'one, two');
$this->assertNull($result);
$result = Set::enum(1, array('one', 'two'));
$this->assertIdentical($result, 'two');
$result = Set::enum(2, array('one', 'two'));
$this->assertNull($result);
$result = Set::enum('first', array('first' => 'one', 'second' => 'two'));
$this->assertIdentical($result, 'one');
$result = Set::enum('third', array('first' => 'one', 'second' => 'two'));
$this->assertNull($result);
$result = Set::enum('no', array('no' => 0, 'yes' => 1));
$this->assertIdentical($result, 0);
$result = Set::enum('not sure', array('no' => 0, 'yes' => 1));
@ -75,7 +75,7 @@ class SetTest extends UnitTestCase {
}
/**
* testFilter method
*
*
* @access public
* @return void
*/
@ -86,7 +86,7 @@ class SetTest extends UnitTestCase {
}
/**
* testNumericArrayCheck method
*
*
* @access public
* @return void
*/
@ -105,7 +105,7 @@ class SetTest extends UnitTestCase {
}
/**
* testKeyCheck method
*
*
* @access public
* @return void
*/
@ -142,7 +142,7 @@ class SetTest extends UnitTestCase {
}
/**
* testMerge method
*
*
* @access public
* @return void
*/
@ -155,12 +155,12 @@ class SetTest extends UnitTestCase {
$r = Set::merge('foo', 'bar');
$this->assertIdentical($r, array('foo', 'bar'));
if (substr(phpversion(), 0, 1) >= 5) {
$r = eval('class StaticSetCaller{static function merge($a, $b){return Set::merge($a, $b);}} return StaticSetCaller::merge("foo", "bar");');
$this->assertIdentical($r, array('foo', 'bar'));
}
$r = Set::merge('foo', array('user' => 'bob', 'no-bar'), 'bar');
$this->assertIdentical($r, array('foo', 'user' => 'bob', 'no-bar', 'bar'));
@ -239,7 +239,7 @@ class SetTest extends UnitTestCase {
}
/**
* testSort method
*
*
* @access public
* @return void
*/
@ -324,7 +324,7 @@ class SetTest extends UnitTestCase {
}
/**
* testExtract method
*
*
* @access public
* @return void
*/
@ -602,7 +602,7 @@ class SetTest extends UnitTestCase {
$expected = array(3);
$r = Set::extract('/Article[:last]/id', $common);
$this->assertEqual($r, $expected);
$expected = array(array('Comment' => $common[1]['Comment'][0]));
$r = Set::extract('/Comment[addition=]', $common);
$this->assertEqual($r, $expected);
@ -615,7 +615,7 @@ class SetTest extends UnitTestCase {
*/
/**
* testMatches method
*
*
* @access public
* @return void
*/
@ -643,7 +643,7 @@ class SetTest extends UnitTestCase {
}
/**
* testClassicExtract method
*
*
* @access public
* @return void
*/
@ -752,7 +752,7 @@ class SetTest extends UnitTestCase {
}
/**
* testCheck method
*
*
* @access public
* @return void
*/
@ -771,7 +771,7 @@ class SetTest extends UnitTestCase {
}
/**
* testWritingWithFunkyKeys method
*
*
* @access public
* @return void
*/
@ -788,7 +788,7 @@ class SetTest extends UnitTestCase {
}
/**
* testCombine method
*
*
* @access public
* @return void
*/
@ -797,7 +797,7 @@ class SetTest extends UnitTestCase {
$this->assertFalse($result);
$result = Set::combine('', '{n}.User.id', '{n}.User.Data');
$this->assertFalse($result);
$a = array(
array('User' => array('id' => 2, 'group_id' => 1,
'Data' => array('user' => 'mariano.iglesias','name' => 'Mariano Iglesias'))),
@ -906,7 +906,7 @@ class SetTest extends UnitTestCase {
}
/**
* testMapReverse method
*
*
* @access public
* @return void
*/
@ -1143,7 +1143,7 @@ class SetTest extends UnitTestCase {
}
/**
* testFormatting method
*
*
* @access public
* @return void
*/
@ -1190,7 +1190,7 @@ class SetTest extends UnitTestCase {
}
/**
* testCountDim method
*
*
* @access public
* @return void
*/
@ -1237,7 +1237,7 @@ class SetTest extends UnitTestCase {
}
/**
* testMapNesting method
*
*
* @access public
* @return void
*/
@ -1357,7 +1357,7 @@ class SetTest extends UnitTestCase {
}
/**
* testNestedMappedData method
*
*
* @access public
* @return void
*/
@ -1443,7 +1443,7 @@ class SetTest extends UnitTestCase {
}
/**
* testPushDiff method
*
*
* @access public
* @return void
*/
@ -1490,7 +1490,7 @@ class SetTest extends UnitTestCase {
}
/**
* testXmlSetReverse method
*
*
* @access public
* @return void
*/
@ -1552,7 +1552,7 @@ class SetTest extends UnitTestCase {
)
));
$this->assertEqual($result, $expected);
$string ='<data><post title="Title of this post" description="cool" /></data>';
$string ='<data><post title="Title of this post" description="cool"/></data>';
$xml = new Xml($string);
$result = Set::reverse($xml);
@ -1561,7 +1561,7 @@ class SetTest extends UnitTestCase {
$xml = new Xml('<example><item><title>An example of a correctly reversed XMLNode</title><desc/></item></example>');
$result = Set::reverse($xml);
$expected = array('Example' =>
$expected = array('Example' =>
array(
'Item' => array(
'title' => 'An example of a correctly reversed XMLNode',
@ -1570,29 +1570,29 @@ class SetTest extends UnitTestCase {
)
);
$this->assertIdentical($result, $expected);
$xml = new Xml('<example><item attr="123"><titles><title>title1</title><title>title2</title></titles></item></example>');
$result = Set::reverse($xml);
$expected =
$expected =
array('Example' => array(
'Item' => array(
'attr' => '123',
'attr' => '123',
'Titles' => array(
array('Title' => 'title1'),
array('Title' => 'title2'),
)
)
)
)
);
$this->assertIdentical($result, $expected);
$xml = new Xml('<example attr="ex_attr"><item attr="123"><titles>list</titles>textforitems</item></example>');
$result = Set::reverse($xml);
$expected =
$expected =
array('Example' => array(
'attr' => 'ex_attr',
'Item' => array(
'attr' => '123',
'attr' => '123',
'titles' => 'list',
'value' => 'textforitems'
)
@ -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'));

View file

@ -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);
}

View file

@ -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'));

View file

@ -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();

View file

@ -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();

View file

@ -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);
}

View file

@ -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} !== '_') {

View file

@ -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'), '&lt;text&gt;', '/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'), '&lt;text&gt;', '/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'), '&lt;text&gt;', '/p'));
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Html);
}

View file

@ -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();');

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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'));
@ -229,4 +284,4 @@ class RssTest extends CakeTestCase {
$this->assertTags($result, $expected);
}
}
?>
?>

View file

@ -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());

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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,10 +219,15 @@ 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);
}
}
?>
?>

View file

@ -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);

View file

@ -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);

View file

@ -37,12 +37,12 @@ App::import('Core', 'Xml');
class XmlTest extends UnitTestCase {
/**
* testRootTagParsing method
*
*
* @access public
* @return void
*/
function testRootTagParsing() {
$input = '<' . '?xml version="1.0" encoding="UTF-8" ?' . '>' . "\n" . '<plugin id="1" version_id="1" name="my_plugin" title="My Plugin" author="Me" author_email="me@cakephp.org" description="My awesome package" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13"><current id="1" plugin_id="1" name="1.0" file="" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13" /><version id="1" plugin_id="1" name="1.0" file="" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13" /></plugin>';
$input = '<' . '?xml version="1.0" encoding="UTF-8" ?' . '>' . "\n" . '<plugin id="1" version_id="1" name="my_plugin" title="My Plugin" author="Me" author_email="me@cakephp.org" description="My awesome package" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13"><current id="1" plugin_id="1" name="1.0" file="" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13"/><version id="1" plugin_id="1" name="1.0" file="" created="2008-01-28 18:21:13" updated="2008-01-28 18:21:13" /></plugin>';
$xml = new Xml($input);
$this->assertEqual($xml->children[0]->name, 'plugin');
$this->assertEqual($xml->children[0]->children[0]->name, 'current');
@ -50,7 +50,7 @@ class XmlTest extends UnitTestCase {
}
/**
* testSerialization method
*
*
* @access public
* @return void
*/
@ -72,7 +72,7 @@ class XmlTest extends UnitTestCase {
$xml = new Xml($input);
$result = preg_replace("/\n/",'', $xml->toString(false));
$expected = '<project id="1" title="" client_id="1" show="1" is_spotlight="" style_id="0" job_type_id="1" industry_id="1" modified="" created=""><style id="" name="" /><job_type id="1" name="Touch Screen Kiosk" /><industry id="1" name="Financial" /></project><project id="2" title="" client_id="2" show="1" is_spotlight="" style_id="0" job_type_id="2" industry_id="2" modified="2007-11-26 14:48:36" created=""><style id="" name="" /><job_type id="2" name="Awareness Campaign" /><industry id="2" name="Education" /></project>';
$expected = '<project id="1" title="" client_id="1" show="1" is_spotlight="" style_id="0" job_type_id="1" industry_id="1" modified="" created=""><style id="" name=""/><job_type id="1" name="Touch Screen Kiosk" /><industry id="1" name="Financial" /></project><project id="2" title="" client_id="2" show="1" is_spotlight="" style_id="0" job_type_id="2" industry_id="2" modified="2007-11-26 14:48:36" created=""><style id="" name="" /><job_type id="2" name="Awareness Campaign" /><industry id="2" name="Education" /></project>';
$this->assertEqual($result, $expected);
$input = array(
@ -81,14 +81,14 @@ class XmlTest extends UnitTestCase {
'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),
'Industry' => array('id' => 1, 'name' => 'Financial')
);
$expected = '<project id="1" title="" client_id="1" show="1" is_spotlight="" style_id="0" job_type_id="1" industry_id="1" modified="" created=""><style id="" name="" /><job_type id="1" name="Touch Screen Kiosk" /><industry id="1" name="Financial" /></project>';
$expected = '<project id="1" title="" client_id="1" show="1" is_spotlight="" style_id="0" job_type_id="1" industry_id="1" modified="" created=""><style id="" name=""/><job_type id="1" name="Touch Screen Kiosk" /><industry id="1" name="Financial" /></project>';
$xml = new Xml($input);
$result = preg_replace("/\n/",'', $xml->toString(false));
$this->assertEqual($result, $expected);
}
/**
* testSimpleArray method
*
*
* @access public
* @return void
*/
@ -101,7 +101,7 @@ class XmlTest extends UnitTestCase {
}
/**
* testSimpleObject method
*
*
* @access public
* @return void
*/
@ -114,9 +114,9 @@ class XmlTest extends UnitTestCase {
$expected = '<hello><![CDATA[world]]></hello>';
$this->assertEqual($expected, $result);
}
/**
/**
* testHeader method
*
*
* @access public
* @return void
*/
@ -131,7 +131,7 @@ class XmlTest extends UnitTestCase {
}
/**
* testOwnerAssignment method
*
*
* @access public
* @return void
*/
@ -147,7 +147,7 @@ class XmlTest extends UnitTestCase {
}
/**
* testArraySingleSerialization method
*
*
* @access public
* @return void
*/
@ -164,7 +164,7 @@ class XmlTest extends UnitTestCase {
}
/**
* testArraySerialization method
*
*
* @access public
* @return void
*/
@ -183,7 +183,7 @@ class XmlTest extends UnitTestCase {
'Industry' => array('id' => 2, 'name' => 'Education'),
)
);
$expected = '<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>';
$expected = '<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>';
$xml = new Xml($input, array('format' => 'tags'));
$result = $xml->toString(array('header' => false, 'cdata' => false));
@ -191,7 +191,7 @@ class XmlTest extends UnitTestCase {
}
/**
* testNestedArraySerialization method
*
*
* @access public
* @return void
*/
@ -224,155 +224,155 @@ class XmlTest extends UnitTestCase {
)
)
);
$expected = '<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><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type><id>15</id><name>Print</name></media_type><media_type><id>7</id><name>Web Demo</name></media_type><media_type><id>6</id><name>CD-ROM</name></media_type></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><business_solution><id>4</id><name>Build Relationship</name></business_solution><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type><id>17</id><name>Web</name></media_type><media_type><id>6</id><name>CD-ROM</name></media_type></project>';
$expected = '<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><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type><id>15</id><name>Print</name></media_type><media_type><id>7</id><name>Web Demo</name></media_type><media_type><id>6</id><name>CD-ROM</name></media_type></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><business_solution><id>4</id><name>Build Relationship</name></business_solution><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type><id>17</id><name>Web</name></media_type><media_type><id>6</id><name>CD-ROM</name></media_type></project>';
$xml = new Xml($input, array('format' => 'tags'));
$result = $xml->toString(array('header' => false, 'cdata' => false));
$this->assertEqual($expected, $result);
}
/*
/*
* Not implemented yet
*/
// function testChildFilter() {
// $input = array(
// array(
// 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null),
// 'Style' => array('id' => null, 'name' => null),
// 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),
// 'Industry' => array('id' => 1, 'name' => 'Financial'),
// 'BusinessSolution' => array(array('id' => 6, 'name' => 'Convert Sales')),
// 'MediaType' => array(
// array('id' => 15, 'name' => 'Print'),
// array('id' => 7, 'name' => 'Web Demo'),
// array('id' => 6, 'name' => 'CD-ROM')
// )
// ),
// array(
// 'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null),
// 'Style' => array('id' => null, 'name' => null),
// 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),
// 'Industry' => array('id' => 2, 'name' => 'Education'),
// 'BusinessSolution' => array(
// array('id' => 4, 'name' => 'Build Relationship'),
// array('id' => 6, 'name' => 'Convert Sales')
// ),
// 'MediaType' => array(
// array('id' => 17, 'name' => 'Web'),
// array('id' => 6, 'name' => 'CD-ROM')
// )
// )
// );
//
// $xml = new Xml($input, array('format' => 'tags', 'tags' => array(
// 'MediaType' => array('value' => 'id', 'children' => false),
// 'JobType' => array('children' => array()),
// 'Industry' => array('children' => array('name')),
// 'show' => false
// )));
//
// $result = $xml->toString(array('header' => false, 'cdata' => false));
// $expected = '<project><id>1</id><title /><client_id>1</client_id><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><name>Financial</name></industry><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type>15</media_type><media_type>7</media_type><media_type>6</media_type></project><project><id>2</id><title /><client_id>2</client_id><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><name>Education</name></industry><business_solution><id>4</id><name>Build Relationship</name></business_solution><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type>17</media_type><media_type>6</media_type></project>';
// $this->assertEqual($expected, $result);
// }
// function testChildFilter() {
// $input = array(
// array(
// 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null),
// 'Style' => array('id' => null, 'name' => null),
// 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),
// 'Industry' => array('id' => 1, 'name' => 'Financial'),
// 'BusinessSolution' => array(array('id' => 6, 'name' => 'Convert Sales')),
// 'MediaType' => array(
// array('id' => 15, 'name' => 'Print'),
// array('id' => 7, 'name' => 'Web Demo'),
// array('id' => 6, 'name' => 'CD-ROM')
// )
// ),
// array(
// 'Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null),
// 'Style' => array('id' => null, 'name' => null),
// 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),
// 'Industry' => array('id' => 2, 'name' => 'Education'),
// 'BusinessSolution' => array(
// array('id' => 4, 'name' => 'Build Relationship'),
// array('id' => 6, 'name' => 'Convert Sales')
// ),
// 'MediaType' => array(
// array('id' => 17, 'name' => 'Web'),
// array('id' => 6, 'name' => 'CD-ROM')
// )
// )
// );
//
// $xml = new Xml($input, array('format' => 'tags', 'tags' => array(
// 'MediaType' => array('value' => 'id', 'children' => false),
// 'JobType' => array('children' => array()),
// 'Industry' => array('children' => array('name')),
// 'show' => false
// )));
//
// $result = $xml->toString(array('header' => false, 'cdata' => false));
// $expected = '<project><id>1</id><title /><client_id>1</client_id><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><name>Financial</name></industry><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type>15</media_type><media_type>7</media_type><media_type>6</media_type></project><project><id>2</id><title /><client_id>2</client_id><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><name>Education</name></industry><business_solution><id>4</id><name>Build Relationship</name></business_solution><business_solution><id>6</id><name>Convert Sales</name></business_solution><media_type>17</media_type><media_type>6</media_type></project>';
// $this->assertEqual($expected, $result);
// }
/*
/*
* Broken due to a Set class issue
*/
// function testMixedArray() {
// $input = array('OptionGroup' => array(
// array('name' => 'OptA', 'id' => 12, 'OptA 1', 'OptA 2', 'OptA 3', 'OptA 4', 'OptA 5', 'OptA 6'),
// array('name' => 'OptB', 'id' => 12, 'OptB 1', 'OptB 2', 'OptB 3', 'OptB 4', 'OptB 5', 'OptB 6')
// ));
// $expected = '<option_group><name>OptA</name><id>12</id><option_group>OptA 1</option_group><option_group>OptA 2</option_group><option_group>OptA 3</option_group><option_group>OptA 4</option_group><option_group>OptA 5</option_group><option_group>OptA 6</option_group></option_group><option_group><name>OptB</name><id>12</id><option_group>OptB 1</option_group><option_group>OptB 2</option_group><option_group>OptB 3</option_group><option_group>OptB 4</option_group><option_group>OptB 5</option_group><option_group>OptB 6</option_group></option_group>';
// $xml = new Xml($input, array('format' => 'tags'));
// $result = $xml->toString(array('header' => false, 'cdata' => false));
// $this->assertEqual($expected, $result);
// }
// function testMixedArray() {
// $input = array('OptionGroup' => array(
// array('name' => 'OptA', 'id' => 12, 'OptA 1', 'OptA 2', 'OptA 3', 'OptA 4', 'OptA 5', 'OptA 6'),
// array('name' => 'OptB', 'id' => 12, 'OptB 1', 'OptB 2', 'OptB 3', 'OptB 4', 'OptB 5', 'OptB 6')
// ));
// $expected = '<option_group><name>OptA</name><id>12</id><option_group>OptA 1</option_group><option_group>OptA 2</option_group><option_group>OptA 3</option_group><option_group>OptA 4</option_group><option_group>OptA 5</option_group><option_group>OptA 6</option_group></option_group><option_group><name>OptB</name><id>12</id><option_group>OptB 1</option_group><option_group>OptB 2</option_group><option_group>OptB 3</option_group><option_group>OptB 4</option_group><option_group>OptB 5</option_group><option_group>OptB 6</option_group></option_group>';
// $xml = new Xml($input, array('format' => 'tags'));
// $result = $xml->toString(array('header' => false, 'cdata' => false));
// $this->assertEqual($expected, $result);
// }
// function testMixedNestedArray() {
// $input = array(
// 'OptionA' => array(
// 'name' => 'OptA',
// 'id' => 12,
// 'opt' => array('OptA 1', 'OptA 2', 'OptA 3', 'OptA 4', 'OptA 5', 'OptA 6')
// ),
// 'OptionB' => array(
// 'name' => 'OptB',
// 'id' => 12,
// 'opt' => array('OptB 1', 'OptB 2', 'OptB 3', 'OptB 4', 'OptB 5', 'OptB 6')
// )
// );
// $expected = '<option_a><name>OptA</name><id>12</id><opt>OptA 1</opt><opt>OptA 2</opt><opt>OptA 3</opt><opt>OptA 4</opt><opt>OptA 5</opt><opt>OptA 6</opt></option_a><option_b><name>OptB</name><id>12</id><opt>OptB 1</opt><opt>OptB 2</opt><opt>OptB 3</opt><opt>OptB 4</opt><opt>OptB 5</opt><opt>OptB 6</opt></option_b>';
// $xml = new Xml($input, array('format' => 'tags'));
// $result = $xml->toString(array('header' => false, 'cdata' => false));
// $this->assertEqual($expected, $result);
// }
// function testMixedNestedArray() {
// $input = array(
// 'OptionA' => array(
// 'name' => 'OptA',
// 'id' => 12,
// 'opt' => array('OptA 1', 'OptA 2', 'OptA 3', 'OptA 4', 'OptA 5', 'OptA 6')
// ),
// 'OptionB' => array(
// 'name' => 'OptB',
// 'id' => 12,
// 'opt' => array('OptB 1', 'OptB 2', 'OptB 3', 'OptB 4', 'OptB 5', 'OptB 6')
// )
// );
// $expected = '<option_a><name>OptA</name><id>12</id><opt>OptA 1</opt><opt>OptA 2</opt><opt>OptA 3</opt><opt>OptA 4</opt><opt>OptA 5</opt><opt>OptA 6</opt></option_a><option_b><name>OptB</name><id>12</id><opt>OptB 1</opt><opt>OptB 2</opt><opt>OptB 3</opt><opt>OptB 4</opt><opt>OptB 5</opt><opt>OptB 6</opt></option_b>';
// $xml = new Xml($input, array('format' => 'tags'));
// $result = $xml->toString(array('header' => false, 'cdata' => false));
// $this->assertEqual($expected, $result);
// }
// function testMixedArrayAttributes() {
// $input = array('OptionGroup' => array(
// array(
// 'name' => 'OptA',
// 'id' => 12,
// array('opt' => 'OptA 1'),
// array('opt' => 'OptA 2'),
// array('opt' => 'OptA 3'),
// array('opt' => 'OptA 4'),
// array('opt' => 'OptA 5'),
// array('opt' => 'OptA 6')
// ),
// array(
// 'name' => 'OptB',
// 'id' => 12,
// array('opt' => 'OptB 1'),
// array('opt' => 'OptB 2'),
// array('opt' => 'OptB 3'),
// array('opt' => 'OptB 4'),
// array('opt' => 'OptB 5'),
// array('opt' => 'OptB 6')
// )
// ));
// $expected = '<option_group name="OptA" id="12"><opt>OptA 1</opt><opt>OptA 2</opt><opt>OptA 3</opt><opt>OptA 4</opt><opt>OptA 5</opt><opt>OptA 6</opt></option_group><option_group name="OptB" id="12"><opt>OptB 1</opt><opt>OptB 2</opt><opt>OptB 3</opt><opt>OptB 4</opt><opt>OptB 5</opt><opt>OptB 6</opt></option_group>';
//
// $options = array('tags' => array('option_group' => array('attributes' => array('id', 'name'))));
// $xml = new Xml($input, $options);
// $result = $xml->toString(false);
//
// $this->assertEqual($expected, $result);
// }
// function testMixedArrayAttributes() {
// $input = array('OptionGroup' => array(
// array(
// 'name' => 'OptA',
// 'id' => 12,
// array('opt' => 'OptA 1'),
// array('opt' => 'OptA 2'),
// array('opt' => 'OptA 3'),
// array('opt' => 'OptA 4'),
// array('opt' => 'OptA 5'),
// array('opt' => 'OptA 6')
// ),
// array(
// 'name' => 'OptB',
// 'id' => 12,
// array('opt' => 'OptB 1'),
// array('opt' => 'OptB 2'),
// array('opt' => 'OptB 3'),
// array('opt' => 'OptB 4'),
// array('opt' => 'OptB 5'),
// array('opt' => 'OptB 6')
// )
// ));
// $expected = '<option_group name="OptA" id="12"><opt>OptA 1</opt><opt>OptA 2</opt><opt>OptA 3</opt><opt>OptA 4</opt><opt>OptA 5</opt><opt>OptA 6</opt></option_group><option_group name="OptB" id="12"><opt>OptB 1</opt><opt>OptB 2</opt><opt>OptB 3</opt><opt>OptB 4</opt><opt>OptB 5</opt><opt>OptB 6</opt></option_group>';
//
// $options = array('tags' => array('option_group' => array('attributes' => array('id', 'name'))));
// $xml = new Xml($input, $options);
// $result = $xml->toString(false);
//
// $this->assertEqual($expected, $result);
// }
/*
/*
* Not implemented yet
*/
// function testTagMap() {
// $input = array(
// array(
// 'Project' => array('id' => 1, 'title' => null, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null),
// 'Style' => array('id' => null, 'name' => null),
// 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),
// 'Industry' => array('id' => 1, 'name' => 'Financial')
// ),
// array(
// 'Project' => array('id' => 2, 'title' => null, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null),
// 'Style' => array('id' => null, 'name' => null),
// 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),
// 'Industry' => array('id' => 2, 'name' => 'Education'),
// )
// );
// $expected = '<project id="1"><title /><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><jobtype id="1">Touch Screen Kiosk</jobtype><industry id="1"><name>Financial</name></industry></project><project id="2"><title /><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><jobtype id="2">Awareness Campaign</jobtype><industry id="2"><name>Education</name></industry></project>';
//
// $xml = new Xml($input, array('tags' => array(
// 'Project' => array('attributes' => array('id')),
// 'style' => array('attributes' => array('id')),
// 'JobType' => array('name' => 'jobtype', 'attributes' => array('id'), 'value' => 'name'),
// 'Industry' => array('attributes' => array('id'))
// )));
// $result = $xml->toString(array('header' => false, 'cdata' => false));
// $this->assertEqual($expected, $result);
// }
// function testTagMap() {
// $input = array(
// array(
// 'Project' => array('id' => 1, 'title' => null, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null),
// 'Style' => array('id' => null, 'name' => null),
// 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'),
// 'Industry' => array('id' => 1, 'name' => 'Financial')
// ),
// array(
// 'Project' => array('id' => 2, 'title' => null, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null),
// 'Style' => array('id' => null, 'name' => null),
// 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'),
// 'Industry' => array('id' => 2, 'name' => 'Education'),
// )
// );
// $expected = '<project id="1"><title /><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><jobtype id="1">Touch Screen Kiosk</jobtype><industry id="1"><name>Financial</name></industry></project><project id="2"><title /><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><jobtype id="2">Awareness Campaign</jobtype><industry id="2"><name>Education</name></industry></project>';
//
// $xml = new Xml($input, array('tags' => array(
// 'Project' => array('attributes' => array('id')),
// 'style' => array('attributes' => array('id')),
// 'JobType' => array('name' => 'jobtype', 'attributes' => array('id'), 'value' => 'name'),
// 'Industry' => array('attributes' => array('id'))
// )));
// $result = $xml->toString(array('header' => false, 'cdata' => false));
// $this->assertEqual($expected, $result);
// }
/**
* testAllCData method
*
*
* @access public
* @return void
*/
@ -391,26 +391,26 @@ class XmlTest extends UnitTestCase {
'Industry' => array('id' => 2, 'name' => 'Education'),
)
);
$expected = '<project><id>1</id><title /><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1.89</job_type_id><industry_id>1.56</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name><![CDATA[Touch Screen Kiosk]]></name></job_type><industry><id>1</id><name><![CDATA[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.2</job_type_id><industry_id>2.2</industry_id><modified><![CDATA[2007-11-26 14:48:36]]></modified><created /><style><id /><name /></style><job_type><id>2</id><name><![CDATA[Awareness Campaign]]></name></job_type><industry><id>2</id><name><![CDATA[Education]]></name></industry></project>';
$expected = '<project><id>1</id><title/><client_id>1</client_id><show>1</show><is_spotlight /><style_id>0</style_id><job_type_id>1.89</job_type_id><industry_id>1.56</industry_id><modified /><created /><style><id /><name /></style><job_type><id>1</id><name><![CDATA[Touch Screen Kiosk]]></name></job_type><industry><id>1</id><name><![CDATA[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.2</job_type_id><industry_id>2.2</industry_id><modified><![CDATA[2007-11-26 14:48:36]]></modified><created /><style><id /><name /></style><job_type><id>2</id><name><![CDATA[Awareness Campaign]]></name></job_type><industry><id>2</id><name><![CDATA[Education]]></name></industry></project>';
$xml = new Xml($input, array('format' => 'tags'));
$result = $xml->toString(array('header' => false, 'cdata' => true));
$this->assertEqual($expected, $result);
}
/*
/*
* PHP-native Unicode support pending
*/
// function testConvertEntities() {
// $input = array('project' => '&eacute;c&icirc;t');
// $xml = new Xml($input);
//
// $result = $xml->toString(array('header' => false, 'cdata' => false, 'convertEntities' => true));
// $expected = '<project>&#233;c&#238;t</project>';
// $this->assertEqual($result, $expected);
// }
// function testConvertEntities() {
// $input = array('project' => '&eacute;c&icirc;t');
// $xml = new Xml($input);
//
// $result = $xml->toString(array('header' => false, 'cdata' => false, 'convertEntities' => true));
// $expected = '<project>&#233;c&#238;t</project>';
// $this->assertEqual($result, $expected);
// }
/**
* testWhitespace method
*
*
* @access public
* @return void
*/
@ -429,15 +429,15 @@ class XmlTest extends UnitTestCase {
'Industry' => array('id' => 2, 'name' => 'Education'),
)
);
$expected = "\n\t<project>\n\t\t<id>\n\t\t\t1\n\t\t</id>\n\t\t<title />\n\t\t<client_id>\n\t\t\t1\n\t\t</client_id>\n\t\t<show>\n\t\t\t1\n\t\t</show>\n\t\t<is_spotlight />\n\t\t<style_id>\n\t\t\t0\n\t\t</style_id>\n\t\t<job_type_id>\n\t\t\t1\n\t\t</job_type_id>\n\t\t<industry_id>\n\t\t\t1\n\t\t</industry_id>\n\t\t<modified />\n\t\t<created />\n\t\t<style>\n\t\t\t<id />\n\t\t\t<name />\n\t\t</style>\n\t\t<job_type>\n\t\t\t<id>\n\t\t\t\t1\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tTouch Screen Kiosk\n\t\t\t</name>\n\t\t</job_type>\n\t\t<industry>\n\t\t\t<id>\n\t\t\t\t1\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tFinancial\n\t\t\t</name>\n\t\t</industry>\n\t</project>\n\t<project>\n\t\t<id>\n\t\t\t2\n\t\t</id>\n\t\t<title />\n\t\t<client_id>\n\t\t\t2\n\t\t</client_id>\n\t\t<show>\n\t\t\t1\n\t\t</show>\n\t\t<is_spotlight />\n\t\t<style_id>\n\t\t\t0\n\t\t</style_id>\n\t\t<job_type_id>\n\t\t\t2\n\t\t</job_type_id>\n\t\t<industry_id>\n\t\t\t2\n\t\t</industry_id>\n\t\t<modified>\n\t\t\t2007-11-26 14:48:36\n\t\t</modified>\n\t\t<created />\n\t\t<style>\n\t\t\t<id />\n\t\t\t<name />\n\t\t</style>\n\t\t<job_type>\n\t\t\t<id>\n\t\t\t\t2\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tAwareness Campaign\n\t\t\t</name>\n\t\t</job_type>\n\t\t<industry>\n\t\t\t<id>\n\t\t\t\t2\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tEducation\n\t\t\t</name>\n\t\t</industry>\n\t</project>\n";
$expected = "\n\t<project>\n\t\t<id>\n\t\t\t1\n\t\t</id>\n\t\t<title/>\n\t\t<client_id>\n\t\t\t1\n\t\t</client_id>\n\t\t<show>\n\t\t\t1\n\t\t</show>\n\t\t<is_spotlight />\n\t\t<style_id>\n\t\t\t0\n\t\t</style_id>\n\t\t<job_type_id>\n\t\t\t1\n\t\t</job_type_id>\n\t\t<industry_id>\n\t\t\t1\n\t\t</industry_id>\n\t\t<modified />\n\t\t<created />\n\t\t<style>\n\t\t\t<id />\n\t\t\t<name />\n\t\t</style>\n\t\t<job_type>\n\t\t\t<id>\n\t\t\t\t1\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tTouch Screen Kiosk\n\t\t\t</name>\n\t\t</job_type>\n\t\t<industry>\n\t\t\t<id>\n\t\t\t\t1\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tFinancial\n\t\t\t</name>\n\t\t</industry>\n\t</project>\n\t<project>\n\t\t<id>\n\t\t\t2\n\t\t</id>\n\t\t<title />\n\t\t<client_id>\n\t\t\t2\n\t\t</client_id>\n\t\t<show>\n\t\t\t1\n\t\t</show>\n\t\t<is_spotlight />\n\t\t<style_id>\n\t\t\t0\n\t\t</style_id>\n\t\t<job_type_id>\n\t\t\t2\n\t\t</job_type_id>\n\t\t<industry_id>\n\t\t\t2\n\t\t</industry_id>\n\t\t<modified>\n\t\t\t2007-11-26 14:48:36\n\t\t</modified>\n\t\t<created />\n\t\t<style>\n\t\t\t<id />\n\t\t\t<name />\n\t\t</style>\n\t\t<job_type>\n\t\t\t<id>\n\t\t\t\t2\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tAwareness Campaign\n\t\t\t</name>\n\t\t</job_type>\n\t\t<industry>\n\t\t\t<id>\n\t\t\t\t2\n\t\t\t</id>\n\t\t\t<name>\n\t\t\t\tEducation\n\t\t\t</name>\n\t\t</industry>\n\t</project>\n";
$xml = new Xml($input, array('format' => 'tags'));
$result = $xml->toString(array('header' => false, 'cdata' => false, 'whitespace' => true));
$this->assertEqual($expected, $result);
}
/**
* testSetSerialization method
*
*
* @access public
* @return void
*/
@ -456,34 +456,54 @@ class XmlTest extends UnitTestCase {
'Industry' => array('id' => 2, 'name' => 'Education'),
)
);
$expected = '<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>';
$expected = '<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>';
$xml = new Xml(Set::map($input), array('format' => 'tags'));
$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>';
$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);
@ -493,11 +513,16 @@ class XmlTest extends UnitTestCase {
$children = $xml->children('container');
$this->assertEqual($children[0]->namespace, 'a');
$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);
@ -509,8 +534,8 @@ class XmlTest extends UnitTestCase {
$result = $xml->toString(array('cdata' => false));
$this->assertEqual($expects, $result);
}
/*
/*
* @todo Add test for default namespaces
*/

View file

@ -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();
}

View file

@ -30,8 +30,14 @@
* @subpackage cake.tests.fixtures
*/
class AdFixture extends CakeTestFixture {
/**
* name property
*
* @var string 'Ad'
* @access public
*/
var $name = 'Ad';
/**
/**
* fields property
*
* @var array
@ -45,7 +51,7 @@ class AdFixture extends CakeTestFixture {
'rght' => array('type' => 'integer'),
'name' => array('type' => 'string', 'length' => 255, 'null' => false),
);
/**
/**
* records property
*
* @var array
@ -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' ),
);
}
?>

View file

@ -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')

View file

@ -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'),

View file

@ -35,14 +35,14 @@
class AppleFixture extends CakeTestFixture {
/**
* name property
*
*
* @var string 'Apple'
* @access public
*/
var $name = 'Apple';
/**
* fields property
*
*
* @var array
* @access public
*/
@ -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'),

View file

@ -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),

View file

@ -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();
}

View file

@ -35,14 +35,14 @@
class ArosAcoTwoFixture extends CakeTestFixture {
/**
* name property
*
*
* @var string 'ArosAcoTwo'
* @access public
*/
var $name = 'ArosAcoTwo';
/**
* fields property
*
*
* @var array
* @access public
*/
@ -57,17 +57,17 @@ class ArosAcoTwoFixture extends CakeTestFixture {
);
/**
* records property
*
*
* @var array
* @access public
*/
var $records = array(
array('id' => 1, 'aro_id' => '1', 'aco_id' => '1', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
array('id' => 1, 'aro_id' => '1', 'aco_id' => '1', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
array('id' => 2, 'aro_id' => '2', 'aco_id' => '1', '_create' => '0', '_read' => '1', '_update' => '1', '_delete' => '1'),
array('id' => 3, 'aro_id' => '3', 'aco_id' => '2', '_create' => '0', '_read' => '1', '_update' => '0', '_delete' => '0'),
array('id' => 4, 'aro_id' => '4', 'aco_id' => '2', '_create' => '1', '_read' => '1', '_update' => '0', '_delete' => '-1'),
array('id' => 5, 'aro_id' => '4', 'aco_id' => '6', '_create' => '1', '_read' => '1', '_update' => '0', '_delete' => '0'),
array('id' => 6, 'aro_id' => '5', 'aco_id' => '1', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
array('id' => 5, 'aro_id' => '4', 'aco_id' => '6', '_create' => '1', '_read' => '1', '_update' => '0', '_delete' => '0'),
array('id' => 6, 'aro_id' => '5', 'aco_id' => '1', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
array('id' => 7, 'aro_id' => '6', 'aco_id' => '3', '_create' => '-1', '_read' => '1', '_update' => '-1', '_delete' => '-1'),
array('id' => 8, 'aro_id' => '6', 'aco_id' => '4', '_create' => '-1', '_read' => '1', '_update' => '-1', '_delete' => '1'),
array('id' => 9, 'aro_id' => '6', 'aco_id' => '6', '_create' => '-1', '_read' => '1', '_update' => '1', '_delete' => '-1'),
@ -75,13 +75,13 @@ class ArosAcoTwoFixture extends CakeTestFixture {
array('id' => 11, 'aro_id' => '7', 'aco_id' => '7', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '0'),
array('id' => 12, 'aro_id' => '7', 'aco_id' => '8', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '0'),
array('id' => 13, 'aro_id' => '7', 'aco_id' => '9', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
array('id' => 14, 'aro_id' => '7', 'aco_id' => '10', '_create' => '0', '_read' => '0', '_update' => '0', '_delete' => '1'),
array('id' => 14, 'aro_id' => '7', 'aco_id' => '10', '_create' => '0', '_read' => '0', '_update' => '0', '_delete' => '1'),
array('id' => 15, 'aro_id' => '8', 'aco_id' => '10', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
array('id' => 16, 'aro_id' => '8', 'aco_id' => '2', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
array('id' => 16, 'aro_id' => '8', 'aco_id' => '2', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
array('id' => 17, 'aro_id' => '9', 'aco_id' => '4', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '-1'),
array('id' => 18, 'aro_id' => '9', 'aco_id' => '9', '_create' => '0', '_read' => '0', '_update' => '1', '_delete' => '1'),
array('id' => 18, 'aro_id' => '9', 'aco_id' => '9', '_create' => '0', '_read' => '0', '_update' => '1', '_delete' => '1'),
array('id' => 19, 'aro_id' => '10', 'aco_id' => '9', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
array('id' => 20, 'aro_id' => '10', 'aco_id' => '10', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
array('id' => 20, 'aro_id' => '10', 'aco_id' => '10', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
);
}

View file

@ -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'),

View file

@ -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'),

View file

@ -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),

View file

@ -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')
);

View file

@ -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'),

View file

@ -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'),

View file

@ -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'),

View file

@ -35,14 +35,14 @@
class CallbackFixture extends CakeTestFixture {
/**
* name property
*
*
* @var string 'Callback'
* @access public
*/
var $name = 'Callback';
/**
* fields property
*
*
* @var array
* @access public
*/
@ -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'),

View file

@ -30,8 +30,14 @@
* @subpackage cake.tests.fixtures
*/
class CampaignFixture extends CakeTestFixture {
/**
* name property
*
* @var string 'Campaign'
* @access public
*/
var $name = 'Campaign';
/**
/**
* fields property
*
* @var array
@ -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' ),

View file

@ -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'),

View file

@ -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'),

View file

@ -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'),

View file

@ -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();
}

View file

@ -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),
);

View file

@ -20,7 +20,7 @@
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake.tests
* @subpackage cake.tests.fixtures
* @since CakePHP(tm) v 1.2.0.6879 //Correct version number as needed**
* @since CakePHP(tm) v 1.2.0.6879//Correct version number as needed**
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
@ -33,19 +33,19 @@
*
* @package cake.tests
* @subpackage cake.tests.fixtures
* @since CakePHP(tm) v 1.2.0.6879 //Correct version number as needed**
* @since CakePHP(tm) v 1.2.0.6879//Correct version number as needed**
*/
class DependencyFixture extends CakeTestFixture {
/**
* name property
*
*
* @var string 'Dependency'
* @access public
*/
var $name = 'Dependency';
/**
* fields property
*
*
* @var array
* @access public
*/
@ -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),
);

View file

@ -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),

View file

@ -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')
);

View file

@ -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)
);

View file

@ -35,14 +35,14 @@
class DocumentDirectoryFixture extends CakeTestFixture {
/**
* name property
*
*
* @var string 'DocumentDirectory'
* @access public
*/
var $name = 'DocumentDirectory';
/**
* fields property
*
*
* @var array
* @access public
*/
@ -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')
);

View file

@ -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')
);

View file

@ -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')
);

View file

@ -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')
);

View file

@ -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'),

View file

@ -35,14 +35,14 @@
class HomeFixture extends CakeTestFixture {
/**
* name property
*
*
* @var string 'Home'
* @access public
*/
var $name = 'Home';
/**
* fields property
*
*
* @var array
* @access public
*/
@ -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')

View file

@ -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'),

View file

@ -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'),

View file

@ -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),

View file

@ -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'),

View file

@ -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'),

Some files were not shown because too many files have changed in this diff Show more