Permalink
Browse files

Merge branch 'master' into 2.3

Conflicts:
	lib/Cake/Console/Command/Task/TestTask.php
  • Loading branch information...
markstory committed Sep 1, 2012
2 parents 7283007 + 474e42c commit 571c8bc08c29029d2afcaf20b0535d465a9ebb18
@@ -331,9 +331,9 @@ public function mapType($type, $plugin) {
/**
* Get the base class and package name for a given type.
*
- * @param string $type The type of class having a test
- * generated is in.
- * @return array Array of class, type)
+ * @param string $type The type the class having a test
+ * generated for is in.
+ * @return array Array of (class, type)
* @throws CakeException on invalid types.
*/
public function getBaseType($type) {
View
@@ -404,7 +404,7 @@ protected static function _autoConfig() {
* or a string matching the recognized levels, then it will
* be treated log levels. Otherwise it's treated as scope.
* @param string $message Message content to log
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -455,7 +455,7 @@ public static function write($type, $message, $scope = array()) {
* Convenience method to log emergency messages
*
* @param string $message log message
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -467,7 +467,7 @@ public static function emergency($message, $scope = array()) {
* Convenience method to log alert messages
*
* @param string $message log message
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -479,7 +479,7 @@ public static function alert($message, $scope = array()) {
* Convenience method to log critical messages
*
* @param string $message log message
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -491,7 +491,7 @@ public static function critical($message, $scope = array()) {
* Convenience method to log error messages
*
* @param string $message log message
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -503,7 +503,7 @@ public static function error($message, $scope = array()) {
* Convenience method to log warning messages
*
* @param string $message log message
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -515,7 +515,7 @@ public static function warning($message, $scope = array()) {
* Convenience method to log notice messages
*
* @param string $message log message
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -527,7 +527,7 @@ public static function notice($message, $scope = array()) {
* Convenience method to log debug messages
*
* @param string $message log message
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -539,7 +539,7 @@ public static function debug($message, $scope = array()) {
* Convenience method to log info messages
*
* @param string $message log message
- * @param string|array $scope The scope(s) a log messge is being created in.
+ * @param string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success
*/
@@ -2315,7 +2315,6 @@ public function fields(Model $model, $alias = null, $fields = array(), $quote =
}
$fields = array_values($fields);
}
-
if (!$quote) {
if (!empty($virtual)) {
$fields = array_merge($fields, $this->_constructVirtualFields($model, $alias, $virtual));
@@ -2633,8 +2632,11 @@ protected function _quoteFields($conditions) {
$end = preg_quote($this->endQuote);
}
$conditions = str_replace(array($start, $end), '', $conditions);
- $conditions = preg_replace_callback('/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_' . $start . $end . ']*\\.[a-z0-9_' . $start . $end . ']*)/i', array(&$this, '_quoteMatchedField'), $conditions);
-
+ $conditions = preg_replace_callback(
+ '/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9\\-_' . $start . $end . ']*\\.[a-z0-9_\\-' . $start . $end . ']*)/i',
+ array(&$this, '_quoteMatchedField'),
+ $conditions
+ );
if ($conditions !== null) {
return $conditions;
}
@@ -152,14 +152,17 @@ public function testExecute() {
$pattern .= 'msgid "Editing this Page"\nmsgstr ""/';
$this->assertRegExp($pattern, $result);
- $pattern = '/\#: (\\\\|\/)extract\.ctp:18\nmsgid "';
+ $pattern = '/\#: (\\\\|\/)extract\.ctp:22\nmsgid "';
$pattern .= 'Hot features!';
$pattern .= '\\\n - No Configuration: Set-up the database and let the magic begin';
$pattern .= '\\\n - Extremely Simple: Just look at the name...It\'s Cake';
$pattern .= '\\\n - Active, Friendly Community: Join us #cakephp on IRC. We\'d love to help you get started';
$pattern .= '"\nmsgstr ""/';
$this->assertRegExp($pattern, $result);
+ $this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly');
+ $this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly');
+
// extract.ctp - reading the domain.pot
$result = file_get_contents($this->path . DS . 'domain.pot');
@@ -403,8 +403,12 @@ public function testLocaleMultiple() {
)
)
);
-
$this->assertEquals($expected, $result);
+
+ $TestModel = new TranslatedItem();
+ $TestModel->locale = array('pt-br');
+ $result = $TestModel->find('all');
+ $this->assertCount(3, $result, '3 records should have been found, no SQL error.');
}
/**
@@ -2028,6 +2028,9 @@ public function testQuotesInStringConditions() {
$result = $this->Dbo->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
$this->assertEquals($expected, $result);
+
+ $result = $this->Dbo->conditions('I18n__title_pt-br.content = "test"');
+ $this->assertEquals(' WHERE `I18n__title_pt-br`.`content` = "test"', $result);
}
/**
@@ -585,6 +585,10 @@ public function testName() {
$expected = 'Function(`Something`.`foo`) AS `x`';
$this->assertEquals($expected, $result);
+ $result = $this->testDb->name('I18n__title__pt-br.locale');
+ $expected = '`I18n__title__pt-br`.`locale`';
+ $this->assertEquals($expected, $result);
+
$result = $this->testDb->name('name-with-minus');
$expected = '`name-with-minus`';
$this->assertEquals($expected, $result);
@@ -1163,11 +1163,11 @@ public function testSendRenderWithImage() {
$this->CakeEmail->template('image');
$this->CakeEmail->emailFormat('html');
$server = env('SERVER_NAME') ? env('SERVER_NAME') : 'localhost';
-
+
if (env('SERVER_PORT') != null && env('SERVER_PORT') != 80) {
$server .= ':' . env('SERVER_PORT');
}
-
+
$expected = '<img src="http://' . $server . '/img/image.gif" alt="cool image" width="100" height="100" />';
$result = $this->CakeEmail->send();
$this->assertContains($expected, $result['message']);
@@ -64,38 +64,39 @@ public function tearDown() {
* @return void
*/
public function testBasic() {
- $file = __FILE__;
+ $file = CAKE . DS . 'LICENSE.txt';
- $result = $this->File->pwd();
- $expecting = $file;
- $this->assertEquals($expecting, $result);
+ $this->File = new File($file, false);
$result = $this->File->name;
- $expecting = basename(__FILE__);
+ $expecting = basename($file);
$this->assertEquals($expecting, $result);
$result = $this->File->info();
$expecting = array(
- 'dirname' => dirname(__FILE__),
- 'basename' => basename(__FILE__),
- 'extension' => 'php',
- 'filename' => 'FileTest',
+ 'dirname' => dirname($file),
+ 'basename' => basename($file),
+ 'extension' => 'txt',
+ 'filename' => 'LICENSE',
'filesize' => filesize($file),
- 'mime' => 'text/x-php'
+ 'mime' => 'text/plain'
);
- if (!function_exists('finfo_open') && (!function_exists('mime_content_type') ||
- function_exists('mime_content_type') && false === mime_content_type($this->File->pwd()))) {
+ if (
+ !function_exists('finfo_open') &&
+ (!function_exists('mime_content_type') ||
+ function_exists('mime_content_type') &&
+ mime_content_type($this->File->pwd()) === false)
+ ) {
$expecting['mime'] = false;
}
-
$this->assertEquals($expecting, $result);
$result = $this->File->ext();
- $expecting = 'php';
+ $expecting = 'txt';
$this->assertEquals($expecting, $result);
$result = $this->File->name();
- $expecting = 'FileTest';
+ $expecting = 'LICENSE';
$this->assertEquals($expecting, $result);
$result = $this->File->md5();
@@ -1510,9 +1510,9 @@ public function testDecimalWithPlacesNull() {
$this->assertTrue(Validation::decimal('1234', null));
$this->assertTrue(Validation::decimal('-1234', null));
$this->assertTrue(Validation::decimal('+1234', null));
- $this->assertTrue(Validation::decimal((float) 1234, null));
- $this->assertTrue(Validation::decimal((double) 1234, null));
- $this->assertTrue(Validation::decimal((int) 1234, null));
+ $this->assertTrue(Validation::decimal((float)1234, null));
+ $this->assertTrue(Validation::decimal((double)1234, null));
+ $this->assertTrue(Validation::decimal((int)1234, null));
$this->assertFalse(Validation::decimal('', null));
$this->assertFalse(Validation::decimal('string', null));
@@ -1540,13 +1540,13 @@ public function testDecimalWithPlacesTrue() {
$this->assertTrue(Validation::decimal('.00', true));
$this->assertTrue(Validation::decimal(.01, true));
$this->assertTrue(Validation::decimal('.01', true));
- $this->assertTrue(Validation::decimal((float) 1234, true));
- $this->assertTrue(Validation::decimal((double) 1234, true));
+ $this->assertTrue(Validation::decimal((float)1234, true));
+ $this->assertTrue(Validation::decimal((double)1234, true));
$this->assertFalse(Validation::decimal('', true));
$this->assertFalse(Validation::decimal('string', true));
$this->assertFalse(Validation::decimal('1234.', true));
- $this->assertFalse(Validation::decimal((int) 1234, true));
+ $this->assertFalse(Validation::decimal((int)1234, true));
$this->assertFalse(Validation::decimal('1234', true));
$this->assertFalse(Validation::decimal('-1234', true));
$this->assertFalse(Validation::decimal('+1234', true));
@@ -1580,9 +1580,9 @@ public function testDecimalWithPlacesNumeric() {
$this->assertFalse(Validation::decimal('1234.', 1));
$this->assertFalse(Validation::decimal(.0, 1));
$this->assertFalse(Validation::decimal(.00, 2));
- $this->assertFalse(Validation::decimal((float) 1234, 1));
- $this->assertFalse(Validation::decimal((double) 1234, 1));
- $this->assertFalse(Validation::decimal((int) 1234, 1));
+ $this->assertFalse(Validation::decimal((float)1234, 1));
+ $this->assertFalse(Validation::decimal((double)1234, 1));
+ $this->assertFalse(Validation::decimal((int)1234, 1));
$this->assertFalse(Validation::decimal('1234.5678', '3'));
$this->assertFalse(Validation::decimal(1234.5678, 3));
$this->assertFalse(Validation::decimal(-1234.5678, 3));
@@ -1596,8 +1596,8 @@ public function testDecimalWithPlacesNumeric() {
*/
public function testDecimalWithInvalidPlaces() {
$this->assertFalse(Validation::decimal('.27', 'string'));
- $this->assertFalse(Validation::decimal(1234.5678, (array) true));
- $this->assertFalse(Validation::decimal(-1234.5678, (object) true));
+ $this->assertFalse(Validation::decimal(1234.5678, (array)true));
+ $this->assertFalse(Validation::decimal(-1234.5678, (object)true));
}
/**
@@ -14,6 +14,10 @@ echo __dn('domain', 'You deleted %d message (domain).', 'You deleted %d messages
echo __('Editing this Page');
echo __('You have %d new message.');
+// Contains quotes
+echo __('double "quoted"');
+echo __("single 'quoted'");
+
// Multiline
__('Hot features!'
. "\n - No Configuration:"
View
@@ -625,7 +625,7 @@ public function append($name, $value = null) {
* @param string $value The content for the block.
* @return void
* @throws CakeException when you use non-string values.
- * @see ViewBlock::assign()
+ * @see ViewBlock::set()
*/
public function assign($name, $value) {
return $this->Blocks->set($name, $value);
@@ -637,7 +637,7 @@ public function assign($name, $value) {
*
* @param string $name Name of the block
* @return The block content or '' if the block does not exist.
- * @see ViewBlock::fetch()
+ * @see ViewBlock::get()
*/
public function fetch($name) {
return $this->Blocks->get($name);
@@ -647,7 +647,7 @@ public function fetch($name) {
* End a capturing block. The compliment to View::start()
*
* @return void
- * @see ViewBlock::start()
+ * @see ViewBlock::end()
*/
public function end() {
return $this->Blocks->end();

0 comments on commit 571c8bc

Please sign in to comment.