Skip to content

Commit

Permalink
Fixing strict errors that were causing shell tests to fail.
Browse files Browse the repository at this point in the history
Fixing test case for bake test that has been getting skipped.
  • Loading branch information
markstory committed Dec 13, 2010
1 parent 017385d commit f84871a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cake/console/shells/bake.php
Expand Up @@ -186,7 +186,7 @@ public function all() {
} else {
$this->error(__('Bake All could not continue without a valid model'));
}
$this->_stop();
return $this->_stop();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion cake/console/shells/tasks/model.php
Expand Up @@ -701,7 +701,7 @@ public function doMoreAssociations($model, $associations) {
protected function _generatePossibleKeys() {
$possible = array();
foreach ($this->_tables as $otherTable) {
$tempOtherModel = & new Model(array('table' => $otherTable, 'ds' => $this->connection));
$tempOtherModel = new Model(array('table' => $otherTable, 'ds' => $this->connection));
$modelFieldsTemp = $tempOtherModel->schema(true);
foreach ($modelFieldsTemp as $fieldName => $field) {
if ($field['type'] == 'integer' || $field['type'] == 'string') {
Expand Down
28 changes: 7 additions & 21 deletions cake/libs/folder.php
Expand Up @@ -240,10 +240,8 @@ function _findRecursive($pattern, $sort = false) {
*
* @param string $path Path to check
* @return boolean true if windows path, false otherwise
* @access public
* @static
*/
function isWindowsPath($path) {
public static function isWindowsPath($path) {
return (preg_match('/^[A-Z]:\\\\/i', $path) || substr($path, 0, 2) == '\\\\');
}

Expand All @@ -252,10 +250,8 @@ function isWindowsPath($path) {
*
* @param string $path Path to check
* @return bool true if path is absolute.
* @access public
* @static
*/
function isAbsolute($path) {
public static function isAbsolute($path) {
return !empty($path) && ($path[0] === '/' || preg_match('/^[A-Z]:\\\\/i', $path) || substr($path, 0, 2) == '\\\\');
}

Expand All @@ -264,10 +260,8 @@ function isAbsolute($path) {
*
* @param string $path Path to check
* @return string Set of slashes ("\\" or "/")
* @access public
* @static
*/
function normalizePath($path) {
public static function normalizePath($path) {
return Folder::correctSlashFor($path);
}

Expand All @@ -276,10 +270,8 @@ function normalizePath($path) {
*
* @param string $path Path to check
* @return string Set of slashes ("\\" or "/")
* @access public
* @static
*/
function correctSlashFor($path) {
public static function correctSlashFor($path) {
return (Folder::isWindowsPath($path)) ? '\\' : '/';
}

Expand All @@ -288,10 +280,8 @@ function correctSlashFor($path) {
*
* @param string $path Path to check
* @return string Path with ending slash
* @access public
* @static
*/
function slashTerm($path) {
public static function slashTerm($path) {
if (Folder::isSlashTerm($path)) {
return $path;
}
Expand All @@ -304,10 +294,8 @@ function slashTerm($path) {
* @param string $path Path
* @param string $element Element to and at end of path
* @return string Combined path
* @access public
* @static
*/
function addPathElement($path, $element) {
public static function addPathElement($path, $element) {
return rtrim($path, DS) . DS . $element;
}

Expand Down Expand Up @@ -755,10 +743,8 @@ function realpath($path) {
*
* @param string $path Path to check
* @return boolean true if path ends with slash, false otherwise
* @access public
* @static
*/
function isSlashTerm($path) {
public static function isSlashTerm($path) {
$lastChar = $path[strlen($path) - 1];
return $lastChar === '/' || $lastChar === '\\';
}
Expand Down
13 changes: 6 additions & 7 deletions cake/tests/cases/console/shells/bake.test.php
Expand Up @@ -20,9 +20,9 @@
*/
App::import('Shell', 'Shell', false);
App::import('Shell', 'Bake', false);
App::import('Shell', 'tasks/model', false);
App::import('Shell', 'tasks/controller', false);
App::import('Shell', 'tasks/db_config', false);
App::import('Shell', 'tasks/model');
App::import('Shell', 'tasks/controller');
App::import('Shell', 'tasks/db_config');

App::import('Core', 'Controller');
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
Expand Down Expand Up @@ -94,12 +94,11 @@ public function testAllWithModelName() {
$this->Shell->Controller->expects($this->once())->method('bake')->will($this->returnValue(true));
$this->Shell->View->expects($this->once())->method('execute');

$this->Shell->expects($this->at(1))->method('out')->with('Bake All');
$this->Shell->expects($this->at(3))->method('out')->with('User Model was baked.');
$this->Shell->expects($this->once())->method('_stop');
$this->Shell->expects($this->at(0))->method('out')->with('Bake All');
$this->Shell->expects($this->at(5))->method('out')->with('<success>Bake All complete</success>');
$this->Shell->expects($this->at(7))->method('out')->with('User Views were baked.');
$this->Shell->expects($this->at(8))->method('out')->with('Bake All complete');

$this->Shell->connection = '';
$this->Shell->params = array();
$this->Shell->args = array('User');
$this->Shell->all();
Expand Down

0 comments on commit f84871a

Please sign in to comment.