mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-06 16:13:38 +02:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
@ -4,19 +4,18 @@
|
|||
*
|
||||
* Test Case for i18n extraction shell task
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc.
|
||||
* 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 2005-2012, Cake Software Foundation, Inc.
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP Project
|
||||
* @package Cake.Test.Case.Console.Command.Task
|
||||
* @since CakePHP v 1.2.0.7726
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('Folder', 'Utility');
|
||||
|
@ -49,7 +48,7 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
array($out, $out, $in)
|
||||
);
|
||||
$this->path = TMP . 'tests' . DS . 'extract_task_test';
|
||||
$Folder = new Folder($this->path . DS . 'locale', true);
|
||||
new Folder($this->path . DS . 'locale', true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,23 +135,23 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
// extract.ctp
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:15;6\n';
|
||||
$pattern = '/\#: extract\.ctp:15;6\n';
|
||||
$pattern .= 'msgid "You have %d new message."\nmsgid_plural "You have %d new messages."/';
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = '/msgid "You have %d new message."\nmsgstr ""/';
|
||||
$this->assertNotRegExp($pattern, $result, 'No duplicate msgid');
|
||||
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:7\n';
|
||||
$pattern = '/\#: extract\.ctp:7\n';
|
||||
$pattern .= 'msgid "You deleted %d message."\nmsgid_plural "You deleted %d messages."/';
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:14\n';
|
||||
$pattern .= '\#: (\\\\|\/)home\.ctp:99\n';
|
||||
$pattern = '/\#: extract\.ctp:14\n';
|
||||
$pattern .= '\#: home\.ctp:68\n';
|
||||
$pattern .= 'msgid "Editing this Page"\nmsgstr ""/';
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = '/\#: (\\\\|\/)extract\.ctp:22\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';
|
||||
|
@ -163,6 +162,21 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly');
|
||||
$this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly');
|
||||
|
||||
$pattern = '/\#: extract\.ctp:36\nmsgid "letter"/';
|
||||
$this->assertRegExp($pattern, $result, 'Strings with context should not overwrite strings without context');
|
||||
|
||||
$pattern = '/\#: extract\.ctp:37;39\nmsgctxt "A"\nmsgid "letter"/';
|
||||
$this->assertRegExp($pattern, $result, 'Should contain string with context "A"');
|
||||
|
||||
$pattern = '/\#: extract\.ctp:38\nmsgctxt "B"\nmsgid "letter"/';
|
||||
$this->assertRegExp($pattern, $result, 'Should contain string with context "B"');
|
||||
|
||||
$pattern = '/\#: extract\.ctp:40\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
||||
$this->assertRegExp($pattern, $result, 'Plural strings with context should not overwrite strings without context');
|
||||
|
||||
$pattern = '/\#: extract\.ctp:41\nmsgctxt "A"\nmsgid "%d letter"\nmsgid_plural "%d letters"/';
|
||||
$this->assertRegExp($pattern, $result, 'Should contain plural string with context "A"');
|
||||
|
||||
// extract.ctp - reading the domain.pot
|
||||
$result = file_get_contents($this->path . DS . 'domain.pot');
|
||||
|
||||
|
@ -177,6 +191,64 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->assertRegExp($pattern, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testExtractCategory method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExtractCategory() {
|
||||
$this->Task->interactive = false;
|
||||
|
||||
$this->Task->params['paths'] = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages';
|
||||
$this->Task->params['output'] = $this->path . DS;
|
||||
$this->Task->params['extract-core'] = 'no';
|
||||
$this->Task->params['merge'] = 'no';
|
||||
$this->Task->expects($this->never())->method('err');
|
||||
$this->Task->expects($this->any())->method('in')
|
||||
->will($this->returnValue('y'));
|
||||
$this->Task->expects($this->never())->method('_stop');
|
||||
|
||||
$this->Task->execute();
|
||||
$this->assertTrue(file_exists($this->path . DS . 'LC_NUMERIC' . DS . 'default.pot'));
|
||||
$this->assertFalse(file_exists($this->path . DS . 'LC_TIME' . DS . 'default.pot'));
|
||||
|
||||
$result = file_get_contents($this->path . DS . 'default.pot');
|
||||
|
||||
$pattern = '/\#: .*extract\.ctp:31\n/';
|
||||
$this->assertNotRegExp($pattern, $result);
|
||||
|
||||
$pattern = '/\#: .*extract\.ctp:33\n/';
|
||||
$this->assertNotRegExp($pattern, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testExtractWithoutLocations method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExtractWithoutLocations() {
|
||||
$this->Task->interactive = false;
|
||||
|
||||
$this->Task->params['paths'] = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages';
|
||||
$this->Task->params['output'] = $this->path . DS;
|
||||
$this->Task->params['extract-core'] = 'no';
|
||||
$this->Task->params['merge'] = 'no';
|
||||
$this->Task->params['no-location'] = true;
|
||||
|
||||
$this->Task->expects($this->never())->method('err');
|
||||
$this->Task->expects($this->any())->method('in')
|
||||
->will($this->returnValue('y'));
|
||||
$this->Task->expects($this->never())->method('_stop');
|
||||
|
||||
$this->Task->execute();
|
||||
$this->assertTrue(file_exists($this->path . DS . 'default.pot'));
|
||||
|
||||
$result = file_get_contents($this->path . DS . 'default.pot');
|
||||
|
||||
$pattern = '/\n\#: .*\n/';
|
||||
$this->assertNotRegExp($pattern, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test exclusions
|
||||
*
|
||||
|
@ -267,7 +339,7 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->out = $this->getMock('ConsoleOutput', array(), array(), '', false);
|
||||
$this->in = $this->getMock('ConsoleInput', array(), array(), '', false);
|
||||
$this->Task = $this->getMock('ExtractTask',
|
||||
array('_isExtractingApp', '_extractValidationMessages', 'in', 'out', 'err', 'clear', '_stop'),
|
||||
array('_isExtractingApp', 'in', 'out', 'err', 'clear', '_stop'),
|
||||
array($this->out, $this->out, $this->in)
|
||||
);
|
||||
|
||||
|
@ -279,6 +351,7 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->assertNotRegExp('#Pages#', $result);
|
||||
$this->assertContains('translate.ctp:1', $result);
|
||||
$this->assertContains('This is a translatable string', $result);
|
||||
$this->assertContains('I can haz plugin model validation message', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,10 +381,10 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->Task->execute();
|
||||
$result = file_get_contents($this->path . DS . 'default.pot');
|
||||
|
||||
$pattern = preg_quote('#Model' . DS . 'PersisterOne.php:validation for field title#', '\\');
|
||||
$pattern = preg_quote('#Model/PersisterOne.php:validation for field title#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = preg_quote('#Model' . DS . 'PersisterOne.php:validation for field body#', '\\');
|
||||
$pattern = preg_quote('#Model/PersisterOne.php:validation for field body#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = '#msgid "Post title is required"#';
|
||||
|
@ -325,6 +398,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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -354,10 +430,10 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->Task->execute();
|
||||
$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/TestPlugin/Model/TestPluginPost.php:validation for field title#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
|
||||
$pattern = preg_quote('#Plugin/TestPlugin/Model/TestPluginPost.php:validation for field body#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = '#msgid "Post title is required"#';
|
||||
|
@ -393,10 +469,10 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->Task->execute();
|
||||
$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/TestPluginPost.php:validation for field title#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
|
||||
$pattern = preg_quote('#Model/TestPluginPost.php:validation for field body#', '\\');
|
||||
$this->assertRegExp($pattern, $result);
|
||||
|
||||
$pattern = '#msgid "Post title is required"#';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue