mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Reformatting and adding missing documentation blocks.
This commit is contained in:
parent
2ea6047c80
commit
5092262d4d
15 changed files with 591 additions and 183 deletions
|
@ -83,8 +83,8 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
/**
|
||||
* _initEnvironment method
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @access protected
|
||||
*/
|
||||
function _initEnvironment() {
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
/**
|
||||
* stderr method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function stderr($string) {
|
||||
$this->stderr .= rtrim($string, ' ');
|
||||
|
@ -102,8 +102,8 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
/**
|
||||
* stdout method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function stdout($string, $newline = true) {
|
||||
if ($newline) {
|
||||
|
@ -116,8 +116,8 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
/**
|
||||
* clear method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function clear() {
|
||||
|
||||
|
@ -126,8 +126,8 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
/**
|
||||
* _stop method
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @access protected
|
||||
*/
|
||||
function _stop($status = 0) {
|
||||
$this->stopped = 'Stopped with status: ' . $status;
|
||||
|
@ -138,8 +138,8 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
* getShell
|
||||
*
|
||||
* @param mixed $plugin
|
||||
* @access public
|
||||
* @return mixed
|
||||
* @access public
|
||||
*/
|
||||
function getShell($plugin = null) {
|
||||
return $this->_getShell($plugin);
|
||||
|
@ -149,8 +149,8 @@ class TestShellDispatcher extends ShellDispatcher {
|
|||
* _getShell
|
||||
*
|
||||
* @param mixed $plugin
|
||||
* @access protected
|
||||
* @return mixed
|
||||
* @access protected
|
||||
*/
|
||||
function _getShell($plugin = null) {
|
||||
if (isset($this->TestShell)) {
|
||||
|
@ -171,8 +171,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function setUp() {
|
||||
App::build(array(
|
||||
|
@ -189,8 +189,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function tearDown() {
|
||||
App::build();
|
||||
|
@ -199,8 +199,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* testParseParams method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testParseParams() {
|
||||
$Dispatcher =& new TestShellDispatcher();
|
||||
|
@ -458,8 +458,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* testBuildPaths method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testBuildPaths() {
|
||||
$Dispatcher =& new TestShellDispatcher();
|
||||
|
@ -481,8 +481,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* Verify loading of (plugin-) shells
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testGetShell() {
|
||||
$this->skipIf(class_exists('SampleShell'), '%s SampleShell Class already loaded');
|
||||
|
@ -510,8 +510,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* Verify correct dispatch of Shell subclasses with a main method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testDispatchShellWithMain() {
|
||||
Mock::generate('Shell', 'MockWithMainShell', array('main', '_secret'));
|
||||
|
@ -601,8 +601,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* Verify correct dispatch of Shell subclasses without a main method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testDispatchShellWithoutMain() {
|
||||
Mock::generate('Shell', 'MockWithoutMainShell', array('initDb', '_secret'));
|
||||
|
@ -673,8 +673,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* Verify correct dispatch of custom classes with a main method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testDispatchNotAShellWithMain() {
|
||||
Mock::generate('Object', 'MockWithMainNotAShell',
|
||||
|
@ -753,8 +753,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* Verify correct dispatch of custom classes without a main method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testDispatchNotAShellWithoutMain() {
|
||||
Mock::generate('Object', 'MockWithoutMainNotAShell',
|
||||
|
@ -824,8 +824,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
* Verify that a task is called instead of the shell if the first arg equals
|
||||
* the name of the task
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testDispatchTask() {
|
||||
Mock::generate('Shell', 'MockWeekShell', array('main'));
|
||||
|
@ -872,8 +872,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* Verify shifting of arguments
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testShiftArgs() {
|
||||
$Dispatcher =& new TestShellDispatcher();
|
||||
|
@ -902,8 +902,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
/**
|
||||
* testHelpCommand method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testHelpCommand() {
|
||||
$Dispatcher =& new TestShellDispatcher();
|
||||
|
|
|
@ -52,13 +52,21 @@ Mock::generate('AclComponent', 'MockAclShellAclComponent');
|
|||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class AclShellTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.aco', 'core.aro', 'core.aros_aco');
|
||||
|
||||
/**
|
||||
* configure Configure for testcase
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function startCase() {
|
||||
$this->_aclDb = Configure::read('Acl.database');
|
||||
$this->_aclClass = Configure::read('Acl.classname');
|
||||
|
@ -71,7 +79,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* restore Environment settings
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function endCase() {
|
||||
Configure::write('Acl.database', $this->_aclDb);
|
||||
Configure::write('Acl.classname', $this->_aclClass);
|
||||
|
@ -107,7 +116,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test that model.foreign_key output works when looking at acl rows
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testViewWithModelForeignKeyOutput() {
|
||||
$this->Task->command = 'view';
|
||||
$this->Task->startup();
|
||||
|
@ -132,7 +142,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test view with an argument
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testViewWithArgument() {
|
||||
$this->Task->args = array('aro', 'admins');
|
||||
$this->Task->expectAt(0, 'out', array('Aro tree:'));
|
||||
|
@ -146,7 +157,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test the method that splits model.foreign key. and that it returns an array.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testParsingModelAndForeignKey() {
|
||||
$result = $this->Task->parseIdentifier('Model.foreignKey');
|
||||
$expected = array('model' => 'Model', 'foreign_key' => 'foreignKey');
|
||||
|
@ -162,7 +174,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test creating aro/aco nodes
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testCreate() {
|
||||
$this->Task->args = array('aro', 'root', 'User.1');
|
||||
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/created/'), '*'));
|
||||
|
@ -202,7 +215,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test the delete method with different node types.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testDelete() {
|
||||
$this->Task->args = array('aro', 'AuthUser.1');
|
||||
$this->Task->expectAt(0, 'out', array(new NoPatternExpectation('/not/'), true));
|
||||
|
@ -217,7 +231,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test setParent method.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testSetParent() {
|
||||
$this->Task->args = array('aro', 'AuthUser.2', 'root');
|
||||
$this->Task->setParent();
|
||||
|
@ -231,7 +246,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test grant
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGrant() {
|
||||
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
|
||||
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true));
|
||||
|
@ -246,7 +262,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test deny
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testDeny() {
|
||||
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
|
||||
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission denied/'), true));
|
||||
|
@ -261,7 +278,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test checking allowed and denied perms
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testCheck() {
|
||||
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', '*');
|
||||
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/not allowed/'), true));
|
||||
|
@ -284,7 +302,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test inherit and that it 0's the permission fields.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testInherit() {
|
||||
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
|
||||
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true));
|
||||
|
@ -303,7 +322,8 @@ class AclShellTest extends CakeTestCase {
|
|||
* test getting the path for an aro/aco
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetPath() {
|
||||
$this->Task->args = array('aro', 'AuthUser.2');
|
||||
$this->Task->expectAt(1, 'out', array('[1] ROOT'));
|
||||
|
@ -311,6 +331,5 @@ class AclShellTest extends CakeTestCase {
|
|||
$this->Task->expectAt(3, 'out', array(' [4] Elrond'));
|
||||
$this->Task->getPath();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -76,8 +76,8 @@ class ApiShellTest extends CakeTestCase {
|
|||
/**
|
||||
* Test that method names are detected properly including those with no arguments.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testMethodNameDetection () {
|
||||
$this->Shell->setReturnValueAt(0, 'in', 'q');
|
||||
|
|
|
@ -61,14 +61,16 @@ class BakeShellTestCase extends CakeTestCase {
|
|||
* fixtures
|
||||
*
|
||||
* @var array
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.user');
|
||||
|
||||
/**
|
||||
* start test
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function startTest() {
|
||||
$this->Dispatch =& new BakeShellMockShellDispatcher();
|
||||
$this->Shell =& new MockBakeShell();
|
||||
|
@ -80,7 +82,8 @@ class BakeShellTestCase extends CakeTestCase {
|
|||
* endTest method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function endTest() {
|
||||
unset($this->Dispatch, $this->Shell);
|
||||
}
|
||||
|
@ -89,7 +92,8 @@ class BakeShellTestCase extends CakeTestCase {
|
|||
* test bake all
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testAllWithModelName() {
|
||||
$this->Shell->Model =& new BakeShellMockModelTask();
|
||||
$this->Shell->Controller =& new BakeShellMockControllerTask();
|
||||
|
@ -118,4 +122,5 @@ class BakeShellTestCase extends CakeTestCase {
|
|||
$this->Shell->args = array('User');
|
||||
$this->Shell->all();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -115,7 +115,14 @@ class SchemaShellTestSchema extends CakeSchema {
|
|||
*/
|
||||
class SchemaShellTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.article', 'core.user', 'core.post', 'core.auth_user');
|
||||
|
||||
/**
|
||||
* startTest method
|
||||
*
|
||||
|
@ -142,7 +149,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test startup method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testStartup() {
|
||||
$this->Shell->startup();
|
||||
$this->assertTrue(isset($this->Shell->Schema));
|
||||
|
@ -177,7 +185,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* Test View - and that it dumps the schema file to stdout
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testView() {
|
||||
$this->Shell->startup();
|
||||
$this->Shell->Schema->path = APP . 'config' . DS . 'schema';
|
||||
|
@ -191,7 +200,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test that view() can find plugin schema files.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testViewWithPlugins() {
|
||||
App::build(array(
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
|
@ -214,7 +224,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test dump() with sql file generation
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testDumpWithFileWriting() {
|
||||
$this->Shell->params = array(
|
||||
'name' => 'i18n',
|
||||
|
@ -242,7 +253,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test that dump() can find and work with plugin schema files.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testDumpFileWritingWithPlugins() {
|
||||
App::build(array(
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
|
@ -271,6 +283,7 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test generate with snapshot generation
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testGenerateSnaphot() {
|
||||
$this->Shell->path = TMP;
|
||||
|
@ -290,7 +303,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test generate without a snapshot.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGenerateNoOverwrite() {
|
||||
touch(TMP . 'schema.php');
|
||||
$this->Shell->params['file'] = 'schema.php';
|
||||
|
@ -309,7 +323,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test generate with overwriting of the schema files.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGenerateOverwrite() {
|
||||
touch(TMP . 'schema.php');
|
||||
$this->Shell->params['file'] = 'schema.php';
|
||||
|
@ -334,7 +349,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* in a plugin.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGenerateWithPlugins() {
|
||||
App::build(array(
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
|
@ -363,7 +379,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* Test schema run create with no table args.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testCreateNoArgs() {
|
||||
$this->Shell->params = array(
|
||||
'connection' => 'test_suite',
|
||||
|
@ -386,7 +403,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* Test schema run create with no table args.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testCreateWithTableArgs() {
|
||||
$this->Shell->params = array(
|
||||
'connection' => 'test_suite',
|
||||
|
@ -411,7 +429,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test run update with a table arg.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testUpdateWithTable() {
|
||||
$this->Shell->params = array(
|
||||
'connection' => 'test_suite',
|
||||
|
@ -434,7 +453,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test that the plugin param creates the correct path in the schema object.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testPluginParam() {
|
||||
App::build(array(
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
|
@ -454,7 +474,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
* test that using Plugin.name with write.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testPluginDotSyntaxWithCreate() {
|
||||
App::build(array(
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
|
|
|
@ -46,7 +46,7 @@ Mock::generatePartial('ShellDispatcher', 'TestShellMockShellDispatcher', array(
|
|||
*/
|
||||
class TestShell extends Shell {
|
||||
|
||||
/*
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var name
|
||||
|
@ -257,8 +257,8 @@ class ShellTest extends CakeTestCase {
|
|||
/**
|
||||
* testNl
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testNl() {
|
||||
$this->assertEqual($this->Shell->nl(), "\n");
|
||||
|
@ -271,8 +271,8 @@ class ShellTest extends CakeTestCase {
|
|||
/**
|
||||
* testHr
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testHr() {
|
||||
$bar = '---------------------------------------------------------------';
|
||||
|
@ -296,8 +296,8 @@ class ShellTest extends CakeTestCase {
|
|||
/**
|
||||
* testError
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testError() {
|
||||
$this->Shell->Dispatch->expectAt(0, 'stderr', array("Error: Foo Not Found\n"));
|
||||
|
|
|
@ -88,7 +88,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* fixtures
|
||||
*
|
||||
* @var array
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
||||
|
||||
/**
|
||||
|
@ -124,7 +125,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test ListAll
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testListAll() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->interactive = true;
|
||||
|
@ -153,7 +155,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* Test that getName interacts with the user and returns the controller name.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetName() {
|
||||
$this->Task->setReturnValue('in', 1);
|
||||
|
||||
|
@ -180,7 +183,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test helper interactions
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testDoHelpers() {
|
||||
$this->Task->setReturnValue('in', 'n');
|
||||
$result = $this->Task->doHelpers();
|
||||
|
@ -203,7 +207,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test component interactions
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testDoComponents() {
|
||||
$this->Task->setReturnValue('in', 'n');
|
||||
$result = $this->Task->doComponents();
|
||||
|
@ -226,7 +231,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test Confirming controller user interaction
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testConfirmController() {
|
||||
$controller = 'Posts';
|
||||
$scaffold = false;
|
||||
|
@ -244,7 +250,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test the bake method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBake() {
|
||||
$helpers = array('Ajax', 'Time');
|
||||
$components = array('Acl', 'Auth');
|
||||
|
@ -267,7 +274,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test bake() with a -plugin param
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeWithPlugin() {
|
||||
$this->Task->plugin = 'ControllerTest';
|
||||
$helpers = array('Ajax', 'Time');
|
||||
|
@ -289,7 +297,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test that bakeActions is creating the correct controller Code. (Using sessions)
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeActionsUsingSessions() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Testing bakeActions requires Article, Comment & Tag Model to be undefined. %s');
|
||||
|
@ -332,7 +341,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* Test baking with Controller::flash() or no sessions.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeActionsWithNoSessions() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Testing bakeActions requires Article, Tag, Comment Models to be undefined. %s');
|
||||
|
@ -367,7 +377,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test baking a test
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeTest() {
|
||||
$this->Task->plugin = 'ControllerTest';
|
||||
$this->Task->connection = 'test_suite';
|
||||
|
@ -383,7 +394,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test Interactive mode.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testInteractive() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path';
|
||||
|
@ -407,7 +419,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test that execute runs all when the first arg == all
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteIntoAll() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute into all could not be run as an Article, Tag or Comment model was already loaded. %s');
|
||||
|
@ -432,7 +445,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test that `cake bake controller foos` works.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithController() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
|
@ -455,7 +469,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test that `cake bake controller foo scaffold` works.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithPublicParam() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
|
@ -478,7 +493,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test that `cake bake controller foos both` works.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithControllerAndBoth() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
|
@ -502,7 +518,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* test that `cake bake controller foos admin` works.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithControllerAndAdmin() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
|
|
|
@ -104,7 +104,8 @@ class DbConfigTaskTest extends CakeTestCase {
|
|||
* Test the getConfig method.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetConfig() {
|
||||
$this->Task->setReturnValueAt(0, 'in', 'otherOne');
|
||||
$result = $this->Task->getConfig();
|
||||
|
@ -115,7 +116,8 @@ class DbConfigTaskTest extends CakeTestCase {
|
|||
* test that initialize sets the path up.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testInitialize() {
|
||||
$this->assertTrue(empty($this->Task->path));
|
||||
$this->Task->initialize();
|
||||
|
@ -128,7 +130,8 @@ class DbConfigTaskTest extends CakeTestCase {
|
|||
* test execute and by extension __interactive
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteIntoInteractive() {
|
||||
$this->Task->initialize();
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* fixtures
|
||||
*
|
||||
* @var array
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.article', 'core.comment', 'core.datatype', 'core.binary_test');
|
||||
|
||||
/**
|
||||
|
@ -94,7 +95,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test that initialize sets the path
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testConstruct() {
|
||||
$this->Dispatch->params['working'] = DS . 'my' . DS . 'path';
|
||||
$Task =& new FixtureTask($this->Dispatch);
|
||||
|
@ -107,7 +109,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test import option array generation
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testImportOptions() {
|
||||
$this->Task->setReturnValueAt(0, 'in', 'y');
|
||||
$this->Task->setReturnValueAt(1, 'in', 'y');
|
||||
|
@ -136,7 +139,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test generating a fixture with database conditions.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testImportRecordsFromDatabaseWithConditions() {
|
||||
$this->Task->setReturnValueAt(0, 'in', 'WHERE 1=1 LIMIT 10');
|
||||
$this->Task->connection = 'test_suite';
|
||||
|
@ -155,7 +159,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test that execute passes runs bake depending with named model.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithNamedModel() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -169,7 +174,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test that execute runs all() when args[0] = all
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteIntoAll() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -189,7 +195,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test using all() with -count and -records
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testAllWithCountAndRecordsFlags() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -210,7 +217,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test interactive mode of execute
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteInteractive() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -228,7 +236,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* Test that bake works
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBake() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -263,7 +272,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test record generation with float and binary types
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testRecordGenerationForBinaryAndFloat() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -279,7 +289,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* Test that file generation includes headers and correct path for plugins.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGenerateFixtureFile() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -296,7 +307,8 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
* test generating files into plugins.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGeneratePluginFixtureFile() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
|
|
@ -65,7 +65,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* fixtures
|
||||
*
|
||||
* @var array
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag', 'core.category_thread');
|
||||
|
||||
/**
|
||||
|
@ -99,7 +100,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* Test that listAll scans the database connection and lists all the tables in it.s
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testListAll() {
|
||||
$this->Task->expectAt(1, 'out', array('1. Article'));
|
||||
$this->Task->expectAt(2, 'out', array('2. ArticlesTag'));
|
||||
|
@ -126,7 +128,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* Test that getName interacts with the user and returns the model name.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetName() {
|
||||
$this->Task->setReturnValue('in', 1);
|
||||
|
||||
|
@ -153,7 +156,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* Test table name interactions
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetTableName() {
|
||||
$this->Task->setReturnValueAt(0, 'in', 'y');
|
||||
$result = $this->Task->getTable('Article', 'test_suite');
|
||||
|
@ -171,7 +175,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test that initializing the validations works.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testInitValidations() {
|
||||
$result = $this->Task->initValidations();
|
||||
$this->assertTrue(in_array('notempty', $result));
|
||||
|
@ -182,7 +187,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* tests the guessing features of validation
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testFieldValidationGuessing() {
|
||||
$this->Task->interactive = false;
|
||||
$this->Task->initValidations();
|
||||
|
@ -210,7 +216,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test that interactive field validation works and returns multiple validators.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testInteractiveFieldValidation() {
|
||||
$this->Task->initValidations();
|
||||
$this->Task->interactive = true;
|
||||
|
@ -228,7 +235,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test the validation Generation routine
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testNonInteractiveDoValidation() {
|
||||
$Model =& new MockModelTaskModel();
|
||||
$Model->primaryKey = 'id';
|
||||
|
@ -289,7 +297,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test that finding primary key works
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testFindPrimaryKey() {
|
||||
$fields = array(
|
||||
'one' => array(),
|
||||
|
@ -307,7 +316,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test finding Display field
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testFindDisplayField() {
|
||||
$fields = array('id' => array(), 'tagname' => array(), 'body' => array(),
|
||||
'created' => array(), 'modified' => array());
|
||||
|
@ -327,7 +337,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test that belongsTo generation works.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBelongsToGeneration() {
|
||||
$model = new Model(array('ds' => 'test_suite', 'name' => 'Comment'));
|
||||
$result = $this->Task->findBelongsTo($model, array());
|
||||
|
@ -347,7 +358,6 @@ class ModelTaskTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread'));
|
||||
$result = $this->Task->findBelongsTo($model, array());
|
||||
$expected = array(
|
||||
|
@ -366,7 +376,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test that hasOne and/or hasMany relations are generated properly.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testHasManyHasOneGeneration() {
|
||||
$model = new Model(array('ds' => 'test_suite', 'name' => 'Article'));
|
||||
$this->Task->connection = 'test_suite';
|
||||
|
@ -390,7 +401,6 @@ class ModelTaskTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread'));
|
||||
$result = $this->Task->findHasOneAndMany($model, array());
|
||||
$expected = array(
|
||||
|
@ -413,10 +423,11 @@ class ModelTaskTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* test that habtm generation works
|
||||
* Test that HABTM generation works
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testHasAndBelongsToManyGeneration() {
|
||||
$model = new Model(array('ds' => 'test_suite', 'name' => 'Article'));
|
||||
$this->Task->connection = 'test_suite';
|
||||
|
@ -440,7 +451,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test non interactive doAssociations
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testDoAssociationsNonInteractive() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->interactive = false;
|
||||
|
@ -464,14 +476,14 @@ class ModelTaskTest extends CakeTestCase {
|
|||
),
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the fixutre object is correctly called.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeFixture() {
|
||||
$this->Task->Fixture->expectAt(0, 'bake', array('Article', 'articles'));
|
||||
$this->Task->bakeFixture('Article', 'articles');
|
||||
|
@ -484,7 +496,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* Ensure that the test object is correctly called.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeTest() {
|
||||
$this->Task->Test->expectAt(0, 'bake', array('Model', 'Article'));
|
||||
$this->Task->bakeTest('Article');
|
||||
|
@ -498,7 +511,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* a question for the hasOne is also not asked.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testConfirmAssociations() {
|
||||
$associations = array(
|
||||
'hasOne' => array(
|
||||
|
@ -538,7 +552,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test that inOptions generates questions and only accepts a valid answer
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testInOptions() {
|
||||
$options = array('one', 'two', 'three');
|
||||
$this->Task->expectAt(0, 'out', array('1. one'));
|
||||
|
@ -558,7 +573,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test baking validation
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeValidation() {
|
||||
$validate = array(
|
||||
'name' => array(
|
||||
|
@ -586,7 +602,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test baking relations
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeRelations() {
|
||||
$associations = array(
|
||||
'belongsTo' => array(
|
||||
|
@ -640,7 +657,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test bake() with a -plugin param
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeWithPlugin() {
|
||||
$this->Task->plugin = 'ControllerTest';
|
||||
|
||||
|
@ -660,7 +678,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test that execute passes runs bake depending with named model.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithNamedModel() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -675,7 +694,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test that execute runs all() when args[0] = all
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteIntoAll() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -707,7 +727,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test the interactive side of bake.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteIntoInteractive() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
@ -736,7 +757,8 @@ class ModelTaskTest extends CakeTestCase {
|
|||
* test using bake interactively with a table that does not exist.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithNonExistantTableName() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
|
|
|
@ -72,7 +72,8 @@ class PluginTaskTest extends CakeTestCase {
|
|||
* startCase methods
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function startCase() {
|
||||
$this->_paths = $paths = App::path('plugins');
|
||||
$this->_testPath = array_push($paths, TMP . 'tests' . DS);
|
||||
|
@ -83,7 +84,8 @@ class PluginTaskTest extends CakeTestCase {
|
|||
* endCase
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function endCase() {
|
||||
App::build(array('plugins' => $this->_paths));
|
||||
}
|
||||
|
@ -102,7 +104,8 @@ class PluginTaskTest extends CakeTestCase {
|
|||
* test bake()
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeFoldersAndFiles() {
|
||||
$this->Task->setReturnValueAt(0, 'in', $this->_testPath);
|
||||
$this->Task->setReturnValueAt(1, 'in', 'y');
|
||||
|
@ -196,7 +199,8 @@ class PluginTaskTest extends CakeTestCase {
|
|||
* test execute with no args, flowing into interactive,
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithNoArgs() {
|
||||
$this->Task->setReturnValueAt(0, 'in', 'TestPlugin');
|
||||
$this->Task->setReturnValueAt(1, 'in', '3');
|
||||
|
@ -221,7 +225,8 @@ class PluginTaskTest extends CakeTestCase {
|
|||
* Test Execute
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithOneArg() {
|
||||
$this->Task->setReturnValueAt(0, 'in', $this->_testPath);
|
||||
$this->Task->setReturnValueAt(1, 'in', 'y');
|
||||
|
@ -245,7 +250,8 @@ class PluginTaskTest extends CakeTestCase {
|
|||
* test execute chaining into MVC parts
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithTwoArgs() {
|
||||
$this->Task->Model =& new PluginTestMockModelTask();
|
||||
$this->Task->setReturnValueAt(0, 'in', $this->_testPath);
|
||||
|
|
|
@ -84,7 +84,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* creates a test project that is used for testing project task.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access protected
|
||||
*/
|
||||
function _setupTestProject() {
|
||||
$skel = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS . 'skel';
|
||||
$this->Task->setReturnValueAt(0, 'in', 'y');
|
||||
|
@ -96,7 +97,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* test bake() method and directory creation.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBake() {
|
||||
$this->_setupTestProject();
|
||||
|
||||
|
@ -117,7 +119,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* test generation of Security.salt
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testSecuritySaltGeneration() {
|
||||
$this->_setupTestProject();
|
||||
|
||||
|
@ -134,7 +137,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* Test that index.php is generated correctly.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testIndexPhpGeneration() {
|
||||
$this->_setupTestProject();
|
||||
|
||||
|
@ -154,7 +158,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* test getPrefix method, and that it returns Routing.prefix or writes to config file.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetPrefix() {
|
||||
Configure::write('Routing.prefixes', array('admin'));
|
||||
$result = $this->Task->getPrefix();
|
||||
|
@ -176,7 +181,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* test cakeAdmin() writing core.php
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testCakeAdmin() {
|
||||
$file =& new File(CONFIGS . 'core.php');
|
||||
$contents = $file->read();;
|
||||
|
@ -196,7 +202,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* test getting the prefix with more than one prefix setup
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetPrefixWithMultiplePrefixes() {
|
||||
Configure::write('Routing.prefixes', array('admin', 'ninja', 'shinobi'));
|
||||
$this->_setupTestProject();
|
||||
|
@ -211,7 +218,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* Test execute method with one param to destination folder.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecute() {
|
||||
$this->Task->params['skel'] = CAKE_CORE_INCLUDE_PATH . DS . CAKE . DS . 'console' . DS. 'templates' . DS . 'skel';
|
||||
$this->Task->params['working'] = TMP . 'tests' . DS;
|
||||
|
|
|
@ -81,7 +81,8 @@ class TemplateTaskTest extends CakeTestCase {
|
|||
* test that set sets variables
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testSet() {
|
||||
$this->Task->set('one', 'two');
|
||||
$this->assertTrue(isset($this->Task->templateVars['one']));
|
||||
|
@ -98,7 +99,8 @@ class TemplateTaskTest extends CakeTestCase {
|
|||
* test finding themes installed in
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testFindingInstalledThemesForBake() {
|
||||
$consoleLibs = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS;
|
||||
$this->Task->Dispatch->shellPaths = array($consoleLibs);
|
||||
|
@ -111,7 +113,8 @@ class TemplateTaskTest extends CakeTestCase {
|
|||
* that the user is not bugged. If there are more, find and return the correct theme name
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetThemePath() {
|
||||
$defaultTheme = CAKE_CORE_INCLUDE_PATH . DS . dirname(CONSOLE_LIBS) . 'templates' . DS . 'default' .DS;
|
||||
$this->Task->templatePaths = array('default' => $defaultTheme);
|
||||
|
@ -136,7 +139,8 @@ class TemplateTaskTest extends CakeTestCase {
|
|||
* test generate
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGenerate() {
|
||||
App::build(array(
|
||||
'shells' => array(
|
||||
|
@ -155,7 +159,8 @@ class TemplateTaskTest extends CakeTestCase {
|
|||
* ensure fallback to default works.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGenerateWithTemplateFallbacks() {
|
||||
App::build(array(
|
||||
'shells' => array(
|
||||
|
|
|
@ -49,17 +49,48 @@ Mock::generatePartial(
|
|||
);
|
||||
|
||||
/**
|
||||
* Test subject models for fixture generation
|
||||
**/
|
||||
* Test Article model
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class TestTaskArticle extends Model {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'TestTaskArticle';
|
||||
|
||||
/**
|
||||
* Table name to use
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'articles';
|
||||
|
||||
/**
|
||||
* HasMany Associations
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $hasMany = array(
|
||||
'Comment' => array(
|
||||
'className' => 'TestTask.TestTaskComment',
|
||||
'foreignKey' => 'article_id',
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Has and Belongs To Many Associations
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $hasAndBelongsToMany = array(
|
||||
'Tag' => array(
|
||||
'className' => 'TestTaskTag',
|
||||
|
@ -68,19 +99,65 @@ class TestTaskArticle extends Model {
|
|||
'associationForeignKey' => 'tag_id'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Example public method
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function doSomething() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Example Secondary public method
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function doSomethingElse() {
|
||||
|
||||
}
|
||||
function _innerMethod() {
|
||||
|
||||
/**
|
||||
* Example protected method
|
||||
*
|
||||
* @return void
|
||||
* @access protected
|
||||
*/
|
||||
function _innerMethod() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag Testing Model
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class TestTaskTag extends Model {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'TestTaskTag';
|
||||
|
||||
/**
|
||||
* Table name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'tags';
|
||||
|
||||
/**
|
||||
* Has and Belongs To Many Associations
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $hasAndBelongsToMany = array(
|
||||
'Article' => array(
|
||||
'className' => 'TestTaskArticle',
|
||||
|
@ -92,14 +169,44 @@ class TestTaskTag extends Model {
|
|||
}
|
||||
|
||||
/**
|
||||
* Simulated Plugin
|
||||
**/
|
||||
* Simulated plugin
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class TestTaskAppModel extends Model {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing AppMode (TaskComment)
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class TestTaskComment extends TestTaskAppModel {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'TestTaskComment';
|
||||
|
||||
/**
|
||||
* Table name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'comments';
|
||||
|
||||
/**
|
||||
* Belongs To Associations
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $belongsTo = array(
|
||||
'Article' => array(
|
||||
'className' => 'TestTaskArticle',
|
||||
|
@ -108,8 +215,28 @@ class TestTaskComment extends TestTaskAppModel {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Task Comments Controller
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class TestTaskCommentsController extends Controller {
|
||||
|
||||
/**
|
||||
* Controller Name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'TestTaskComments';
|
||||
|
||||
/**
|
||||
* Models to use
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $uses = array('TestTaskComment', 'TestTaskTag');
|
||||
}
|
||||
|
||||
|
@ -121,6 +248,12 @@ class TestTaskCommentsController extends Controller {
|
|||
*/
|
||||
class TestTaskTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
||||
|
||||
/**
|
||||
|
@ -150,8 +283,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
/**
|
||||
* Test that file path generation doesn't continuously append paths.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testFilePathGeneration() {
|
||||
$file = TESTS . 'cases' . DS . 'models' . DS . 'my_class.test.php';
|
||||
|
@ -176,7 +309,7 @@ class TestTaskTest extends CakeTestCase {
|
|||
* methods into the test case.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
*/
|
||||
function testMethodIntrospection() {
|
||||
$result = $this->Task->getTestableMethods('TestTaskArticle');
|
||||
$expected = array('dosomething', 'dosomethingelse');
|
||||
|
@ -187,7 +320,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test that the generation of fixtures works correctly.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testFixtureArrayGenerationFromModel() {
|
||||
$subject = ClassRegistry::init('TestTaskArticle');
|
||||
$result = $this->Task->generateFixtureList($subject);
|
||||
|
@ -201,7 +335,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test that the generation of fixtures works correctly.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testFixtureArrayGenerationFromController() {
|
||||
$subject = new TestTaskCommentsController();
|
||||
$result = $this->Task->generateFixtureList($subject);
|
||||
|
@ -215,7 +350,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test user interaction to get object type
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetObjectType() {
|
||||
$this->Task->expectOnce('_stop');
|
||||
$this->Task->setReturnValueAt(0, 'in', 'q');
|
||||
|
@ -230,7 +366,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* creating test subjects should clear the registry so the registry is always fresh
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testRegistryClearWhenBuildingTestObjects() {
|
||||
ClassRegistry::flush();
|
||||
$model = ClassRegistry::init('TestTaskComment');
|
||||
|
@ -254,7 +391,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test that getClassName returns the user choice as a classname.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetClassName() {
|
||||
$objects = App::objects('model');
|
||||
$skip = $this->skipIf(empty($objects), 'No models in app, this test will fail. %s');
|
||||
|
@ -275,7 +413,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* Test the user interaction for defining additional fixtures.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetUserFixtures() {
|
||||
$this->Task->setReturnValueAt(0, 'in', 'y');
|
||||
$this->Task->setReturnValueAt(1, 'in', 'app.pizza, app.topping, app.side_dish');
|
||||
|
@ -288,7 +427,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test that resolving classnames works
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetRealClassname() {
|
||||
$result = $this->Task->getRealClassname('Model', 'Post');
|
||||
$this->assertEqual($result, 'Post');
|
||||
|
@ -311,7 +451,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* as PHP4 classnames are all lower case, breaking the plugin path inflection.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeModelTest() {
|
||||
$this->Task->setReturnValue('createFile', true);
|
||||
$this->Task->setReturnValue('isLoadableClass', true);
|
||||
|
@ -344,7 +485,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* causing issues with inflection of path name from classname.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeControllerTest() {
|
||||
$this->Task->setReturnValue('createFile', true);
|
||||
$this->Task->setReturnValue('isLoadableClass', true);
|
||||
|
@ -377,7 +519,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test Constructor generation ensure that constructClasses is called for controllers
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGenerateContsructor() {
|
||||
$result = $this->Task->generateConstructor('controller', 'PostsController');
|
||||
$expected = "new TestPostsController();\n\t\t\$this->Posts->constructClasses();\n";
|
||||
|
@ -396,7 +539,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* Test that mock class generation works for the appropriate classes
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testMockClassGeneration() {
|
||||
$result = $this->Task->hasMockClass('controller');
|
||||
$this->assertTrue($result);
|
||||
|
@ -406,7 +550,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test bake() with a -plugin param
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeWithPlugin() {
|
||||
$this->Task->plugin = 'TestTest';
|
||||
|
||||
|
@ -419,7 +564,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* Test filename generation for each type + plugins
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testTestCaseFileName() {
|
||||
$this->Task->path = '/my/path/tests/';
|
||||
|
||||
|
@ -453,7 +599,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test execute with a type defined
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithOneArg() {
|
||||
$this->Task->args[0] = 'Model';
|
||||
$this->Task->setReturnValueAt(0, 'in', 'TestTaskTag');
|
||||
|
@ -466,7 +613,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
* test execute with type and class name defined
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithTwoArgs() {
|
||||
$this->Task->args = array('Model', 'TestTaskTag');
|
||||
$this->Task->setReturnValueAt(0, 'in', 'TestTaskTag');
|
||||
|
|
|
@ -49,10 +49,36 @@ Mock::generatePartial(
|
|||
Mock::generate('ControllerTask', 'ViewTaskMockControllerTask');
|
||||
Mock::generate('ProjectTask', 'ViewTaskMockProjectTask');
|
||||
|
||||
/**
|
||||
* Test View Task Comment Model
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class ViewTaskComment extends Model {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'ViewTaskComment';
|
||||
|
||||
/**
|
||||
* Table name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'comments';
|
||||
|
||||
/**
|
||||
* Belongs To Associations
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $belongsTo = array(
|
||||
'Article' => array(
|
||||
'className' => 'ViewTaskArticle',
|
||||
|
@ -61,46 +87,143 @@ class ViewTaskComment extends Model {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test View Task Article Model
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class ViewTaskArticle extends Model {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'ViewTaskArticle';
|
||||
|
||||
/**
|
||||
* Table name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'articles';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test View Task Comments Controller
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class ViewTaskCommentsController extends Controller {
|
||||
|
||||
/**
|
||||
* Controller name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'ViewTaskComments';
|
||||
|
||||
/**
|
||||
* Testing public controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function index() {
|
||||
|
||||
}
|
||||
function add() {
|
||||
|
||||
/**
|
||||
* Testing public controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function add() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test View Task Articles Controller
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console.libs.tasks
|
||||
*/
|
||||
class ViewTaskArticlesController extends Controller {
|
||||
|
||||
/**
|
||||
* Controller name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'ViewTaskArticles';
|
||||
|
||||
/**
|
||||
* Test public controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function index() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test public controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function add() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test admin prefixed controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function admin_index() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test admin prefixed controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function admin_add() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test admin prefixed controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function admin_view() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test admin prefixed controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function admin_edit() {
|
||||
|
||||
}
|
||||
function admin_delete() {
|
||||
|
||||
/**
|
||||
* Test admin prefixed controller action
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function admin_delete() {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,6 +235,12 @@ class ViewTaskArticlesController extends Controller {
|
|||
*/
|
||||
class ViewTaskTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
||||
|
||||
/**
|
||||
|
@ -148,7 +277,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* Test getContent and parsing of Templates.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetContent() {
|
||||
$vars = array(
|
||||
'modelClass' => 'TestViewModel',
|
||||
|
@ -178,7 +308,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test getContent() using an admin_prefixed action.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testGetContentWithAdminAction() {
|
||||
$_back = Configure::read('Routing');
|
||||
Configure::write('Routing.prefixes', array('admin'));
|
||||
|
@ -212,7 +343,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test Bake method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBake() {
|
||||
$this->Task->controllerName = 'ViewTaskComments';
|
||||
$this->Task->controllerPath = 'view_task_comments';
|
||||
|
@ -237,7 +369,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test bake() with a -plugin param
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeWithPlugin() {
|
||||
$this->Task->controllerName = 'ViewTaskComments';
|
||||
$this->Task->controllerPath = 'view_task_comments';
|
||||
|
@ -252,7 +385,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test bake actions baking multiple actions.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testBakeActions() {
|
||||
$this->Task->controllerName = 'ViewTaskComments';
|
||||
$this->Task->controllerPath = 'view_task_comments';
|
||||
|
@ -277,7 +411,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test baking a customAction (non crud)
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testCustomAction() {
|
||||
$this->Task->controllerName = 'ViewTaskComments';
|
||||
$this->Task->controllerPath = 'view_task_comments';
|
||||
|
@ -295,7 +430,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* Test all()
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteIntoAll() {
|
||||
$this->Task->args[0] = 'all';
|
||||
|
||||
|
@ -313,7 +449,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test `cake bake view $controller view`
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithActionParam() {
|
||||
$this->Task->args[0] = 'ViewTaskComments';
|
||||
$this->Task->args[1] = 'view';
|
||||
|
@ -328,7 +465,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* Ensure that views are only baked for actions that exist in the controller.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithController() {
|
||||
$this->Task->args[0] = 'ViewTaskComments';
|
||||
|
||||
|
@ -344,7 +482,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* Which only bakes admin methods, not non-admin methods.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithControllerAndAdminFlag() {
|
||||
$_back = Configure::read('Routing');
|
||||
Configure::write('Routing.prefixes', array('admin'));
|
||||
|
@ -366,7 +505,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test execute into interactive.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteInteractive() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->args = array();
|
||||
|
@ -403,7 +543,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test `cake bake view posts index list`
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteWithAlternateTemplates() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->args = array('ViewTaskComments', 'index', 'list');
|
||||
|
@ -421,7 +562,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
* test execute into interactive() with admin methods.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
* @access public
|
||||
*/
|
||||
function testExecuteInteractiveWithAdmin() {
|
||||
Configure::write('Routing.prefixes', array('admin'));
|
||||
$this->Task->connection = 'test_suite';
|
||||
|
|
Loading…
Reference in a new issue