mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-01 23:29:45 +00:00
Merge branch 'master' into 2.5
This commit is contained in:
commit
c1ab6fa9d1
8 changed files with 80 additions and 3 deletions
|
@ -29,7 +29,7 @@
|
||||||
<exclude name="Console/cake.bat" />
|
<exclude name="Console/cake.bat" />
|
||||||
<exclude name="Console/cake.php" />
|
<exclude name="Console/cake.php" />
|
||||||
<exclude name="Console/cake" />
|
<exclude name="Console/cake" />
|
||||||
<exclude name="./lib/Cake/Test" />
|
<exclude name="Test/**" />
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -528,6 +528,7 @@ class ExtractTask extends AppShell {
|
||||||
$msgid = $rule;
|
$msgid = $rule;
|
||||||
}
|
}
|
||||||
if ($msgid) {
|
if ($msgid) {
|
||||||
|
$msgid = $this->_formatString(sprintf("'%s'", $msgid));
|
||||||
$details = array(
|
$details = array(
|
||||||
'file' => $file,
|
'file' => $file,
|
||||||
'line' => 'validation for field ' . $field
|
'line' => 'validation for field ' . $field
|
||||||
|
|
|
@ -139,6 +139,8 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
}
|
}
|
||||||
unset($this->_joinTable, $this->_runtimeModel);
|
unset($this->_joinTable, $this->_runtimeModel);
|
||||||
return $query;
|
return $query;
|
||||||
|
} elseif (is_string($query['fields'])) {
|
||||||
|
$query['fields'] = String::tokenize($query['fields']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = array_merge(
|
$fields = array_merge(
|
||||||
|
|
|
@ -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
|
* 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.
|
* 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
|
* @return boolean True on success
|
||||||
*/
|
*/
|
||||||
public function reset($full = true) {
|
public function reset($full = true) {
|
||||||
|
|
|
@ -351,6 +351,9 @@ class ExtractTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$pattern = '#msgid "Post body is super required"#';
|
$pattern = '#msgid "Post body is super required"#';
|
||||||
$this->assertRegExp($pattern, $result);
|
$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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -232,6 +232,32 @@ class TranslateBehaviorTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals($expected, $result);
|
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3292,7 +3292,7 @@ class TranslatedArticle extends CakeTestModel {
|
||||||
public $belongsTo = array('User');
|
public $belongsTo = array('User');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* belongsTo property
|
* hasMany property
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
|
45
lib/Cake/Test/test_app/Model/Extract.php
Normal file
45
lib/Cake/Test/test_app/Model/Extract.php
Normal 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"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue