Merge branch 'master' into 2.5

This commit is contained in:
mark_story 2014-01-30 10:13:37 -05:00
commit c1ab6fa9d1
8 changed files with 80 additions and 3 deletions

View file

@ -29,7 +29,7 @@
<exclude name="Console/cake.bat" />
<exclude name="Console/cake.php" />
<exclude name="Console/cake" />
<exclude name="./lib/Cake/Test" />
<exclude name="Test/**" />
</fileset>
<!--

View file

@ -528,6 +528,7 @@ class ExtractTask extends AppShell {
$msgid = $rule;
}
if ($msgid) {
$msgid = $this->_formatString(sprintf("'%s'", $msgid));
$details = array(
'file' => $file,
'line' => 'validation for field ' . $field

View file

@ -139,6 +139,8 @@ class TranslateBehavior extends ModelBehavior {
}
unset($this->_joinTable, $this->_runtimeModel);
return $query;
} elseif (is_string($query['fields'])) {
$query['fields'] = String::tokenize($query['fields']);
}
$fields = array_merge(

View file

@ -1012,7 +1012,7 @@ class HttpSocket extends CakeSocket {
* Resets the state of this HttpSocket instance to it's initial state (before Object::__construct got executed) or does
* the same thing partially for the request and the response property only.
*
* @param boolean $full If set to false only HttpSocket::response and HttpSocket::request are reseted
* @param boolean $full If set to false only HttpSocket::response and HttpSocket::request are reset
* @return boolean True on success
*/
public function reset($full = true) {

View file

@ -351,6 +351,9 @@ class ExtractTaskTest extends CakeTestCase {
$pattern = '#msgid "Post body is super required"#';
$this->assertRegExp($pattern, $result);
$this->assertContains('msgid "double \\"quoted\\" validation"', $result, 'Strings with quotes not handled correctly');
$this->assertContains("msgid \"single 'quoted' validation\"", $result, 'Strings with quotes not handled correctly');
}
/**

View file

@ -232,6 +232,32 @@ class TranslateBehaviorTest extends CakeTestCase {
)
);
$this->assertEquals($expected, $result);
$result = $TestModel->field('title', array('TranslatedItem.id' => 1));
$expected = 'Title #1';
$this->assertEquals($expected, $result);
$result = $TestModel->read('title', 1);
$expected = array(
'TranslatedItem' => array(
'id' => 1,
'slug' => 'first_translated',
'locale' => 'eng',
'title' => 'Title #1',
'translated_article_id' => 1,
)
);
$this->assertEquals($expected, $result);
$result = $TestModel->read('id, title', 1);
$expected = array(
'TranslatedItem' => array(
'id' => 1,
'locale' => 'eng',
'title' => 'Title #1',
)
);
$this->assertEquals($expected, $result);
}
/**

View file

@ -3292,7 +3292,7 @@ class TranslatedArticle extends CakeTestModel {
public $belongsTo = array('User');
/**
* belongsTo property
* hasMany property
*
* @var array
*/

View file

@ -0,0 +1,45 @@
<?php
/**
* Test App Extract Model
*
* CakePHP : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP Project
* @package Cake.Test.TestApp.Model
* @since CakePHP v 2.4
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
/**
* Class Extract
*
* For testing Console i18n validation message extraction with quotes
*
* @package Cake.Test.TestApp.Model
*/
class Extract extends AppModel {
public $useTable = false;
public $validate = array(
'title' => array(
'custom' => array(
'rule' => array('custom', '.*'),
'allowEmpty' => true,
'required' => false,
'message' => 'double "quoted" validation'
),
'between' => array(
'rule' => array('between', 5, 15),
'message' => "single 'quoted' validation"
)
),
);
}