Code standards formatting

This commit is contained in:
Kyle Robinson Young 2011-12-15 22:52:07 -08:00
parent f1b566b88e
commit 51f9837db4
58 changed files with 220 additions and 213 deletions

View file

@ -101,7 +101,7 @@ class ApiShell extends AppShell {
$this->_stop(); $this->_stop();
} }
$method = $parsed[$this->params['method']]; $method = $parsed[$this->params['method']];
$this->out($class .'::'.$method['method'] . $method['parameters']); $this->out($class . '::' . $method['method'] . $method['parameters']);
$this->hr(); $this->hr();
$this->out($method['comment'], true); $this->out($method['comment'], true);
} else { } else {
@ -127,7 +127,7 @@ class ApiShell extends AppShell {
if (isset($methods[--$number])) { if (isset($methods[--$number])) {
$method = $parsed[$methods[$number]]; $method = $parsed[$methods[$number]];
$this->hr(); $this->hr();
$this->out($class .'::'.$method['method'] . $method['parameters']); $this->out($class . '::' . $method['method'] . $method['parameters']);
$this->hr(); $this->hr();
$this->out($method['comment'], true); $this->out($method['comment'], true);
} }

View file

@ -269,7 +269,7 @@ class ProjectTask extends AppShell {
$contents = $File->read(); $contents = $File->read();
if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) { if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
$string = Security::generateAuthKey(); $string = Security::generateAuthKey();
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \''.$string.'\');', $contents); $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \'' . $string . '\');', $contents);
if ($File->write($result)) { if ($File->write($result)) {
return true; return true;
} }
@ -290,7 +290,7 @@ class ProjectTask extends AppShell {
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) { if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
App::uses('Security', 'Utility'); App::uses('Security', 'Utility');
$string = substr(bin2hex(Security::generateAuthKey()), 0, 30); $string = substr(bin2hex(Security::generateAuthKey()), 0, 30);
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents); $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \'' . $string . '\');', $contents);
if ($File->write($result)) { if ($File->write($result)) {
return true; return true;
} }
@ -357,7 +357,7 @@ class ProjectTask extends AppShell {
$File = new File($path . 'core.php'); $File = new File($path . 'core.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) { if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {
$result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\''.$name.'\'));', $contents); $result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\'' . $name . '\'));', $contents);
if ($File->write($result)) { if ($File->write($result)) {
Configure::write('Routing.prefixes', array($name)); Configure::write('Routing.prefixes', array($name));
return true; return true;

View file

@ -488,11 +488,11 @@ class DbAcl extends Object implements AclInterface {
} }
return array( return array(
'aro' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'), 'aro' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'),
'aco' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id'), 'aco' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'),
'link' => $this->Aro->Permission->find('all', array('conditions' => array( 'link' => $this->Aro->Permission->find('all', array('conditions' => array(
$this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'), $this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'),
$this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id') $this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id')
))) )))
); );
} }

View file

@ -981,7 +981,7 @@ class Controller extends Object {
$arrayOp = is_array($op); $arrayOp = is_array($op);
foreach ($data as $model => $fields) { foreach ($data as $model => $fields) {
foreach ($fields as $field => $value) { foreach ($fields as $field => $value) {
$key = $model.'.'.$field; $key = $model . '.' . $field;
$fieldOp = $op; $fieldOp = $op;
if ($arrayOp) { if ($arrayOp) {
if (array_key_exists($key, $op)) { if (array_key_exists($key, $op)) {
@ -998,9 +998,9 @@ class Controller extends Object {
$fieldOp = strtoupper(trim($fieldOp)); $fieldOp = strtoupper(trim($fieldOp));
if ($fieldOp === 'LIKE') { if ($fieldOp === 'LIKE') {
$key = $key.' LIKE'; $key = $key.' LIKE';
$value = '%'.$value.'%'; $value = '%' . $value . '%';
} elseif ($fieldOp && $fieldOp != '=') { } elseif ($fieldOp && $fieldOp != '=') {
$key = $key.' '.$fieldOp; $key = $key.' ' . $fieldOp;
} }
$cond[$key] = $value; $cond[$key] = $value;
} }

View file

@ -656,7 +656,7 @@ class App {
} }
App::uses($extends, $extendType); App::uses($extends, $extendType);
if ($plugin && in_array($originalType, array('controller', 'model'))) { if ($plugin && in_array($originalType, array('controller', 'model'))) {
App::uses($plugin . $extends, $plugin . '.' .$type); App::uses($plugin . $extends, $plugin . '.' . $type);
} }
} }
if ($plugin) { if ($plugin) {

View file

@ -164,7 +164,7 @@ class I18n {
} }
if ($_this->category == 'LC_TIME') { if ($_this->category == 'LC_TIME') {
return $_this->_translateTime($singular,$domain); return $_this->_translateTime($singular, $domain);
} }
if (!isset($count)) { if (!isset($count)) {
@ -466,7 +466,7 @@ class I18n {
} while (!feof($file)); } while (!feof($file));
fclose($file); fclose($file);
$merge[""] = $header; $merge[""] = $header;
return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge ,$translations); return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge, $translations);
} }
/** /**
@ -486,7 +486,7 @@ class I18n {
if (empty($line) || $line[0] === $comment) { if (empty($line) || $line[0] === $comment) {
continue; continue;
} }
$parts = preg_split("/[[:space:]]+/",$line); $parts = preg_split("/[[:space:]]+/", $line);
if ($parts[0] === 'comment_char') { if ($parts[0] === 'comment_char') {
$comment = $parts[1]; $comment = $parts[1];
continue; continue;

View file

@ -893,7 +893,7 @@ class Multibyte {
* @param string $haystack The string being checked. * @param string $haystack The string being checked.
* @param string $needle The string being found. * @param string $needle The string being found.
* @return integer The number of times the $needle substring occurs in the $haystack string. * @return integer The number of times the $needle substring occurs in the $haystack string.
*/ */
public static function substrCount($haystack, $needle) { public static function substrCount($haystack, $needle) {
$count = 0; $count = 0;
$haystack = Multibyte::utf8($haystack); $haystack = Multibyte::utf8($haystack);

View file

@ -308,10 +308,10 @@ class ContainableBehavior extends ModelBehavior {
$val = preg_split('/\s*,\s*/', substr(substr($key, 1), 0, -1)); $val = preg_split('/\s*,\s*/', substr(substr($key, 1), 0, -1));
} elseif (preg_match('/ASC|DESC$/', $key)) { } elseif (preg_match('/ASC|DESC$/', $key)) {
$option = 'order'; $option = 'order';
$val = $Model->{$name}->alias.'.'.$key; $val = $Model->{$name}->alias . '.' . $key;
} elseif (preg_match('/[ =!]/', $key)) { } elseif (preg_match('/[ =!]/', $key)) {
$option = 'conditions'; $option = 'conditions';
$val = $Model->{$name}->alias.'.'.$key; $val = $Model->{$name}->alias . '.' . $key;
} }
$children[$option] = is_array($val) ? $val : array($val); $children[$option] = is_array($val) ? $val : array($val);
$newChildren = null; $newChildren = null;

View file

@ -103,8 +103,8 @@ class TranslateBehavior extends ModelBehavior {
$joinTable->tablePrefix = $tablePrefix; $joinTable->tablePrefix = $tablePrefix;
$joinTable->table = $RuntimeModel->table; $joinTable->table = $RuntimeModel->table;
if (is_string($query['fields']) && 'COUNT(*) AS '.$db->name('count') == $query['fields']) { if (is_string($query['fields']) && 'COUNT(*) AS ' . $db->name('count') == $query['fields']) {
$query['fields'] = 'COUNT(DISTINCT('.$db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count'; $query['fields'] = 'COUNT(DISTINCT(' . $db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count';
$query['joins'][] = array( $query['joins'][] = array(
'type' => 'INNER', 'type' => 'INNER',
'alias' => $RuntimeModel->alias, 'alias' => $RuntimeModel->alias,
@ -126,7 +126,7 @@ class TranslateBehavior extends ModelBehavior {
foreach ($fields as $key => $value) { foreach ($fields as $key => $value) {
$field = (is_numeric($key)) ? $value : $key; $field = (is_numeric($key)) ? $value : $key;
if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.'.$field, $query['fields']) || in_array($field, $query['fields'])) { if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.' . $field, $query['fields']) || in_array($field, $query['fields'])) {
$addFields[] = $field; $addFields[] = $field;
} }
} }
@ -137,7 +137,7 @@ class TranslateBehavior extends ModelBehavior {
foreach ($addFields as $_f => $field) { foreach ($addFields as $_f => $field) {
$aliasField = is_numeric($_f) ? $field : $_f; $aliasField = is_numeric($_f) ? $field : $_f;
foreach (array($aliasField, $model->alias.'.'.$aliasField) as $_field) { foreach (array($aliasField, $model->alias . '.' . $aliasField) as $_field) {
$key = array_search($_field, (array)$query['fields']); $key = array_search($_field, (array)$query['fields']);
if ($key !== false) { if ($key !== false) {
@ -147,36 +147,36 @@ class TranslateBehavior extends ModelBehavior {
if (is_array($locale)) { if (is_array($locale)) {
foreach ($locale as $_locale) { foreach ($locale as $_locale) {
$model->virtualFields['i18n_'.$field.'_'.$_locale] = 'I18n__'.$field.'__'.$_locale.'.content'; $model->virtualFields['i18n_' . $field . '_' . $_locale] = 'I18n__' . $field . '__' . $_locale . '.content';
if (!empty($query['fields'])) { if (!empty($query['fields'])) {
$query['fields'][] = 'i18n_'.$field.'_'.$_locale; $query['fields'][] = 'i18n_' . $field . '_' . $_locale;
} }
$query['joins'][] = array( $query['joins'][] = array(
'type' => 'LEFT', 'type' => 'LEFT',
'alias' => 'I18n__'.$field.'__'.$_locale, 'alias' => 'I18n__' . $field . '__' . $_locale,
'table' => $joinTable, 'table' => $joinTable,
'conditions' => array( 'conditions' => array(
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"), $model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"),
'I18n__'.$field.'__'.$_locale.'.model' => $model->name, 'I18n__' . $field . '__' . $_locale . '.model' => $model->name,
'I18n__'.$field.'__'.$_locale.'.'.$RuntimeModel->displayField => $aliasField, 'I18n__' . $field . '__' . $_locale . '.' . $RuntimeModel->displayField => $aliasField,
'I18n__'.$field.'__'.$_locale.'.locale' => $_locale 'I18n__' . $field . '__' . $_locale . '.locale' => $_locale
) )
); );
} }
} else { } else {
$model->virtualFields['i18n_'.$field] = 'I18n__'.$field.'.content'; $model->virtualFields['i18n_' . $field] = 'I18n__' . $field . '.content';
if (!empty($query['fields'])) { if (!empty($query['fields'])) {
$query['fields'][] = 'i18n_'.$field; $query['fields'][] = 'i18n_' . $field;
} }
$query['joins'][] = array( $query['joins'][] = array(
'type' => 'INNER', 'type' => 'INNER',
'alias' => 'I18n__'.$field, 'alias' => 'I18n__' . $field,
'table' => $joinTable, 'table' => $joinTable,
'conditions' => array( 'conditions' => array(
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"), $model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"),
'I18n__'.$field.'.model' => $model->name, 'I18n__' . $field . '.model' => $model->name,
'I18n__'.$field.'.'.$RuntimeModel->displayField => $aliasField, 'I18n__' . $field . '.' . $RuntimeModel->displayField => $aliasField,
'I18n__'.$field.'.locale' => $locale 'I18n__' . $field . '.locale' => $locale
) )
); );
} }
@ -211,11 +211,11 @@ class TranslateBehavior extends ModelBehavior {
if (is_array($locale)) { if (is_array($locale)) {
foreach ($locale as $_locale) { foreach ($locale as $_locale) {
if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_'.$field.'_'.$_locale])) { if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_' . $field . '_' . $_locale])) {
$row[$model->alias][$aliasField] = $row[$model->alias]['i18n_'.$field.'_'.$_locale]; $row[$model->alias][$aliasField] = $row[$model->alias]['i18n_' . $field . '_' . $_locale];
$row[$model->alias]['locale'] = $_locale; $row[$model->alias]['locale'] = $_locale;
} }
unset($row[$model->alias]['i18n_'.$field.'_'.$_locale]); unset($row[$model->alias]['i18n_' . $field . '_' . $_locale]);
} }
if (!isset($row[$model->alias][$aliasField])) { if (!isset($row[$model->alias][$aliasField])) {

View file

@ -163,8 +163,8 @@ class TreeBehavior extends ModelBehavior {
$this->_addToWhitelist($Model, $parent); $this->_addToWhitelist($Model, $parent);
} else { } else {
$values = $Model->find('first', array( $values = $Model->find('first', array(
'conditions' => array($scope,$Model->escapeField() => $Model->id), 'conditions' => array($scope, $Model->escapeField() => $Model->id),
'fields' => array($Model->primaryKey, $parent, $left, $right ), 'recursive' => $recursive) 'fields' => array($Model->primaryKey, $parent, $left, $right), 'recursive' => $recursive)
); );
if ($values === false) { if ($values === false) {
@ -503,7 +503,7 @@ class TreeBehavior extends ModelBehavior {
extract($this->settings[$Model->alias]); extract($this->settings[$Model->alias]);
list($node) = array_values($Model->find('first', array( list($node) = array_values($Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $id), 'conditions' => array($scope, $Model->escapeField() => $id),
'fields' => array($Model->primaryKey, $left, $right, $parent ), 'recursive' => $recursive 'fields' => array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive
))); )));
if ($node[$parent]) { if ($node[$parent]) {
list($parentNode) = array_values($Model->find('first', array( list($parentNode) = array_values($Model->find('first', array(
@ -527,7 +527,7 @@ class TreeBehavior extends ModelBehavior {
} }
$edge = $this->_getMax($Model, $scope, $right, $recursive); $edge = $this->_getMax($Model, $scope, $right, $recursive);
$this->_sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]); $this->_sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]);
$this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' .$node[$left] . ' AND ' . $node[$right]); $this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
$this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge); $this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge);
if (is_int($number)) { if (is_int($number)) {
$number--; $number--;

View file

@ -412,7 +412,7 @@ class Postgres extends DboSource {
$match[1] = $this->name($match[1]); $match[1] = $this->name($match[1]);
} }
} }
return '(' . $prepend .$match[1] . ')'; return '(' . $prepend . $match[1] . ')';
} }
/** /**
@ -480,13 +480,13 @@ class Postgres extends DboSource {
case 'add': case 'add':
foreach ($column as $field => $col) { foreach ($column as $field => $col) {
$col['name'] = $field; $col['name'] = $field;
$colList[] = 'ADD COLUMN '.$this->buildColumn($col); $colList[] = 'ADD COLUMN ' . $this->buildColumn($col);
} }
break; break;
case 'drop': case 'drop':
foreach ($column as $field => $col) { foreach ($column as $field => $col) {
$col['name'] = $field; $col['name'] = $field;
$colList[] = 'DROP COLUMN '.$this->name($field); $colList[] = 'DROP COLUMN ' . $this->name($field);
} }
break; break;
case 'change': case 'change':

View file

@ -238,7 +238,7 @@ class Sqlite extends DboSource {
if (is_array($real)) { if (is_array($real)) {
$col = $real['name']; $col = $real['name'];
if (isset($real['limit'])) { if (isset($real['limit'])) {
$col .= '('.$real['limit'].')'; $col .= '(' . $real['limit'] . ')';
} }
return $col; return $col;
} }

View file

@ -302,7 +302,7 @@ class Sqlserver extends DboSource {
$fieldAlias = $this->name($alias . '__' . $fields[$i]); $fieldAlias = $this->name($alias . '__' . $fields[$i]);
} else { } else {
$build = explode('.', $fields[$i]); $build = explode('.', $fields[$i]);
$this->_fieldMappings[$build[0] . '__' .$build[1]] = $fields[$i]; $this->_fieldMappings[$build[0] . '__' . $build[1]] = $fields[$i];
$fieldName = $this->name($build[0] . '.' . $build[1]); $fieldName = $this->name($build[0] . '.' . $build[1]);
$fieldAlias = $this->name(preg_replace("/^\[(.+)\]$/", "$1", $build[0]) . '__' . $build[1]); $fieldAlias = $this->name(preg_replace("/^\[(.+)\]$/", "$1", $build[0]) . '__' . $build[1]);
} }

View file

@ -787,7 +787,7 @@ class DboSource extends DataSource {
} }
return $data; return $data;
} }
$cacheKey = crc32($this->startQuote.$data.$this->endQuote); $cacheKey = crc32($this->startQuote . $data . $this->endQuote);
if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) { if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) {
return $return; return $return;
} }

View file

@ -2417,7 +2417,7 @@ class Model extends Object {
* Queries the datasource and returns a result set array. * Queries the datasource and returns a result set array.
* *
* Also used to perform notation finds, where the first argument is type of find operation to perform * Also used to perform notation finds, where the first argument is type of find operation to perform
* (all / first / count / neighbors / list / threaded ), * (all / first / count / neighbors / list / threaded),
* second parameter options for finding ( indexed array, including: 'conditions', 'limit', * second parameter options for finding ( indexed array, including: 'conditions', 'limit',
* 'recursive', 'page', 'fields', 'offset', 'order') * 'recursive', 'page', 'fields', 'offset', 'order')
* *

View file

@ -372,7 +372,7 @@ class CakeResponse {
$this->_headers['Content-Length'] = $offset + strlen($this->_body); $this->_headers['Content-Length'] = $offset + strlen($this->_body);
} }
} }
} }
/** /**
* Sends a header to the client. * Sends a header to the client.

View file

@ -106,9 +106,9 @@ class CakeSocket {
} }
if ($this->config['persistent'] == true) { if ($this->config['persistent'] == true) {
$this->connection = @pfsockopen($scheme.$this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); $this->connection = @pfsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
} else { } else {
$this->connection = @fsockopen($scheme.$this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); $this->connection = @fsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
} }
if (!empty($errNum) || !empty($errStr)) { if (!empty($errNum) || !empty($errStr)) {

View file

@ -169,11 +169,11 @@ class MemcacheEngineTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
function testParseServerStringUnix() { function testParseServerStringUnix() {
$Memcache =& new TestMemcacheEngine(); $Memcache =& new TestMemcacheEngine();
$result = $Memcache->parseServerString('unix:///path/to/memcached.sock'); $result = $Memcache->parseServerString('unix:///path/to/memcached.sock');
$this->assertEquals($result, array('unix:///path/to/memcached.sock', 0)); $this->assertEquals($result, array('unix:///path/to/memcached.sock', 0));
} }
/** /**
* testReadAndWriteCache method * testReadAndWriteCache method

View file

@ -289,9 +289,9 @@ class AclShellTest extends CakeTestCase {
$first = $node[0]['Aro']['id']; $first = $node[0]['Aro']['id'];
$second = $node[1]['Aro']['id']; $second = $node[1]['Aro']['id'];
$last = $node[2]['Aro']['id']; $last = $node[2]['Aro']['id'];
$this->Task->expects($this->at(2))->method('out')->with('['.$last.'] ROOT'); $this->Task->expects($this->at(2))->method('out')->with('[' . $last . '] ROOT');
$this->Task->expects($this->at(3))->method('out')->with(' ['.$second.'] admins'); $this->Task->expects($this->at(3))->method('out')->with(' [' . $second . '] admins');
$this->Task->expects($this->at(4))->method('out')->with(' ['.$first.'] Elrond'); $this->Task->expects($this->at(4))->method('out')->with(' [' . $first . '] Elrond');
$this->Task->getPath(); $this->Task->getPath();
} }

View file

@ -329,10 +329,10 @@ class ExtractTaskTest extends CakeTestCase {
$this->Task->execute(); $this->Task->execute();
$result = file_get_contents($this->path . DS . 'test_plugin.pot'); $result = file_get_contents($this->path . DS . 'test_plugin.pot');
$pattern = preg_quote('#Plugin' . DS. 'TestPlugin' . DS. 'Model' . DS. 'TestPluginPost.php:validation for field title#', '\\'); $pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field title#', '\\');
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
$pattern = preg_quote('#Plugin' . DS. 'TestPlugin' . DS. 'Model' . DS. 'TestPluginPost.php:validation for field body#', '\\'); $pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
$pattern = '#msgid "Post title is required"#'; $pattern = '#msgid "Post title is required"#';
@ -369,10 +369,10 @@ class ExtractTaskTest extends CakeTestCase {
$this->Task->execute(); $this->Task->execute();
$result = file_get_contents($this->path . DS . 'test_plugin.pot'); $result = file_get_contents($this->path . DS . 'test_plugin.pot');
$pattern = preg_quote('#Model' . DS. 'TestPluginPost.php:validation for field title#', '\\'); $pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field title#', '\\');
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
$pattern = preg_quote('#Model' . DS. 'TestPluginPost.php:validation for field body#', '\\'); $pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
$pattern = '#msgid "Post title is required"#'; $pattern = '#msgid "Post title is required"#';

View file

@ -948,7 +948,7 @@ STRINGEND;
* *
* @return void * @return void
*/ */
public function testExecuteIntoAllOddTables() { public function testExecuteIntoAllOddTables() {
$out = $this->getMock('ConsoleOutput', array(), array(), '', false); $out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false); $in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ModelTask', $this->Task = $this->getMock('ModelTask',
@ -1003,7 +1003,7 @@ STRINGEND;
* *
* @return void * @return void
*/ */
public function testExecuteIntoBakeOddTables() { public function testExecuteIntoBakeOddTables() {
$out = $this->getMock('ConsoleOutput', array(), array(), '', false); $out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false); $in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ModelTask', $this->Task = $this->getMock('ModelTask',

View file

@ -301,7 +301,7 @@ class ProjectTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testExecute() { public function testExecute() {
$this->Task->params['skel'] = CAKE . 'Console' . DS. 'Templates' . DS . 'skel'; $this->Task->params['skel'] = CAKE . 'Console' . DS . 'Templates' . DS . 'skel';
$this->Task->params['working'] = TMP . 'tests' . DS; $this->Task->params['working'] = TMP . 'tests' . DS;
$path = $this->Task->path . 'bake_test_app'; $path = $this->Task->path . 'bake_test_app';

View file

@ -380,8 +380,8 @@ class ShellTest extends CakeTestCase {
$bar = '---------------------------------------------------------------'; $bar = '---------------------------------------------------------------';
$this->Shell->stdout->expects($this->at(0))->method('write')->with('', 0); $this->Shell->stdout->expects($this->at(0))->method('write')->with('', 0);
$this->Shell->stdout->expects($this->at(1))->method('write')->with($bar, 1); $this->Shell->stdout->expects($this->at(1))->method('write')->with($bar, 1);
$this->Shell->stdout->expects($this->at(2))->method('write')->with('', 0); $this->Shell->stdout->expects($this->at(2))->method('write')->with('', 0);
$this->Shell->stdout->expects($this->at(3))->method('write')->with("", true); $this->Shell->stdout->expects($this->at(3))->method('write')->with("", true);
$this->Shell->stdout->expects($this->at(4))->method('write')->with($bar, 1); $this->Shell->stdout->expects($this->at(4))->method('write')->with($bar, 1);

View file

@ -817,7 +817,7 @@ class AuthComponentTest extends CakeTestCase {
$expected = Router::normalize('posts/view/1'); $expected = Router::normalize('posts/view/1');
$this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect')); $this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect'));
// QueryString parameters // QueryString parameters
$_back = $_GET; $_back = $_GET;
$_GET = array( $_GET = array(
'print' => 'true', 'print' => 'true',

View file

@ -90,18 +90,18 @@ class TestScaffoldMock extends Scaffold {
* *
* @param unknown_type $params * @param unknown_type $params
*/ */
function _scaffold(CakeRequest $request) { function _scaffold(CakeRequest $request) {
$this->_params = $request; $this->_params = $request;
} }
/** /**
* Get Params from the Controller. * Get Params from the Controller.
* *
* @return unknown * @return unknown
*/ */
function getParams() { function getParams() {
return $this->_params; return $this->_params;
} }
} }
/** /**

View file

@ -731,13 +731,13 @@ class AppTest extends CakeTestCase {
$this->assertEquals($text, 'This is a file with dot in file name'); $this->assertEquals($text, 'This is a file with dot in file name');
ob_start(); ob_start();
$result = App::import('Vendor', 'TestHello', array('file' => 'Test'.DS.'hello.php')); $result = App::import('Vendor', 'TestHello', array('file' => 'Test' . DS . 'hello.php'));
$text = ob_get_clean(); $text = ob_get_clean();
$this->assertTrue($result); $this->assertTrue($result);
$this->assertEquals($text, 'This is the hello.php file in Test directory'); $this->assertEquals($text, 'This is the hello.php file in Test directory');
ob_start(); ob_start();
$result = App::import('Vendor', 'MyTest', array('file' => 'Test'.DS.'MyTest.php')); $result = App::import('Vendor', 'MyTest', array('file' => 'Test' . DS . 'MyTest.php'));
$text = ob_get_clean(); $text = ob_get_clean();
$this->assertTrue($result); $this->assertTrue($result);
$this->assertEquals($text, 'This is the MyTest.php file'); $this->assertEquals($text, 'This is the MyTest.php file');
@ -804,13 +804,13 @@ class AppTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testPluginLibClasses() { public function testPluginLibClasses() {
App::build(array( App::build(array(
'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) 'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
), App::RESET); ), App::RESET);
CakePlugin::loadAll(); CakePlugin::loadAll();
$this->assertFalse(class_exists('TestPluginOtherLibrary', false)); $this->assertFalse(class_exists('TestPluginOtherLibrary', false));
App::uses('TestPluginOtherLibrary', 'TestPlugin.Lib'); App::uses('TestPluginOtherLibrary', 'TestPlugin.Lib');
$this->assertTrue(class_exists('TestPluginOtherLibrary')); $this->assertTrue(class_exists('TestPluginOtherLibrary'));
} }
} }

View file

@ -3600,8 +3600,8 @@ class ContainableBehaviorTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testLazyLoad() { public function testLazyLoad() {
// Local set up // Local set up
$this->User = ClassRegistry::init('User'); $this->User = ClassRegistry::init('User');
$this->User->bindModel(array( $this->User->bindModel(array(
'hasMany' => array('Article', 'ArticleFeatured', 'Comment') 'hasMany' => array('Article', 'ArticleFeatured', 'Comment')
), false); ), false);

View file

@ -766,7 +766,7 @@ class TranslateBehaviorTest extends CakeTestCase {
'user' => 'mariano', 'user' => 'mariano',
'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99',
'created' => '2007-03-17 01:16:23', 'created' => '2007-03-17 01:16:23',
'updated' => '2007-03-17 01:18:31' 'updated' => '2007-03-17 01:18:31'
) )
); );
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);

View file

@ -3177,7 +3177,7 @@ class MysqlTest extends CakeTestCase {
); );
$conditions = array('comment_count >' => 2); $conditions = array('comment_count >' => 2);
$query = 'SELECT ' . join(',',$this->Dbo->fields($Article, null, array('id', 'comment_count'))) . $query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) .
' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article); ' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article);
$result = $this->Dbo->fetchAll($query); $result = $this->Dbo->fetchAll($query);
$expected = array(array( $expected = array(array(

View file

@ -285,10 +285,10 @@ class PostgresTest extends CakeTestCase {
$result = $this->Dbo->fields($this->model, null, array('*', 'PostgresClientTestModel.*')); $result = $this->Dbo->fields($this->model, null, array('*', 'PostgresClientTestModel.*'));
$expected = array_merge($fields, array( $expected = array_merge($fields, array(
'"PostgresClientTestModel"."id" AS "PostgresClientTestModel__id"', '"PostgresClientTestModel"."id" AS "PostgresClientTestModel__id"',
'"PostgresClientTestModel"."name" AS "PostgresClientTestModel__name"', '"PostgresClientTestModel"."name" AS "PostgresClientTestModel__name"',
'"PostgresClientTestModel"."email" AS "PostgresClientTestModel__email"', '"PostgresClientTestModel"."email" AS "PostgresClientTestModel__email"',
'"PostgresClientTestModel"."created" AS "PostgresClientTestModel__created"', '"PostgresClientTestModel"."created" AS "PostgresClientTestModel__created"',
'"PostgresClientTestModel"."updated" AS "PostgresClientTestModel__updated"')); '"PostgresClientTestModel"."updated" AS "PostgresClientTestModel__updated"'));
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }

View file

@ -355,7 +355,7 @@ class AclNodeTest extends CakeTestCase {
$result = $Aco->find('all'); $result = $Aco->find('all');
$expected = array( $expected = array(
array('DbAcoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'Application', 'lft' => '1', 'rght' => '4'), 'DbAroTest' => array()), array('DbAcoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'Application', 'lft' => '1', 'rght' => '4'), 'DbAroTest' => array()),
array('DbAcoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Pages', 'lft' => '2', 'rght' => '3', ), 'DbAroTest' => array()) array('DbAcoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Pages', 'lft' => '2', 'rght' => '3'), 'DbAroTest' => array())
); );
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }

View file

@ -5412,7 +5412,7 @@ class ModelWriteTest extends BaseModelTest {
* *
* @return void * @return void
*/ */
function testUpdateAllWithoutForeignKey() { public function testUpdateAllWithoutForeignKey() {
$this->skipIf(!$this->db instanceof Mysql, 'Currently, there is no way of doing joins in an update statement in postgresql'); $this->skipIf(!$this->db instanceof Mysql, 'Currently, there is no way of doing joins in an update statement in postgresql');
$this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll'); $this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll');
@ -5420,12 +5420,12 @@ class ModelWriteTest extends BaseModelTest {
$conditions = array('Group.name' => 'group one'); $conditions = array('Group.name' => 'group one');
$ProductUpdateAll->bindModel(array('belongsTo' => array( $ProductUpdateAll->bindModel(array('belongsTo' => array(
'Group' => array('className' => 'GroupUpdateAll') 'Group' => array('className' => 'GroupUpdateAll')
))); )));
$ProductUpdateAll->belongsTo = array( $ProductUpdateAll->belongsTo = array(
'Group' => array( 'Group' => array(
'className' => 'GroupUpdateAll', 'className' => 'GroupUpdateAll',
'foreignKey' => false, 'foreignKey' => false,
'conditions' => 'ProductUpdateAll.groupcode = Group.code' 'conditions' => 'ProductUpdateAll.groupcode = Group.code'

View file

@ -3131,7 +3131,7 @@ class CounterCachePost extends CakeTestModel {
class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel { class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel {
public $name = 'CounterCacheUserNonstandardPrimaryKey'; public $name = 'CounterCacheUserNonstandardPrimaryKey';
public $alias = 'User'; public $alias = 'User';
public $primaryKey = 'uid'; public $primaryKey = 'uid';
public $hasMany = array('Post' => array( public $hasMany = array('Post' => array(
'className' => 'CounterCachePostNonstandardPrimaryKey', 'className' => 'CounterCachePostNonstandardPrimaryKey',
@ -3142,7 +3142,7 @@ class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel {
class CounterCachePostNonstandardPrimaryKey extends CakeTestModel { class CounterCachePostNonstandardPrimaryKey extends CakeTestModel {
public $name = 'CounterCachePostNonstandardPrimaryKey'; public $name = 'CounterCachePostNonstandardPrimaryKey';
public $alias = 'Post'; public $alias = 'Post';
public $primaryKey = 'pid'; public $primaryKey = 'pid';
public $belongsTo = array('User' => array( public $belongsTo = array('User' => array(
'className' => 'CounterCacheUserNonstandardPrimaryKey', 'className' => 'CounterCacheUserNonstandardPrimaryKey',
@ -4473,8 +4473,8 @@ class MysqlTestModel extends Model {
class PrefixTestModel extends CakeTestModel { class PrefixTestModel extends CakeTestModel {
} }
class PrefixTestUseTableModel extends CakeTestModel { class PrefixTestUseTableModel extends CakeTestModel {
public $name = 'PrefixTest'; public $name = 'PrefixTest';
public $useTable = 'prefix_tests'; public $useTable = 'prefix_tests';
} }
/** /**

View file

@ -402,19 +402,19 @@ class CakeEmailTest extends CakeTestCase {
*/ */
public function testSubjectJapanese() { public function testSubjectJapanese() {
$this->skipIf(!function_exists('mb_convert_encoding')); $this->skipIf(!function_exists('mb_convert_encoding'));
mb_internal_encoding('UTF-8'); mb_internal_encoding('UTF-8');
$this->CakeEmail->headerCharset = 'ISO-2022-JP'; $this->CakeEmail->headerCharset = 'ISO-2022-JP';
$this->CakeEmail->subject('日本語のSubjectにも対応するよ'); $this->CakeEmail->subject('日本語のSubjectにも対応するよ');
$expected = '=?ISO-2022-JP?B?GyRCRnxLXDhsJE4bKEJTdWJqZWN0GyRCJEskYkJQMX4kOSRrJGgbKEI=?='; $expected = '=?ISO-2022-JP?B?GyRCRnxLXDhsJE4bKEJTdWJqZWN0GyRCJEskYkJQMX4kOSRrJGgbKEI=?=';
$this->assertSame($this->CakeEmail->subject(), $expected); $this->assertSame($this->CakeEmail->subject(), $expected);
$this->CakeEmail->subject('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう'); $this->CakeEmail->subject('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう');
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n"
." =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" ." =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n"
." =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?="; ." =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
$this->assertSame($this->CakeEmail->subject(), $expected); $this->assertSame($this->CakeEmail->subject(), $expected);
} }
/** /**
@ -1355,8 +1355,8 @@ class CakeEmailTest extends CakeTestCase {
$this->CakeEmail->headerCharset = 'ISO-2022-JP'; $this->CakeEmail->headerCharset = 'ISO-2022-JP';
$result = $this->CakeEmail->encode('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう'); $result = $this->CakeEmail->encode('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう');
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n"
. " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" . " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n"
. " =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?="; . " =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
$this->assertSame($expected, $result); $this->assertSame($expected, $result);
} }
} }

View file

@ -226,7 +226,7 @@ class FileTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testCreate() { public function testCreate() {
$tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp'; $tmpFile = TMP.'tests' . DS . 'cakephp.file.test.tmp';
$File = new File($tmpFile, true, 0777); $File = new File($tmpFile, true, 0777);
$this->assertTrue($File->exists()); $this->assertTrue($File->exists());
} }
@ -387,7 +387,7 @@ class FileTest extends CakeTestCase {
$r = $TmpFile->append($fragment); $r = $TmpFile->append($fragment);
$this->assertTrue($r); $this->assertTrue($r);
$this->assertTrue(file_exists($tmpFile)); $this->assertTrue(file_exists($tmpFile));
$data = $data.$fragment; $data = $data . $fragment;
$this->assertEquals($data, file_get_contents($tmpFile)); $this->assertEquals($data, file_get_contents($tmpFile));
$TmpFile->close(); $TmpFile->close();
} }

View file

@ -2099,7 +2099,7 @@ class ValidationTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
function testDatetime() { function testDatetime() {
$this->assertTrue(Validation::datetime('27-12-2006 01:00', 'dmy')); $this->assertTrue(Validation::datetime('27-12-2006 01:00', 'dmy'));
$this->assertTrue(Validation::datetime('27-12-2006 01:00', array('dmy'))); $this->assertTrue(Validation::datetime('27-12-2006 01:00', array('dmy')));
$this->assertFalse(Validation::datetime('27-12-2006 1:00', 'dmy')); $this->assertFalse(Validation::datetime('27-12-2006 1:00', 'dmy'));

View file

@ -535,7 +535,7 @@ class CacheHelperTest extends CakeTestCase {
$filename = CACHE . 'views' . DS . 'cache_cachetest_cache_name.php'; $filename = CACHE . 'views' . DS . 'cache_cachetest_cache_name.php';
$this->assertTrue(file_exists($filename)); $this->assertTrue(file_exists($filename));
@unlink($filename); @unlink($filename);
} }
/** /**
* test that afterRender checks the conditions correctly. * test that afterRender checks the conditions correctly.

View file

@ -573,7 +573,7 @@ class HtmlHelperTest extends CakeTestCase {
Configure::write('debug', 2); Configure::write('debug', 2);
Configure::write('Asset.timestamp', true); Configure::write('Asset.timestamp', true);
touch(WWW_ROOT . 'js' . DS. '__cake_js_test.js'); touch(WWW_ROOT . 'js' . DS . '__cake_js_test.js');
$timestamp = substr(strtotime('now'), 0, 8); $timestamp = substr(strtotime('now'), 0, 8);
$result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false)); $result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false));
@ -583,7 +583,7 @@ class HtmlHelperTest extends CakeTestCase {
Configure::write('Asset.timestamp', 'force'); Configure::write('Asset.timestamp', 'force');
$result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false)); $result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false));
$this->assertRegExp('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s'); $this->assertRegExp('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s');
unlink(WWW_ROOT . 'js' . DS. '__cake_js_test.js'); unlink(WWW_ROOT . 'js' . DS . '__cake_js_test.js');
Configure::write('Asset.timestamp', false); Configure::write('Asset.timestamp', false);
} }

View file

@ -118,15 +118,15 @@ class NumberHelperTest extends CakeTestCase {
$result = $this->Number->currency(1000.45, NULL, array('after' => 'øre', 'before' => 'Kr. ', 'decimals' => ',', 'thousands' => '.')); $result = $this->Number->currency(1000.45, NULL, array('after' => 'øre', 'before' => 'Kr. ', 'decimals' => ',', 'thousands' => '.'));
$expected = 'Kr. 1.000,45'; $expected = 'Kr. 1.000,45';
$this->assertEquals($expected,$result); $this->assertEquals($expected, $result);
$result = $this->Number->currency(0.5, 'USD'); $result = $this->Number->currency(0.5, 'USD');
$expected = '50c'; $expected = '50c';
$this->assertEquals($expected,$result); $this->assertEquals($expected, $result);
$result = $this->Number->currency(0.5, NULL, array('after' => 'øre')); $result = $this->Number->currency(0.5, NULL, array('after' => 'øre'));
$expected = '50øre'; $expected = '50øre';
$this->assertEquals($expected,$result); $this->assertEquals($expected, $result);
$result = $this->Number->currency(1, null, array('wholeSymbol' => '$ ')); $result = $this->Number->currency(1, null, array('wholeSymbol' => '$ '));
$expected = '$ 1.00'; $expected = '$ 1.00';
@ -174,16 +174,16 @@ class NumberHelperTest extends CakeTestCase {
$this->Number->addFormat('NOK', array('before' => 'Kr. ')); $this->Number->addFormat('NOK', array('before' => 'Kr. '));
$result = $this->Number->currency(1000, 'NOK'); $result = $this->Number->currency(1000, 'NOK');
$expected = 'Kr. 1,000.00'; $expected = 'Kr. 1,000.00';
$this->assertEquals($expected,$result); $this->assertEquals($expected, $result);
$this->Number->addFormat('Other', array('before' => '$$ ', 'after' => 'c!')); $this->Number->addFormat('Other', array('before' => '$$ ', 'after' => 'c!'));
$result = $this->Number->currency(0.22, 'Other'); $result = $this->Number->currency(0.22, 'Other');
$expected = '22c!'; $expected = '22c!';
$this->assertEquals($expected,$result); $this->assertEquals($expected, $result);
$result = $this->Number->currency(-10, 'Other'); $result = $this->Number->currency(-10, 'Other');
$expected = '($$ 10.00)'; $expected = '($$ 10.00)';
$this->assertEquals($expected,$result); $this->assertEquals($expected, $result);
} }
/** /**

View file

@ -58,9 +58,9 @@ class TextHelperTest extends CakeTestCase {
$text3 = '<b>&copy; 2005-2007, Cake Software Foundation, Inc.</b><br />written by Alexander Wegener'; $text3 = '<b>&copy; 2005-2007, Cake Software Foundation, Inc.</b><br />written by Alexander Wegener';
$text4 = '<img src="mypic.jpg"> This image tag is not XHTML conform!<br><hr/><b>But the following image tag should be conform <img src="mypic.jpg" alt="Me, myself and I" /></b><br />Great, or?'; $text4 = '<img src="mypic.jpg"> This image tag is not XHTML conform!<br><hr/><b>But the following image tag should be conform <img src="mypic.jpg" alt="Me, myself and I" /></b><br />Great, or?';
$text5 = '0<b>1<i>2<span class="myclass">3</span>4<u>5</u>6</i>7</b>8<b>9</b>0'; $text5 = '0<b>1<i>2<span class="myclass">3</span>4<u>5</u>6</i>7</b>8<b>9</b>0';
$text6 = '<p><strong>Extra dates have been announced for this year\'s tour.</strong></p><p>Tickets for the new shows in</p>'; $text6 = '<p><strong>Extra dates have been announced for this year\'s tour.</strong></p><p>Tickets for the new shows in</p>';
$text7 = 'El moño está en el lugar correcto. Eso fue lo que dijo la niña, ¿habrá dicho la verdad?'; $text7 = 'El moño está en el lugar correcto. Eso fue lo que dijo la niña, ¿habrá dicho la verdad?';
$text8 = 'Vive la R'.chr(195).chr(169).'publique de France'; $text8 = 'Vive la R'.chr(195).chr(169).'publique de France';
$text9 = 'НОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыь'; $text9 = 'НОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыь';
$this->assertSame($this->Text->truncate($text1, 15), 'The quick br...'); $this->assertSame($this->Text->truncate($text1, 15), 'The quick br...');

View file

@ -33,9 +33,9 @@ class CounterCachePostFixture extends CakeTestFixture {
'published' => array('type' => 'boolean', 'null' => false, 'default' => 0) 'published' => array('type' => 'boolean', 'null' => false, 'default' => 0)
); );
public $records = array( public $records = array(
array('id' => 1, 'title' => 'Rock and Roll', 'user_id' => 66, 'published' => false), array('id' => 1, 'title' => 'Rock and Roll', 'user_id' => 66, 'published' => false),
array('id' => 2, 'title' => 'Music', 'user_id' => 66, 'published' => true), array('id' => 2, 'title' => 'Music', 'user_id' => 66, 'published' => true),
array('id' => 3, 'title' => 'Food', 'user_id' => 301, 'published' => true), array('id' => 3, 'title' => 'Food', 'user_id' => 301, 'published' => true),
); );
} }

View file

@ -32,9 +32,9 @@ class CounterCachePostNonstandardPrimaryKeyFixture extends CakeTestFixture {
'uid' => array('type' => 'integer', 'null' => true), 'uid' => array('type' => 'integer', 'null' => true),
); );
public $records = array( public $records = array(
array('pid' => 1, 'title' => 'Rock and Roll', 'uid' => 66), array('pid' => 1, 'title' => 'Rock and Roll', 'uid' => 66),
array('pid' => 2, 'title' => 'Music', 'uid' => 66), array('pid' => 2, 'title' => 'Music', 'uid' => 66),
array('pid' => 3, 'title' => 'Food', 'uid' => 301), array('pid' => 3, 'title' => 'Food', 'uid' => 301),
); );
} }

View file

@ -23,31 +23,35 @@
* @package Cake.Test.Fixture * @package Cake.Test.Fixture
*/ */
class GroupUpdateAllFixture extends CakeTestFixture { class GroupUpdateAllFixture extends CakeTestFixture {
public $name = 'GroupUpdateAll'; public $name = 'GroupUpdateAll';
public $table = 'group_update_all'; public $table = 'group_update_all';
public $fields = array( public $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'length' => 29), 'name' => array('type' => 'string', 'null' => false, 'length' => 29),
'code' => array('type' => 'integer', 'null' => false, 'length' => 4), 'code' => array('type' => 'integer', 'null' => false, 'length' => 4),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
); );
public $records = array( public $records = array(
array( array(
'id' => 1, 'id' => 1,
'name' => 'group one', 'name' => 'group one',
'code' => 120), 'code' => 120
array( ),
'id' => 2, array(
'name' => 'group two', 'id' => 2,
'code' => 125), 'name' => 'group two',
array( 'code' => 125
'id' => 3, ),
'name' => 'group three', array(
'code' => 130), 'id' => 3,
array( 'name' => 'group three',
'id' => 4, 'code' => 130
'name' => 'group four', ),
'code' => 135) array(
); 'id' => 4,
'name' => 'group four',
'code' => 135
),
);
} }

View file

@ -26,34 +26,37 @@ class ProductUpdateAllFixture extends CakeTestFixture {
public $name = 'ProductUpdateAll'; public $name = 'ProductUpdateAll';
public $table = 'product_update_all'; public $table = 'product_update_all';
public $fields = array( public $fields = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'length' => 29), 'name' => array('type' => 'string', 'null' => false, 'length' => 29),
'groupcode' => array('type' => 'integer', 'null' => false, 'length' => 4), 'groupcode' => array('type' => 'integer', 'null' => false, 'length' => 4),
'group_id' => array('type' => 'integer', 'null' => false, 'length' => 8), 'group_id' => array('type' => 'integer', 'null' => false, 'length' => 8),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
); );
public $records = array( public $records = array(
array( array(
'id' => 1, 'id' => 1,
'name' => 'product one', 'name' => 'product one',
'groupcode' => 120, 'groupcode' => 120,
'group_id' => 1 'group_id' => 1
), ),
array( array(
'id' => 2, 'id' => 2,
'name' => 'product two', 'name' => 'product two',
'groupcode' => 120, 'groupcode' => 120,
'group_id' => 1), 'group_id' => 1
array( ),
'id' => 3, array(
'name' => 'product three', 'id' => 3,
'groupcode' => 125, 'name' => 'product three',
'group_id' => 2), 'groupcode' => 125,
array( 'group_id' => 2
'id' => 4, ),
'name' => 'product four', array(
'groupcode' => 135, 'id' => 4,
'group_id' => 4) 'name' => 'product four',
); 'groupcode' => 135,
'group_id' => 4
),
);
} }

View file

@ -49,7 +49,7 @@ App::uses('Debugger', 'Utility');
<p> <p>
<?php <?php
$filePresent = null; $filePresent = null;
if (file_exists(APP . 'Config' . DS.'database.php')): if (file_exists(APP . 'Config' . DS . 'database.php')):
echo '<span class="notice success">'; echo '<span class="notice success">';
echo __d('cake_dev', 'Your database configuration file is present.'); echo __d('cake_dev', 'Your database configuration file is present.');
$filePresent = true; $filePresent = true;

View file

@ -74,7 +74,7 @@ class CakeTestRunner extends PHPUnit_TextUI_TestRunner {
} }
} }
return $result; return $result;
} }
/** /**
* Get the fixture manager class specified or use the default one. * Get the fixture manager class specified or use the default one.

View file

@ -137,7 +137,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
echo "</div>\n"; echo "</div>\n";
echo '<div style="padding:0 0 5px;">'; echo '<div style="padding:0 0 5px;">';
echo '<p><strong>Time:</strong> ' . $result->time() . ' seconds</p>'; echo '<p><strong>Time:</strong> ' . $result->time() . ' seconds</p>';
echo '<p><strong>Peak memory:</strong> ' . number_format(memory_get_peak_usage()) . ' bytes</p>'; echo '<p><strong>Peak memory:</strong> ' . number_format(memory_get_peak_usage()) . ' bytes</p>';
echo $this->_paintLinks(); echo $this->_paintLinks();
echo '</div>'; echo '</div>';
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) { if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {

View file

@ -84,7 +84,7 @@ class CakeTextReporter extends CakeBaseReporter {
', Exceptions: ' . $result->errorCount() . "\n"; ', Exceptions: ' . $result->errorCount() . "\n";
echo 'Time: ' . $result->time() . " seconds\n"; echo 'Time: ' . $result->time() . " seconds\n";
echo 'Peak memory: ' . number_format(memory_get_peak_usage()) . " bytes\n"; echo 'Peak memory: ' . number_format(memory_get_peak_usage()) . " bytes\n";
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) { if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
$coverage = $result->getCodeCoverage()->getSummary(); $coverage = $result->getCodeCoverage()->getSummary();

View file

@ -333,7 +333,7 @@ class File {
$this->info(); $this->info();
} }
if (isset($this->info['extension'])) { if (isset($this->info['extension'])) {
return basename($this->name, '.'.$this->info['extension']); return basename($this->name, '.' . $this->info['extension']);
} elseif ($this->name) { } elseif ($this->name) {
return $this->name; return $this->name;
} }

View file

@ -529,7 +529,7 @@ class Set {
} }
continue; continue;
} }
list(,$key,$op,$expected) = $match; list(, $key, $op, $expected) = $match;
if (!isset($data[$key])) { if (!isset($data[$key])) {
return false; return false;
} }
@ -630,7 +630,7 @@ class Set {
$pattern = substr($key, 1, -1); $pattern = substr($key, 1, -1);
foreach ($data as $j => $val) { foreach ($data as $j => $val) {
if (preg_match('/^'.$pattern.'/s', $j) !== 0) { if (preg_match('/^' . $pattern . '/s', $j) !== 0) {
$tmpPath = array_slice($path, $i + 1); $tmpPath = array_slice($path, $i + 1);
if (empty($tmpPath)) { if (empty($tmpPath)) {
$tmp[$j] = $val; $tmp[$j] = $val;

View file

@ -247,7 +247,7 @@ class String {
} }
if (!isset($options['format']) && isset($options['before'])) { if (!isset($options['format']) && isset($options['before'])) {
$str = str_replace($options['escape'].$options['before'], $options['before'], $str); $str = str_replace($options['escape'] . $options['before'], $options['before'], $str);
} }
return ($options['clean']) ? String::cleanInsert($str, $options) : $str; return ($options['clean']) ? String::cleanInsert($str, $options) : $str;
} }

View file

@ -382,7 +382,7 @@ class Validation {
if (is_null($places)) { if (is_null($places)) {
$regex = '/^[-+]?[0-9]*\\.{1}[0-9]+(?:[eE][-+]?[0-9]+)?$/'; $regex = '/^[-+]?[0-9]*\\.{1}[0-9]+(?:[eE][-+]?[0-9]+)?$/';
} else { } else {
$regex = '/^[-+]?[0-9]*\\.{1}[0-9]{'.$places.'}$/'; $regex = '/^[-+]?[0-9]*\\.{1}[0-9]{' . $places . '}$/';
} }
} }
return self::_check($check, $regex); return self::_check($check, $regex);

View file

@ -298,7 +298,7 @@ class CacheHelper extends AppHelper {
$this->loadHelpers(); $this->loadHelpers();
extract($this->viewVars, EXTR_SKIP); extract($this->viewVars, EXTR_SKIP);
?>'; ?>';
$content = preg_replace("/(<\\?xml)/", "<?php echo '$1';?>",$content); $content = preg_replace("/(<\\?xml)/", "<?php echo '$1';?>", $content);
$file .= $content; $file .= $content;
return cache('views' . DS . $cache, $file, $timestamp); return cache('views' . DS . $cache, $file, $timestamp);
} }

View file

@ -605,7 +605,7 @@ class HtmlHelper extends AppHelper {
} }
$out = array(); $out = array();
foreach ($data as $key=> $value) { foreach ($data as $key=> $value) {
$out[] = $key.':'.$value.';'; $out[] = $key . ':' . $value . ';';
} }
if ($oneline) { if ($oneline) {
return join(' ', $out); return join(' ', $out);

View file

@ -294,7 +294,7 @@ class TextHelper extends AppHelper {
if ($html) { if ($html) {
foreach ($openTags as $tag) { foreach ($openTags as $tag) {
$truncate .= '</'.$tag.'>'; $truncate .= '</' . $tag . '>';
} }
} }

View file

@ -132,7 +132,7 @@ class TimeHelper extends AppHelper {
case 'p': case 'p':
case 'P': case 'P':
$default = array('am' => 0, 'pm' => 1); $default = array('am' => 0, 'pm' => 1);
$meridiem = $default[date('a',$this->__time)]; $meridiem = $default[date('a', $this->__time)];
$format = __dc('cake', 'am_pm', 5); $format = __dc('cake', 'am_pm', 5);
if (is_array($format)) { if (is_array($format)) {
$meridiem = $format[$meridiem]; $meridiem = $format[$meridiem];
@ -142,7 +142,7 @@ class TimeHelper extends AppHelper {
case 'r': case 'r':
$complete = __dc('cake', 't_fmt_ampm', 5); $complete = __dc('cake', 't_fmt_ampm', 5);
if ($complete != 't_fmt_ampm') { if ($complete != 't_fmt_ampm') {
return str_replace('%p',$this->_translateSpecifier(array('%p', 'p')),$complete); return str_replace('%p', $this->_translateSpecifier(array('%p', 'p')), $complete);
} }
break; break;
case 'R': case 'R':
@ -344,7 +344,7 @@ class TimeHelper extends AppHelper {
*/ */
public function isThisMonth($dateString, $userOffset = null) { public function isThisMonth($dateString, $userOffset = null) {
$date = $this->fromString($dateString); $date = $this->fromString($dateString);
return date('m Y',$date) == date('m Y', time()); return date('m Y', $date) == date('m Y', time());
} }
/** /**
@ -671,7 +671,7 @@ class TimeHelper extends AppHelper {
} }
$date = $this->fromString($dateString, $userOffset); $date = $this->fromString($dateString, $userOffset);
$interval = $this->fromString('-'.$timeInterval); $interval = $this->fromString('-' . $timeInterval);
if ($date >= $interval && $date <= time()) { if ($date >= $interval && $date <= time()) {
return true; return true;

View file

@ -45,10 +45,10 @@ foreach ($scaffoldFields as $_field) {
<h3><?php echo __d('cake', 'Actions'); ?></h3> <h3><?php echo __d('cake', 'Actions'); ?></h3>
<ul> <ul>
<?php <?php
echo "\t\t<li>" .$this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])). " </li>\n"; echo "\t\t<li>" . $this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])) . " </li>\n";
echo "\t\t<li>" .$this->Html->link(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?'). " </li>\n"; echo "\t\t<li>" . $this->Html->link(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?') . " </li>\n";
echo "\t\t<li>" .$this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')). " </li>\n"; echo "\t\t<li>" . $this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')) . " </li>\n";
echo "\t\t<li>" .$this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')). " </li>\n"; echo "\t\t<li>" . $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')) . " </li>\n";
$done = array(); $done = array();
foreach ($associations as $_type => $_data) { foreach ($associations as $_type => $_data) {

View file

@ -46,52 +46,52 @@ if (!defined('WEBROOT_DIR')) {
* Path to the application's directory. * Path to the application's directory.
*/ */
if (!defined('APP')) { if (!defined('APP')) {
define('APP', ROOT.DS.APP_DIR.DS); define('APP', ROOT . DS . APP_DIR.DS);
} }
/** /**
* Path to the application's libs directory. * Path to the application's libs directory.
*/ */
define('APPLIBS', APP.'Lib'.DS); define('APPLIBS', APP . 'Lib' . DS);
/** /**
* Path to the public CSS directory. * Path to the public CSS directory.
*/ */
define('CSS', WWW_ROOT.'css'.DS); define('CSS', WWW_ROOT . 'css' . DS);
/** /**
* Path to the public JavaScript directory. * Path to the public JavaScript directory.
*/ */
define('JS', WWW_ROOT.'js'.DS); define('JS', WWW_ROOT . 'js' . DS);
/** /**
* Path to the public images directory. * Path to the public images directory.
*/ */
define('IMAGES', WWW_ROOT.'img'.DS); define('IMAGES', WWW_ROOT . 'img' . DS);
/** /**
* Path to the tests directory. * Path to the tests directory.
*/ */
if (!defined('TESTS')) { if (!defined('TESTS')) {
define('TESTS', APP.'Test'.DS); define('TESTS', APP . 'Test' . DS);
} }
/** /**
* Path to the temporary files directory. * Path to the temporary files directory.
*/ */
if (!defined('TMP')) { if (!defined('TMP')) {
define('TMP', APP.'tmp'.DS); define('TMP', APP . 'tmp' . DS);
} }
/** /**
* Path to the logs directory. * Path to the logs directory.
*/ */
define('LOGS', TMP.'logs'.DS); define('LOGS', TMP . 'logs' . DS);
/** /**
* Path to the cache files directory. It can be shared between hosts in a multi-server setup. * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
*/ */
define('CACHE', TMP.'cache'.DS); define('CACHE', TMP . 'cache' . DS);
/** /**
* Path to the vendors directory. * Path to the vendors directory.
@ -143,13 +143,13 @@ Configure::bootstrap(isset($boot) ? $boot : true);
if (!defined('FULL_BASE_URL')) { if (!defined('FULL_BASE_URL')) {
$s = null; $s = null;
if (env('HTTPS')) { if (env('HTTPS')) {
$s ='s'; $s = 's';
} }
$httpHost = env('HTTP_HOST'); $httpHost = env('HTTP_HOST');
if (isset($httpHost)) { if (isset($httpHost)) {
define('FULL_BASE_URL', 'http'.$s.'://'.$httpHost); define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost);
} }
unset($httpHost, $s); unset($httpHost, $s);
} }