mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
Fixing strict errors that were causing shell tests to fail.
Fixing test case for bake test that has been getting skipped.
This commit is contained in:
parent
017385d61c
commit
f84871ae47
4 changed files with 15 additions and 30 deletions
|
@ -186,7 +186,7 @@ class BakeShell extends Shell {
|
|||
} else {
|
||||
$this->error(__('Bake All could not continue without a valid model'));
|
||||
}
|
||||
$this->_stop();
|
||||
return $this->_stop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -701,7 +701,7 @@ class ModelTask extends BakeTask {
|
|||
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') {
|
||||
|
|
|
@ -240,10 +240,8 @@ class Folder {
|
|||
*
|
||||
* @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) == '\\\\');
|
||||
}
|
||||
|
||||
|
@ -252,10 +250,8 @@ class Folder {
|
|||
*
|
||||
* @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) == '\\\\');
|
||||
}
|
||||
|
||||
|
@ -264,10 +260,8 @@ class Folder {
|
|||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -276,10 +270,8 @@ class Folder {
|
|||
*
|
||||
* @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)) ? '\\' : '/';
|
||||
}
|
||||
|
||||
|
@ -288,10 +280,8 @@ class Folder {
|
|||
*
|
||||
* @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;
|
||||
}
|
||||
|
@ -304,10 +294,8 @@ class Folder {
|
|||
* @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;
|
||||
}
|
||||
|
||||
|
@ -755,10 +743,8 @@ class Folder {
|
|||
*
|
||||
* @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 === '\\';
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
@ -94,12 +94,11 @@ class BakeShellTest extends CakeTestCase {
|
|||
$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();
|
||||
|
|
Loading…
Add table
Reference in a new issue