Merge remote branch 'origin/2.0' into 2.0-class-loading

Conflicts:
	cake/bootstrap.php
	cake/libs/view/helpers/js.php
	lib/Cake/Model/AclNode.php
	lib/Cake/Model/ConnectionManager.php
	lib/Cake/bootstrap.php
	lib/Cake/tests/cases/libs/controller/controller.test.php
This commit is contained in:
José Lorenzo Rodríguez 2011-01-02 02:00:03 -04:30
commit 4c0e06c451
587 changed files with 3504 additions and 3462 deletions

View file

@ -14,8 +14,7 @@
; *
; * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
; * @link http://cakephp.org CakePHP(tm) Project
; * @package cake
; * @subpackage cake.app.config
; * @package app.config
; * @since CakePHP(tm) v 0.10.0.1076
; * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
; */

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @package app.config
* @since CakePHP(tm) v 0.10.8.2117
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @package app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,16 +14,14 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @package app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* In this file you set up your database connection details.
*
* @package cake
* @subpackage cake.config
* @package cake.config
*/
/**
* Database configuration class.

View file

@ -16,8 +16,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @package app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @package app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @package app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @package app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
#
# @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
# @link http://cakephp.org CakePHP(tm) Project
# @package cake
# @subpackage cake.app.console
# @package app.console
# @since CakePHP(tm) v 2.0
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#

View file

@ -11,8 +11,7 @@
::
:: @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
:: @link http://cakephp.org CakePHP(tm) Project
:: @package cake
:: @subpackage cake.app.console
:: @package app.console
:: @since CakePHP(tm) v 2.0
:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
::

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package app.console
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -10,8 +10,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app
* @package app
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.webroot
* @package app.webroot
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -10,8 +10,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.webroot.css
* @package app.webroot.css
* @since CakePHP(tm)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.webroot
* @package app.webroot
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing
* @package cake
* @subpackage cake.app.webroot
* @package app.webroot
* @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,13 +12,13 @@
//
// @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
// @link http://cakephp.org
// @package cake
// @subpackage cake.cake.libs
// @package cake.libs
// @since CakePHP(tm) v 0.2.9
// @license MIT License (http://www.opensource.org/licenses/mit-license.php)
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
1.3.6
2.0.0-dev

View file

@ -14,19 +14,18 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake
* @subpackage cake.cake.tests.cases.libs.controller.components
* @package cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::import('Controller', 'Controller', false);
App::import('Component', 'Paginator');
App::import('Core', array('CakeRequest', 'CakeResponse'));
/**
* PaginatorTestController class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @package cake.tests.cases.libs.controller.components
*/
class PaginatorTestController extends Controller {
/**
@ -57,8 +56,7 @@ class PaginatorTestController extends Controller {
/**
* PaginatorControllerPost class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @package cake.tests.cases.libs.controller.components
*/
class PaginatorControllerPost extends CakeTestModel {
@ -126,8 +124,7 @@ class PaginatorControllerPost extends CakeTestModel {
/**
* ControllerPaginateModel class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @package cake.tests.cases.libs.controller.components
*/
class ControllerPaginateModel extends CakeTestModel {
@ -170,8 +167,7 @@ class ControllerPaginateModel extends CakeTestModel {
/**
* PaginatorControllerCommentclass
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @package cake.tests.cases.libs.controller.components
*/
class PaginatorControllerComment extends CakeTestModel {
@ -210,6 +206,22 @@ class PaginatorTest extends CakeTestCase {
*/
public $fixtures = array('core.post', 'core.comment');
/**
* setup
*
* @return void
*/
function setUp() {
parent::setUp();
$this->request = new CakeRequest('controller_posts/index');
$this->request->params['pass'] = $this->request->params['named'] = array();
$this->Controller = new Controller($this->request);
$this->Paginator = new PaginatorComponent($this->getMock('ComponentCollection'), array());
$this->Paginator->Controller = $this->Controller;
$this->Controller->Post = $this->getMock('Model');
$this->Controller->Post->alias = 'Post';
}
/**
* testPaginate method
*
@ -217,13 +229,10 @@ class PaginatorTest extends CakeTestCase {
* @return void
*/
function testPaginate() {
$request = new CakeRequest('controller_posts/index');
$request->params['pass'] = $request->params['named'] = array();
$Controller = new PaginatorTestController($request);
$Controller = new PaginatorTestController($this->request);
$Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
$Controller->passedArgs[] = '1';
$Controller->params['url'] = array();
$Controller->request->params['pass'] = array('1');
$Controller->request->query = array();
$Controller->constructClasses();
$results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
@ -238,67 +247,95 @@ class PaginatorTest extends CakeTestCase {
$results = Set::extract($Controller->Paginator->paginate(), '{n}.PaginatorControllerPost.id');
$this->assertEqual($results, array(1, 2, 3));
$Controller->passedArgs = array('page' => '-1');
$Controller->request->params['named'] = array('page' => '-1');
$results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertEqual($results, array(1, 2, 3));
$Controller->passedArgs = array('sort' => 'PaginatorControllerPost.id', 'direction' => 'asc');
$Controller->request->params['named'] = array('sort' => 'PaginatorControllerPost.id', 'direction' => 'asc');
$results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertEqual($results, array(1, 2, 3));
$Controller->passedArgs = array('sort' => 'PaginatorControllerPost.id', 'direction' => 'desc');
$Controller->request->params['named'] = array('sort' => 'PaginatorControllerPost.id', 'direction' => 'desc');
$results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertEqual($results, array(3, 2, 1));
$Controller->passedArgs = array('sort' => 'id', 'direction' => 'desc');
$Controller->request->params['named'] = array('sort' => 'id', 'direction' => 'desc');
$results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertEqual($results, array(3, 2, 1));
$Controller->passedArgs = array('sort' => 'NotExisting.field', 'direction' => 'desc');
$Controller->request->params['named'] = array('sort' => 'NotExisting.field', 'direction' => 'desc');
$results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['page'], 1, 'Invalid field in query %s');
$this->assertEqual($results, array(1, 2, 3));
$Controller->passedArgs = array('sort' => 'PaginatorControllerPost.author_id', 'direction' => 'allYourBase');
$Controller->request->params['named'] = array(
'sort' => 'PaginatorControllerPost.author_id', 'direction' => 'allYourBase'
);
$results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEqual($Controller->PaginatorControllerPost->lastQuery['order'][0], array('PaginatorControllerPost.author_id' => 'asc'));
$this->assertEqual($results, array(1, 3, 2));
$Controller->passedArgs = array('page' => '1 " onclick="alert(\'xss\');">');
$Controller->Paginator->settings = array('limit' => 1);
$Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['page'], 1, 'XSS exploit opened %s');
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['options']['page'], 1, 'XSS exploit opened %s');
$Controller->passedArgs = array();
$Controller->Paginator->settings = array('limit' => 0);
$Controller->request->params['named'] = array();
$Controller->Paginator->settings = array('limit' => 0, 'maxLimit' => 10, 'paramType' => 'named');
$Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['pageCount'], 3);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['prevPage'], false);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['nextPage'], true);
$Controller->passedArgs = array();
$Controller->Paginator->settings = array('limit' => 'garbage!');
$Controller->request->params['named'] = array();
$Controller->Paginator->settings = array('limit' => 'garbage!', 'maxLimit' => 10, 'paramType' => 'named');
$Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['pageCount'], 3);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['prevPage'], false);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['nextPage'], true);
$Controller->passedArgs = array();
$Controller->Paginator->settings = array('limit' => '-1');
$Controller->request->params['named'] = array();
$Controller->Paginator->settings = array('limit' => '-1', 'maxLimit' => 10, 'paramType' => 'named');
$Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['limit'], 1);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['pageCount'], 3);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['prevPage'], false);
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['nextPage'], true);
}
/**
* Test that non-numeric values are rejected for page, and limit
*
* @return void
*/
function testPageParamCasting() {
$this->Controller->Post->expects($this->at(0))
->method('hasMethod')
->with('paginateCount')
->will($this->returnValue(false));
$this->Controller->Post->expects($this->at(1))
->method('find')
->will($this->returnValue(2));
$this->Controller->Post->expects($this->at(2))
->method('hasMethod')
->with('paginate')
->will($this->returnValue(false));
$this->Controller->Post->expects($this->at(3))
->method('find')
->will($this->returnValue(array('stuff')));
$this->request->params['named'] = array('page' => '1 " onclick="alert(\'xss\');">');
$this->Paginator->settings = array('limit' => 1, 'maxLimit' => 10, 'paramType' => 'named');
$this->Paginator->paginate('Post');
$this->assertSame(1, $this->request->params['paging']['Post']['page'], 'XSS exploit opened');
}
/**
* testPaginateExtraParams method
*
@ -306,120 +343,118 @@ class PaginatorTest extends CakeTestCase {
* @return void
*/
function testPaginateExtraParams() {
$request = new CakeRequest('controller_posts/index');
$request->params['pass'] = $request->params['named'] = array();
$Controller = new PaginatorTestController($request);
$Controller = new PaginatorTestController($this->request);
$Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
$Controller->passedArgs[] = '1';
$Controller->request->params['pass'] = array('1');
$Controller->params['url'] = array();
$Controller->constructClasses();
$Controller->passedArgs = array('page' => '-1', 'contain' => array('PaginatorControllerComment'));
$Controller->request->params['named'] = array('page' => '-1', 'contain' => array('PaginatorControllerComment'));
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertEqual(Set::extract($result, '{n}.PaginatorControllerPost.id'), array(1, 2, 3));
$this->assertTrue(!isset($Controller->PaginatorControllerPost->lastQuery['contain']));
$Controller->passedArgs = array('page' => '-1');
$Controller->Paginator->settings = array('PaginatorControllerPost' => array('contain' => array('PaginatorControllerComment')));
$Controller->request->params['named'] = array('page' => '-1');
$Controller->Paginator->settings = array(
'PaginatorControllerPost' => array(
'contain' => array('PaginatorControllerComment'),
'maxLimit' => 10,
'paramType' => 'named'
),
);
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
$this->assertEqual(Set::extract($result, '{n}.PaginatorControllerPost.id'), array(1, 2, 3));
$this->assertTrue(isset($Controller->PaginatorControllerPost->lastQuery['contain']));
$Controller->Paginator->settings = array('PaginatorControllerPost' => array('popular', 'fields' => array('id', 'title')));
$Controller->Paginator->settings = array(
'PaginatorControllerPost' => array(
'popular', 'fields' => array('id', 'title'), 'maxLimit' => 10, 'paramType' => 'named'
),
);
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEqual(Set::extract($result, '{n}.PaginatorControllerPost.id'), array(2, 3));
$this->assertEqual($Controller->PaginatorControllerPost->lastQuery['conditions'], array('PaginatorControllerPost.id > ' => '1'));
$Controller->passedArgs = array('limit' => 12);
$Controller->Paginator->settings = array('limit' => 30);
$Controller->request->params['named'] = array('limit' => 12);
$Controller->Paginator->settings = array('limit' => 30, 'maxLimit' => 100, 'paramType' => 'named');
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$paging = $Controller->params['paging']['PaginatorControllerPost'];
$this->assertEqual($Controller->PaginatorControllerPost->lastQuery['limit'], 12);
$this->assertEqual($paging['options']['limit'], 12);
$Controller = new PaginatorTestController($request);
$Controller = new PaginatorTestController($this->request);
$Controller->uses = array('ControllerPaginateModel');
$Controller->params['url'] = array();
$Controller->request->query = array();
$Controller->constructClasses();
$Controller->Paginator->settings = array(
'ControllerPaginateModel' => array('contain' => array('ControllerPaginateModel'), 'group' => 'Comment.author_id')
'ControllerPaginateModel' => array(
'contain' => array('ControllerPaginateModel'),
'group' => 'Comment.author_id',
'maxLimit' => 10,
'paramType' => 'named'
)
);
$result = $Controller->Paginator->paginate('ControllerPaginateModel');
$expected = array('contain' => array('ControllerPaginateModel'), 'group' => 'Comment.author_id');
$expected = array(
'contain' => array('ControllerPaginateModel'),
'group' => 'Comment.author_id',
'maxLimit' => 10,
'paramType' => 'named'
);
$this->assertEqual($Controller->ControllerPaginateModel->extra, $expected);
$this->assertEqual($Controller->ControllerPaginateModel->extraCount, $expected);
$Controller->Paginator->settings = array(
'ControllerPaginateModel' => array('foo', 'contain' => array('ControllerPaginateModel'), 'group' => 'Comment.author_id')
'ControllerPaginateModel' => array(
'foo', 'contain' => array('ControllerPaginateModel'),
'group' => 'Comment.author_id',
'maxLimit' => 10,
'paramType' => 'named'
)
);
$Controller->Paginator->paginate('ControllerPaginateModel');
$expected = array('contain' => array('ControllerPaginateModel'), 'group' => 'Comment.author_id', 'type' => 'foo');
$expected = array(
'contain' => array('ControllerPaginateModel'),
'group' => 'Comment.author_id',
'type' => 'foo',
'maxLimit' => 10,
'paramType' => 'named'
);
$this->assertEqual($Controller->ControllerPaginateModel->extra, $expected);
$this->assertEqual($Controller->ControllerPaginateModel->extraCount, $expected);
}
/**
* testPaginatePassedArgs method
*
* @return void
*/
public function testPaginatePassedArgs() {
$request = new CakeRequest('controller_posts/index');
$request->params['pass'] = $request->params['named'] = array();
$Controller = new PaginatorTestController($request);
$Controller->uses = array('PaginatorControllerPost');
$Controller->passedArgs[] = array('1', '2', '3');
$Controller->params['url'] = array();
$Controller->constructClasses();
$Controller->Paginator->settings = array(
'fields' => array(),
'order' => '',
'limit' => 5,
'page' => 1,
'recursive' => -1
);
$conditions = array();
$Controller->Paginator->paginate('PaginatorControllerPost',$conditions);
$expected = array(
'fields' => array(),
'order' => '',
'limit' => 5,
'page' => 1,
'recursive' => -1,
'conditions' => array()
);
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['options'],$expected);
}
/**
* Test that special paginate types are called and that the type param doesn't leak out into defaults or options.
*
* @return void
*/
function testPaginateSpecialType() {
$request = new CakeRequest('controller_posts/index');
$request->params['pass'] = $request->params['named'] = array();
$Controller = new PaginatorTestController($request);
$Controller = new PaginatorTestController($this->request);
$Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
$Controller->passedArgs[] = '1';
$Controller->params['url'] = array();
$Controller->constructClasses();
$Controller->Paginator->settings = array('PaginatorControllerPost' => array('popular', 'fields' => array('id', 'title')));
$Controller->Paginator->settings = array(
'PaginatorControllerPost' => array(
'popular',
'fields' => array('id', 'title'),
'maxLimit' => 10,
'paramType' => 'named'
)
);
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEqual(Set::extract($result, '{n}.PaginatorControllerPost.id'), array(2, 3));
$this->assertEqual($Controller->PaginatorControllerPost->lastQuery['conditions'], array('PaginatorControllerPost.id > ' => '1'));
$this->assertFalse(isset($Controller->params['paging']['PaginatorControllerPost']['defaults'][0]));
$this->assertEqual(
$Controller->PaginatorControllerPost->lastQuery['conditions'],
array('PaginatorControllerPost.id > ' => '1')
);
$this->assertFalse(isset($Controller->params['paging']['PaginatorControllerPost']['options'][0]));
}
@ -430,17 +465,17 @@ class PaginatorTest extends CakeTestCase {
* @return void
*/
function testDefaultPaginateParams() {
$request = new CakeRequest('controller_posts/index');
$request->params['pass'] = $request->params['named'] = array();
$Controller = new PaginatorTestController($request);
$Controller = new PaginatorTestController($this->request);
$Controller->modelClass = 'PaginatorControllerPost';
$Controller->params['url'] = array();
$Controller->constructClasses();
$Controller->Paginator->settings = array('order' => 'PaginatorControllerPost.id DESC');
$Controller->Paginator->settings = array(
'order' => 'PaginatorControllerPost.id DESC',
'maxLimit' => 10,
'paramType' => 'named'
);
$results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['defaults']['order'], 'PaginatorControllerPost.id DESC');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['options']['order'], 'PaginatorControllerPost.id DESC');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['order'], 'PaginatorControllerPost.id DESC');
$this->assertEqual($results, array(3, 2, 1));
}
@ -450,10 +485,7 @@ class PaginatorTest extends CakeTestCase {
* @return void
*/
function testPaginateOrderVirtualField() {
$request = new CakeRequest('controller_posts/index');
$request->params['pass'] = $request->params['named'] = array();
$Controller = new PaginatorTestController($request);
$Controller = new PaginatorTestController($this->request);
$Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
$Controller->params['url'] = array();
$Controller->constructClasses();
@ -463,12 +495,14 @@ class PaginatorTest extends CakeTestCase {
$Controller->Paginator->settings = array(
'fields' => array('id', 'title', 'offset_test'),
'order' => array('offset_test' => 'DESC')
'order' => array('offset_test' => 'DESC'),
'maxLimit' => 10,
'paramType' => 'named'
);
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEqual(Set::extract($result, '{n}.PaginatorControllerPost.offset_test'), array(4, 3, 2));
$Controller->passedArgs = array('sort' => 'offset_test', 'direction' => 'asc');
$Controller->request->params['named'] = array('sort' => 'offset_test', 'direction' => 'asc');
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEqual(Set::extract($result, '{n}.PaginatorControllerPost.offset_test'), array(2, 3, 4));
}
@ -479,11 +513,252 @@ class PaginatorTest extends CakeTestCase {
* @expectedException MissingModelException
*/
function testPaginateMissingModel() {
$request = new CakeRequest('controller_posts/index');
$request->params['pass'] = $request->params['named'] = array();
$Controller = new PaginatorTestController($request);
$Controller = new PaginatorTestController($this->request);
$Controller->constructClasses();
$Controller->Paginator->paginate('MissingModel');
}
/**
* test that option merging prefers specific models
*
* @return void
*/
function testMergeOptionsModelSpecific() {
$this->Paginator->settings = array(
'page' => 1,
'limit' => 20,
'maxLimit' => 100,
'paramType' => 'named',
'Post' => array(
'page' => 1,
'limit' => 10,
'maxLimit' => 50,
'paramType' => 'named',
)
);
$result = $this->Paginator->mergeOptions('Silly');
$this->assertEquals($this->Paginator->settings, $result);
$result = $this->Paginator->mergeOptions('Post');
$expected = array('page' => 1, 'limit' => 10, 'paramType' => 'named', 'maxLimit' => 50);
$this->assertEquals($expected, $result);
}
/**
* test mergeOptions with named params.
*
* @return void
*/
function testMergeOptionsNamedParams() {
$this->request->params['named'] = array(
'page' => 10,
'limit' => 10
);
$this->Paginator->settings = array(
'page' => 1,
'limit' => 20,
'maxLimit' => 100,
'paramType' => 'named',
);
$result = $this->Paginator->mergeOptions('Post');
$expected = array('page' => 10, 'limit' => 10, 'maxLimit' => 100, 'paramType' => 'named');
$this->assertEquals($expected, $result);
}
/**
* test merging options from the querystring.
*
* @return void
*/
function testMergeOptionsQueryString() {
$this->request->params['named'] = array(
'page' => 10,
'limit' => 10
);
$this->request->query = array(
'page' => 99,
'limit' => 75
);
$this->Paginator->settings = array(
'page' => 1,
'limit' => 20,
'maxLimit' => 100,
'paramType' => 'querystring',
);
$result = $this->Paginator->mergeOptions('Post');
$expected = array('page' => 99, 'limit' => 75, 'maxLimit' => 100, 'paramType' => 'querystring');
$this->assertEquals($expected, $result);
}
/**
* test that the default whitelist doesn't let people screw with things they should not be allowed to.
*
* @return void
*/
function testMergeOptionsDefaultWhiteList() {
$this->request->params['named'] = array(
'page' => 10,
'limit' => 10,
'fields' => array('bad.stuff'),
'recursive' => 1000,
'conditions' => array('bad.stuff'),
'contain' => array('bad')
);
$this->Paginator->settings = array(
'page' => 1,
'limit' => 20,
'maxLimit' => 100,
'paramType' => 'named',
);
$result = $this->Paginator->mergeOptions('Post');
$expected = array('page' => 10, 'limit' => 10, 'maxLimit' => 100, 'paramType' => 'named');
$this->assertEquals($expected, $result);
}
/**
* test that modifying the whitelist works.
*
* @return void
*/
function testMergeOptionsExtraWhitelist() {
$this->request->params['named'] = array(
'page' => 10,
'limit' => 10,
'fields' => array('bad.stuff'),
'recursive' => 1000,
'conditions' => array('bad.stuff'),
'contain' => array('bad')
);
$this->Paginator->settings = array(
'page' => 1,
'limit' => 20,
'maxLimit' => 100,
'paramType' => 'named',
);
$this->Paginator->whitelist[] = 'fields';
$result = $this->Paginator->mergeOptions('Post');
$expected = array(
'page' => 10, 'limit' => 10, 'maxLimit' => 100, 'paramType' => 'named', 'fields' => array('bad.stuff')
);
$this->assertEquals($expected, $result);
}
/**
* test that invalid directions are ignored.
*
* @return void
*/
function testValidateSortInvalidDirection() {
$model = $this->getMock('Model');
$model->alias = 'model';
$model->expects($this->any())->method('hasField')->will($this->returnValue(true));
$options = array('sort' => 'something', 'direction' => 'boogers');
$result = $this->Paginator->validateSort($model, $options);
$this->assertEquals('asc', $result['order']['model.something']);
}
/**
* test that fields not in whitelist won't be part of order conditions.
*
* @return void
*/
function testValidateSortWhitelistFailure() {
$model = $this->getMock('Model');
$model->alias = 'model';
$model->expects($this->any())->method('hasField')->will($this->returnValue(true));
$options = array('sort' => 'body', 'direction' => 'asc');
$result = $this->Paginator->validateSort($model, $options, array('title', 'id'));
$this->assertNull($result['order']);
}
/**
* test that virtual fields work.
*
* @return void
*/
function testValidateSortVirtualField() {
$model = $this->getMock('Model');
$model->alias = 'model';
$model->expects($this->at(0))
->method('hasField')
->with('something')
->will($this->returnValue(false));
$model->expects($this->at(1))
->method('hasField')
->with('something', true)
->will($this->returnValue(true));
$options = array('sort' => 'something', 'direction' => 'desc');
$result = $this->Paginator->validateSort($model, $options);
$this->assertEquals('desc', $result['order']['something']);
}
/**
* test that maxLimit is respected
*
* @return void
*/
function testCheckLimit() {
$result = $this->Paginator->checkLimit(array('limit' => 1000000, 'maxLimit' => 100));
$this->assertEquals(100, $result['limit']);
$result = $this->Paginator->checkLimit(array('limit' => 'sheep!', 'maxLimit' => 100));
$this->assertEquals(1, $result['limit']);
$result = $this->Paginator->checkLimit(array('limit' => '-1', 'maxLimit' => 100));
$this->assertEquals(1, $result['limit']);
$result = $this->Paginator->checkLimit(array('limit' => null, 'maxLimit' => 100));
$this->assertEquals(1, $result['limit']);
$result = $this->Paginator->checkLimit(array('limit' => 0, 'maxLimit' => 100));
$this->assertEquals(1, $result['limit']);
}
/**
* testPaginateMaxLimit
*
* @return void
* @access public
*/
function testPaginateMaxLimit() {
$Controller = new Controller($this->request);
$Controller->uses = array('PaginatorControllerPost', 'ControllerComment');
$Controller->passedArgs[] = '1';
$Controller->params['url'] = array();
$Controller->constructClasses();
$Controller->request->params['named'] = array(
'contain' => array('ControllerComment'), 'limit' => '1000'
);
$result = $Controller->paginate('PaginatorControllerPost');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['options']['limit'], 100);
$Controller->request->params['named'] = array(
'contain' => array('ControllerComment'), 'limit' => '1000', 'maxLimit' => 1000
);
$result = $Controller->paginate('PaginatorControllerPost');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['options']['limit'], 100);
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '10');
$result = $Controller->paginate('PaginatorControllerPost');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['options']['limit'], 10);
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '1000');
$Controller->paginate = array('maxLimit' => 2000, 'paramType' => 'named');
$result = $Controller->paginate('PaginatorControllerPost');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['options']['limit'], 1000);
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '5000');
$result = $Controller->paginate('PaginatorControllerPost');
$this->assertEqual($Controller->params['paging']['PaginatorControllerPost']['options']['limit'], 2000);
}
}

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2006-2010, Cake Software Foundation, Inc.
* @link http://cakephp.org CakePHP Project
* @package cake
* @subpackage cake.cake.libs.
* @package cake.libs.
* @since CakePHP v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -27,15 +26,13 @@ require_once dirname(__FILE__) . DS . 'model' . DS . 'models.php';
/**
* AppController class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller
* @package cake.tests.cases.libs.controller
*/
if (!class_exists('AppController')) {
/**
* AppController class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller
* @package cake.tests.cases.libs.controller
*/
class AppController extends Controller {
/**
@ -87,8 +84,7 @@ if (!class_exists('PostsController')) {
/**
* ControllerTestCaseTest
*
* @package cake
* @subpackage cake.tests.cases.libs
* @package cake.tests.cases.libs
*/
class ControllerTestCaseTest extends CakeTestCase {
@ -171,7 +167,7 @@ class ControllerTestCaseTest extends CakeTestCase {
)
));
$this->assertNull($Posts->Post->save(array()));
$this->assertIsA($Posts->Post->find('all'), 'array');
$this->assertInternalType('array', $Posts->Post->find('all'));
$Posts = $this->Case->generate('Posts', array(
'models' => array('Post'),
@ -198,7 +194,7 @@ class ControllerTestCaseTest extends CakeTestCase {
function testTestAction() {
$Controller = $this->Case->generate('TestsApps');
$this->Case->testAction('/tests_apps/index');
$this->assertIsA($this->Case->controller->viewVars, 'array');
$this->assertInternalType('array', $this->Case->controller->viewVars);
$this->Case->testAction('/tests_apps/set_action');
$results = $this->Case->controller->viewVars;
@ -254,8 +250,7 @@ class ControllerTestCaseTest extends CakeTestCase {
include LIBS . 'tests' . DS . 'test_app' . DS . 'config' . DS . 'routes.php';
$this->Case->loadRoutes = false;
$result = $this->Case->testAction('/tests_apps/index.json', array('return' => 'view'));
$result = $this->Case->testAction('/tests_apps/missing_action.json', array('return' => 'view'));
}
/**

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs.http
* @package cake.tests.cases.libs.http
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,8 +23,7 @@ App::import('Lib', 'http/BasicAuthentication');
/**
* BasicMethodTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.http
* @package cake.tests.cases.libs.http
*/
class BasicMethodTest extends CakeTestCase {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs.http
* @package cake.tests.cases.libs.http
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -51,8 +50,7 @@ class DigestHttpSocket extends HttpSocket {
/**
* DigestAuthenticationTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.http
* @package cake.tests.cases.libs.http
*/
class DigestAuthenticationTest extends CakeTestCase {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs
* @package cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -22,8 +21,7 @@ App::import('Core', 'HttpResponse');
/**
* TestHttpResponse class
*
* @package cake
* @subpackage cake.tests.cases.libs
* @package cake.tests.cases.libs
*/
class TestHttpResponse extends HttpResponse {
@ -83,8 +81,7 @@ class TestHttpResponse extends HttpResponse {
/**
* HttpResponseTest class
*
* @package cake
* @subpackage cake.tests.cases.libs
* @package cake.tests.cases.libs
*/
class HttpResponseTest extends CakeTestCase {
/**

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake
* @subpackage cake.cake.tests.libs
* @package cake.tests.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -27,8 +26,7 @@ App::import('Core', array('Router', 'CakeRequest', 'CakeResponse', 'Helper'));
/**
* ControllerTestDispatcher class
*
* @package cake
* @subpackage cake.cake.tests.lib
* @package cake.tests.lib
*/
class ControllerTestDispatcher extends Dispatcher {
@ -65,10 +63,9 @@ class ControllerTestDispatcher extends Dispatcher {
* Loads routes and resets if the test case dictates it should
*
* @return void
* @access private
*/
protected function __loadRoutes() {
parent::__loadRoutes();
protected function _loadRoutes() {
parent::_loadRoutes();
if (!$this->loadRoutes) {
Router::reload();
}
@ -78,8 +75,7 @@ class ControllerTestDispatcher extends Dispatcher {
/**
* InterceptContentHelper class
*
* @package cake
* @subpackage cake.cake.tests.lib
* @package cake.tests.lib
*/
class InterceptContentHelper extends Helper {
@ -97,8 +93,7 @@ class InterceptContentHelper extends Helper {
/**
* ControllerTestCase class
*
* @package cake
* @subpackage cake.cake.tests.lib
* @package cake.tests.lib
*/
class ControllerTestCase extends CakeTestCase {

View file

@ -17,7 +17,6 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -13,8 +13,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs
* @package cake.libs
* @since CakePHP(tm) v 1.2.0.4933
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -22,10 +21,27 @@
App::uses('Inflector', 'Utility');
/**
* Caching for CakePHP.
* Cache provides a consistent interface to Caching in your application. It allows you
* to use several different Cache engines, without coupling your application to a specific
* implementation. It also allows you to change out cache storage or configuration without effecting
* the rest of your application.
*
* @package cake
* @subpackage cake.cake.libs
* You can configure Cache engines in your application's `bootstrap.php` file. A sample configuration would
* be
*
* {{{
* Cache::config('shared', array(
* 'engine' => 'Apc',
* 'prefix' => 'my_app_'
* ));
* }}}
*
* This would configure an APC cache engine to the 'shared' alias. You could then read and write
* to that cache alias by using it for the `$config` parameter in the various Cache methods. In
* general all Cache operations are supported by all cache engines. However, Cache::increment() and
* Cache::decrement() are not supported by File caching.
*
* @package cake.libs
*/
class Cache {
@ -439,8 +455,7 @@ class Cache {
/**
* Storage engine for CakePHP caching
*
* @package cake
* @subpackage cake.cake.libs
* @package cake.libs
*/
abstract class CacheEngine {

View file

@ -13,8 +13,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.cache
* @package cake.libs.cache
* @since CakePHP(tm) v 1.2.0.4933
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -22,8 +21,7 @@
/**
* APC storage engine for cache
*
* @package cake
* @subpackage cake.cake.libs.cache
* @package cake.libs.cache
*/
class ApcEngine extends CacheEngine {

View file

@ -13,8 +13,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.cache
* @package cake.libs.cache
* @since CakePHP(tm) v 1.2.0.4933
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,8 +22,7 @@
* File Storage engine for cache
*
* @todo use the File and Folder classes (if it's not a too big performance hit)
* @package cake
* @subpackage cake.cake.libs.cache
* @package cake.libs.cache
*/
class FileEngine extends CacheEngine {

View file

@ -13,8 +13,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.cache
* @package cake.libs.cache
* @since CakePHP(tm) v 1.2.0.4933
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,8 +23,7 @@
* control you have over expire times far in the future. See MemcacheEngine::write() for
* more information.
*
* @package cake
* @subpackage cake.cake.libs.cache
* @package cake.libs.cache
*/
class MemcacheEngine extends CacheEngine {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.cache
* @package cake.libs.cache
* @since CakePHP(tm) v 1.2.0.4947
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -22,8 +21,7 @@
* Xcache storage engine for cache
*
* @link http://trac.lighttpd.net/xcache/ Xcache
* @package cake
* @subpackage cake.cake.libs.cache
* @package cake.libs.cache
*/
class XcacheEngine extends CacheEngine {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.libs.config
* @package cake.libs.config
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs
* @package cake.libs.config
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.console.shells
* @package cake.console.shells
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -25,8 +24,7 @@
* Add your application-wide methods in the class below, your shells
* will inherit them.
*
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.libs
*/
class AppShell extends Shell {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,8 +23,7 @@ App::uses('DbAcl', 'Model');
* Shell for ACL management. This console is known to have issues with zend.ze1_compatibility_mode
* being enabled. Be sure to turn it off when using this shell.
*
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.libs
*/
class AclShell extends Shell {

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,8 +23,7 @@ App::uses('File', 'Utility');
/**
* API shell to show method signatures of CakePHP core classes.
*
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.libs
*/
class ApiShell extends Shell {

View file

@ -16,8 +16,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -27,8 +26,7 @@ App::uses('Model', 'Model');
/**
* Bake is a command-line code generation utility for automating programmer chores.
*
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.libs
* @link http://book.cakephp.org/view/1522/Code-Generation-with-Bake
*/
class BakeShell extends Shell {

View file

@ -12,8 +12,6 @@
*
* @copyright Copyright 2006-2010, Cake Software Foundation, Inc.
* @link http://cakephp.org CakePHP Project
* @package cake
* @subpackage cake.tests.cases.console.libs
* @since CakePHP v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -21,7 +19,7 @@
/**
* Shows a list of commands available from the console.
*
* @package cake.console.libs
* @package cake.console.shells
*/
class CommandListShell extends Shell {

View file

@ -12,15 +12,13 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
*/
class ConsoleShell extends Shell {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5669
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -21,8 +20,7 @@
/**
* Shell for I18N management.
*
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
*/
class I18nShell extends Shell {

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5550
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -26,8 +25,7 @@ App::uses('CakeSchema', 'Model');
/**
* Schema is a command-line database management utility for automating programmer chores.
*
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @link http://book.cakephp.org/view/1523/Schema-management-and-migrations
*/
class SchemaShell extends Shell {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,8 +22,7 @@ App::uses('BakeTask', 'Console/Command/Task');
/**
* Task class for creating and updating controller files.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class ControllerTask extends BakeTask {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -21,8 +20,7 @@
/**
* Task class for creating and updating the database configuration file.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class DbConfigTask extends Shell {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -21,8 +20,7 @@ App::uses('File', 'Utility');
/**
* Language string extractor
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class ExtractTask extends Shell {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,8 +23,7 @@ App::uses('Model', 'Model');
/**
* Task class for creating and updating fixtures files.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class FixtureTask extends BakeTask {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -25,8 +24,7 @@ App::uses('Model', 'Model');
/**
* Task class for creating and updating model files.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class ModelTask extends BakeTask {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,8 +22,7 @@ App::uses('File', 'Utility');
/**
* Task class for creating a plugin
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class PluginTask extends Shell {

View file

@ -13,8 +13,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.bake
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,8 +23,7 @@ App::uses('File', 'Utility');
/**
* Task class for creating new project apps and plugins
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class ProjectTask extends Shell {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.console.libs.tasks
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,8 +23,7 @@ App::uses('ClassRegistry', 'Utility');
/**
* Task class for creating and updating test files.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class TestTask extends BakeTask {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.libs.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,8 +23,7 @@ App::uses('BakeTask', 'Console/Command/Task');
/**
* Task class for creating and updating view files.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
* @package cake.console.shells.tasks
*/
class ViewTask extends BakeTask {

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -25,8 +24,7 @@ App::uses('CakeLog', 'Log');
* Error Handler for Cake console. Does simple printing of the
* exception that occurred and the stack trace of the error.
*
* @package cake
* @subpackage cake.cake.console
* @package cake.console.libs
*/
class ConsoleErrorHandler extends ErrorHandler {
@ -52,8 +50,9 @@ class ConsoleErrorHandler extends ErrorHandler {
}
/**
* Handle a exception in the console environment.
* Handle a exception in the console environment. Prints a message to stderr.
*
* @param Exception $exception The exception to handle
* @return void
*/
public static function handleException(Exception $exception) {
@ -68,6 +67,11 @@ class ConsoleErrorHandler extends ErrorHandler {
/**
* Handle errors in the console environment.
*
* @param int $code Error code
* @param string $description Description of the error.
* @param string $file The file the error occurred in.
* @param int $line The line the error ocurrred on.
* @param array $context The backtrace of the error.
* @return void
*/
public static function handleError($code, $description, $file = null, $line = null, $context = null) {
@ -84,17 +88,4 @@ class ConsoleErrorHandler extends ErrorHandler {
}
}
/**
* undocumented function
*
* @return void
*/
public function render() {
$this->stderr->write(sprintf(
__("<error>Error:</error> %s\n%s"),
$this->error->getMessage(),
$this->error->getTraceAsString()
));
}
}

View file

@ -12,15 +12,14 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.console
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Object wrapper for interacting with stdin
*
* @package cake.console
* @package cake.console.libs
*/
class ConsoleInput {
/**
@ -33,7 +32,7 @@ class ConsoleInput {
/**
* Constructor
*
* @return void
* @param string $handle The location of the stream to use as input.
*/
public function __construct($handle = 'php://stdin') {
$this->_input = fopen($handle, 'r');

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -22,11 +21,36 @@
* ConsoleOptionParser creates these when you use addArgument()
*
* @see ConsoleOptionParser::addArgument()
* @package cake.console
* @package cake.console.libs
*/
class ConsoleInputArgument {
/**
* Name of the argument.
*
* @var string
*/
protected $_name;
protected $_name, $_help, $_required, $_choices;
/**
* Help string
*
* @var string
*/
protected $_help;
/**
* Is this option required?
*
* @var boolean
*/
protected $_required;
/**
* An array of valid choices for this argument.
*
* @var array
*/
protected $_choices;
/**
* Make a new Input Argument
@ -34,8 +58,7 @@ class ConsoleInputArgument {
* @param mixed $name The long name of the option, or an array with all the properites.
* @param string $help The help text for this option
* @param boolean $required Whether this argument is required. Missing required args will trigger exceptions
* @param arraty $choices Valid choices for this option.
* @return void
* @param array $choices Valid choices for this option.
*/
public function __construct($name, $help = '', $required = false, $choices = array()) {
if (is_array($name) && isset($name['name'])) {
@ -60,7 +83,7 @@ class ConsoleInputArgument {
}
/**
* Generate the help for this this argument.
* Generate the help for this argument.
*
* @param int $width The width to make the name of the option.
* @return string
@ -125,7 +148,7 @@ class ConsoleInputArgument {
}
/**
* Append this argument to the passed in SimpleXml object.
* Append this arguments XML representation to the passed in SimpleXml object.
*
* @param SimpleXmlElement The parent element.
* @return SimpleXmlElement The parent with this argument appended.

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,11 +22,50 @@
* ConsoleOptionParser creates these when you use addOption()
*
* @see ConsoleOptionParser::addOption()
* @package cake.console
* @package cake.console.libs
*/
class ConsoleInputOption {
/**
* Name of the option
*
* @var string
*/
protected $_name;
protected $_name, $_short, $_help, $_boolean, $_default, $_choices;
/**
* Short (1 character) alias for the option.
*
* @var string
*/
protected $_short;
/**
* Help text for the option.
*
* @var string
*/
protected $_help;
/**
* Is the option a boolean option. Boolean options do not consume a parameter.
*
* @var boolean
*/
protected $_boolean;
/**
* Default value for the option
*
* @var mixed
*/
protected $_default;
/**
* An array of choices for the option.
*
* @var array
*/
protected $_choices;
/**
* Make a new Input Option
@ -37,8 +75,7 @@ class ConsoleInputOption {
* @param string $help The help text for this option
* @param boolean $boolean Whether this option is a boolean option. Boolean options don't consume extra tokens
* @param string $default The default value for this option.
* @param arraty $choices Valid choices for this option.
* @return void
* @param array $choices Valid choices for this option.
*/
public function __construct($name, $short = null, $help = '', $boolean = false, $default = '', $choices = array()) {
if (is_array($name) && isset($name['name'])) {
@ -117,7 +154,7 @@ class ConsoleInputOption {
/**
* Get the default value for this option
*
* @return void
* @return mixed
*/
public function defaultValue() {
return $this->_default;

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,19 +22,38 @@
* ConsoleOptionParser creates these when you use addSubcommand()
*
* @see ConsoleOptionParser::addSubcommand()
* @package cake.console
* @package cake.console.libs
*/
class ConsoleInputSubcommand {
protected $_name, $_help, $_parser;
/**
* Name of the subcommand
*
* @var string
*/
protected $_name;
/**
* Help string for the subcommand
*
* @var string
*/
protected $_help;
/**
* The ConsoleOptionParser for this subcommand.
*
* @var ConsoleOptionParser
*/
protected $_parser;
/**
* Make a new Subcommand
*
* @param mixed $name The long name of the subcommand, or an array with all the properites.
* @param string $help The help text for this option
* @param ConsoleOptionParser $parser A parser for this subcommand.
* @return void
* @param mixed $parser A parser for this subcommand. Either a ConsoleOptionParser, or an array that can be
* used with ConsoleOptionParser::buildFromArray()
*/
public function __construct($name, $help = '', $parser = null) {
if (is_array($name) && isset($name['name'])) {

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -30,8 +29,7 @@ App::uses('HelpFormatter', 'Console');
* for GetOpt compatible option definition. Provides a builder pattern implementation
* for creating shell option parsers.
*
* @package cake
* @subpackage cake.cake.console
* @package cake.console.libs
*/
class ConsoleOptionParser {
@ -91,7 +89,7 @@ class ConsoleOptionParser {
* preceeded by one - and are only one character long. They usually match with a long option,
* and provide a more terse alternative.
*
* #### Using Options
* ### Using Options
*
* Options can be defined with both long and short forms. By using `$parser->addOption()`
* you can define new options. The name of the option is used as its long form, and you
@ -198,7 +196,7 @@ class ConsoleOptionParser {
}
/**
* Get or set the command name for shell/task
* Get or set the command name for shell/task.
*
* @param string $text The text to set, or null if you want to read
* @return mixed If reading, the value of the command. If setting $this will be returned
@ -212,7 +210,7 @@ class ConsoleOptionParser {
}
/**
* Get or set the description text for shell/task
* Get or set the description text for shell/task.
*
* @param mixed $text The text to set, or null if you want to read. . If an array the text will be imploded with "\n"
* @return mixed If reading, the value of the description. If setting $this will be returned
@ -250,7 +248,7 @@ class ConsoleOptionParser {
* Add an option to the option parser. Options allow you to define optional or required
* parameters for your console application. Options are defined by the parameters they use.
*
* ### Params
* ### Options
*
* - `short` - The single letter variant for this option, leave undefined for none.
* - `help` - Help text for this option. Used when generating help for the option.
@ -263,11 +261,12 @@ class ConsoleOptionParser {
* - `choices` A list of valid choices for this option. If left empty all values are valid..
* An exception will be raised when parse() encounters an invalid value.
*
* @param string $name The long name you want to the value to be parsed out as when options are parsed.
* @param mixed $name The long name you want to the value to be parsed out as when options are parsed.
* Will also accept an instance of ConsoleInputOption
* @param array $params An array of parameters that define the behavior of the option
* @return returns $this.
*/
public function addOption($name, $params = array()) {
public function addOption($name, $options = array()) {
if (is_object($name) && $name instanceof ConsoleInputOption) {
$option = $name;
$name = $option->name();
@ -280,7 +279,7 @@ class ConsoleOptionParser {
'boolean' => false,
'choices' => array()
);
$options = array_merge($defaults, $params);
$options = array_merge($defaults, $options);
$option = new ConsoleInputOption($options);
}
$this->_options[$name] = $option;
@ -303,7 +302,7 @@ class ConsoleOptionParser {
* - `choices` A list of valid choices for this argument. If left empty all values are valid..
* An exception will be raised when parse() encounters an invalid value.
*
* @param string $name The name of the argument.
* @param mixed $name The name of the argument. Will also accept an instance of ConsoleInputArgument
* @param array $params Parameters for the argument, see above.
* @return $this.
*/
@ -360,21 +359,20 @@ class ConsoleOptionParser {
/**
* Append a subcommand to the subcommand list.
* Subcommands are usually methods on your Shell, but can also be used to document
* Tasks
* Subcommands are usually methods on your Shell, but can also be used to document Tasks.
*
* ### Params
* ### Options
*
* - `help` - Help text for the subcommand.
* - `parser` - A ConsoleOptionParser for the subcommand. This allows you to create method
* specific option parsers. When help is generated for a subcommand, if a parser is present
* it will be used.
*
* @param string $name Name of the subcommand
* @param mixed $name Name of the subcommand. Will also accept an instance of ConsoleInputSubcommand
* @param array $params Array of params, see above.
* @return $this.
*/
public function addSubcommand($name, $params = array()) {
public function addSubcommand($name, $options = array()) {
if (is_object($name) && $name instanceof ConsoleInputSubcommand) {
$command = $name;
$name = $command->name();
@ -384,7 +382,7 @@ class ConsoleOptionParser {
'help' => '',
'parser' => null
);
$options = array_merge($defaults, $params);
$options = array_merge($defaults, $options);
$command = new ConsoleInputSubcommand($options);
}
$this->_subcommands[$name] = $command;

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -21,7 +20,7 @@
* Object wrapper for outputing information from a shell application.
* Can be connected to any stream resource that can be used with fopen()
*
* Can generate colourzied output on consoles that support it. There are a few
* Can generate colourized output on consoles that support it. There are a few
* built in styles
*
* - `error` Error messages.
@ -42,7 +41,7 @@
* See ConsoleOutput::styles() to learn more about defining your own styles. Nested styles are not supported
* at this time.
*
* @package cake.console
* @package cake.console.libs
*/
class ConsoleOutput {
/**
@ -144,7 +143,7 @@ class ConsoleOutput {
* Checks for a pretty console enviornment. Ansicon allows pretty consoles
* on windows, and is supported.
*
* @return void
* @param string $stream The identifier of the stream to write output to.
*/
public function __construct($stream = 'php://stdout') {
$this->_output = fopen($stream, 'w');
@ -156,7 +155,7 @@ class ConsoleOutput {
/**
* Outputs a single or multiple messages to stdout. If no parameters
* are passed outputs just a newline.
* are passed, outputs just a newline.
*
* @param mixed $message A string or a an array of strings to output
* @param integer $newlines Number of newlines to append
@ -216,7 +215,7 @@ class ConsoleOutput {
}
/**
* Writes a message to the output stream
* Writes a message to the output stream.
*
* @param string $message Message to write.
* @return boolean success

View file

@ -12,9 +12,6 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('String', 'Utility');
@ -28,12 +25,14 @@ App::uses('String', 'Utility');
*
* Xml output is useful for intergration with other tools like IDE's or other build tools.
*
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
*/
class HelpFormatter {
/**
* Build the help formatter for a an OptionParser
*
* @return void
* @param ConsoleOptionParser $parser The option parser help is being generated for.
*/
public function __construct(ConsoleOptionParser $parser) {
$this->_parser = $parser;

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -27,8 +26,7 @@ App::uses('ConsoleOptionParser', 'Console');
/**
* Base class for command-line utilities for automating programmer chores.
*
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.shells
*/
class Shell extends Object {
@ -222,6 +220,7 @@ class Shell extends Object {
if ($this->uses === null || $this->uses === false) {
return;
}
App::import('Core', 'ClassRegistry');
if ($this->uses !== true && !empty($this->uses)) {
$uses = is_array($this->uses) ? $this->uses : array($this->uses);

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package cake.console
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -21,8 +20,7 @@
/**
* Shell dispatcher handles dispatching cli commands.
*
* @package cake
* @subpackage cake.cake.console
* @package cake.console
*/
class ShellDispatcher {

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
#
# @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
# @link http://cakephp.org CakePHP(tm) Project
# @package cake
# @subpackage cake.cake.console
# @package cake.console
# @since CakePHP(tm) v 1.2.0.5012
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#

View file

@ -11,8 +11,7 @@
::
:: @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
:: @link http://cakephp.org CakePHP(tm) Project
:: @package cake
:: @subpackage cake.cake.console
:: @package cake.console
:: @since CakePHP(tm) v 1.2.0.5012
:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
::

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package cake.console
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.console.libs.template.objects
* @package cake.console.libs.template.objects
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -86,7 +85,7 @@
<?php endif; ?>
}
} else {
$this->data = $this-><?php echo $currentModelName; ?>->read(null, $id);
$this->request->data = $this-><?php echo $currentModelName; ?>->read(null, $id);
}
<?php
foreach (array('belongsTo', 'hasAndBelongsToMany') as $assoc):

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.
* @package cake.
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.
* @package cake.
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.console.libs.templates.objects
* @package cake.console.libs.templates.objects
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -13,8 +13,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.console.libs.templates.objects
* @package cake.console.libs.templates.objects
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @package cake.console.libs.templates.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -20,7 +19,7 @@
<div class="<?php echo $pluralVar;?> form">
<?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?>
<fieldset>
<legend><?php printf("<?php __('%s %s', true); ?>", Inflector::humanize($action), $singularHumanName); ?></legend>
<legend><?php printf("<?php __('%s %s'); ?>", Inflector::humanize($action), $singularHumanName); ?></legend>
<?php
echo "\t<?php\n";
foreach ($fields as $field) {

View file

@ -2,6 +2,7 @@
$output = "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
$output .="
<?php
App::import('Core', 'Debugger');
if (Configure::read() > 0):
Debugger::checkSecurityKeys();
endif;

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @package cake.console.libs.templates.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @package cake.console.libs.templates.views
* @since CakePHP(tm) v 1.2.0.5234
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app
* @package app
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -27,8 +26,7 @@
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package cake
* @subpackage cake.app
* @package app
*/
class AppController extends Controller {
}

View file

@ -15,8 +15,6 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -29,8 +27,7 @@ App::uses('Helper', 'Helper');
* Add your application-wide methods in the class below, your helpers
* will inherit them.
*
* @package cake
* @subpackage cake.cake
* @package cake.libs.view.helpers
*/
class AppHelper extends Helper {
}

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app
* @package app
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -27,8 +26,7 @@
* Add your application-wide methods in the class below, your models
* will inherit them.
*
* @package cake
* @subpackage cake.app
* @package app
*/
class AppModel extends Model {
}

View file

@ -14,8 +14,7 @@
; *
; * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
; * @link http://cakephp.org CakePHP(tm) Project
; * @package cake
; * @subpackage cake.app.config
; * @package app.config
; * @since CakePHP(tm) v 0.10.0.1076
; * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
; */

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @package app.config
* @since CakePHP(tm) v 0.10.8.2117
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @package app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,16 +14,14 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @package app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* In this file you set up your database connection details.
*
* @package cake
* @subpackage cake.config
* @package cake.config
*/
/**
* Database configuration class.

View file

@ -16,8 +16,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @package app.config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -16,8 +16,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @package app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -16,8 +16,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @package app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -16,8 +16,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config.sql
* @package app.config.sql
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
#
# @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
# @link http://cakephp.org CakePHP(tm) Project
# @package cake
# @subpackage cake.app.console
# @package app.console
# @since CakePHP(tm) v 2.0
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#

View file

@ -11,8 +11,7 @@
::
:: @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
:: @link http://cakephp.org CakePHP(tm) Project
:: @package cake
:: @subpackage cake.app.console
:: @package app.console
:: @since CakePHP(tm) v 2.0
:: @license MIT License (http://www.opensource.org/licenses/mit-license.php)
::

View file

@ -15,8 +15,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console
* @package app.console
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller
* @package cake.libs.controller
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -25,8 +24,7 @@
*
* Override this controller by placing a copy in controllers directory of an application
*
* @package cake
* @subpackage cake.cake.libs.controller
* @package cake.libs.controller
*/
class PagesController extends AppController {

View file

@ -10,8 +10,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app
* @package app
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view.templates.elements.email.html
* @package cake.libs.view.templates.elements.email.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view.templates.elements.email.text
* @package cake.libs.view.templates.elements.email.text
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts
* @package cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.skel.views.layouts
* @package cake.console.libs.templates.skel.views.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts.email.html
* @package cake.libs.view.templates.layouts.email.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts.email.text
* @package cake.libs.view.templates.layouts.email.text
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -11,8 +11,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts
* @package cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -12,8 +12,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.webroot
* @package app.webroot
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -10,8 +10,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.webroot.css
* @package app.webroot.css
* @since CakePHP(tm)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

View file

@ -14,8 +14,7 @@
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.webroot
* @package app.webroot
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

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