mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Merge pull request #2731 from joostdekeijzer/console-extract-not-handling-validation-quotes
Console Extract task doesn't handle validation messages with qoutes correctly
This commit is contained in:
commit
8db034cbf1
3 changed files with 49 additions and 0 deletions
|
@ -525,6 +525,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
|
||||||
|
|
|
@ -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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
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