mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
fixes #6455, adding define for LC_MESSAGES
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8221 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
68d333d088
commit
72546f3839
2 changed files with 19 additions and 12 deletions
|
@ -34,6 +34,13 @@
|
||||||
define('WEEK', 7 * DAY);
|
define('WEEK', 7 * DAY);
|
||||||
define('MONTH', 30 * DAY);
|
define('MONTH', 30 * DAY);
|
||||||
define('YEAR', 365 * DAY);
|
define('YEAR', 365 * DAY);
|
||||||
|
/**
|
||||||
|
* Add constant for LC_MESSAGES because it is not defined on windows
|
||||||
|
*/
|
||||||
|
if (!defined('LC_MESSAGES')) {
|
||||||
|
define('LC_MESSAGES', 6);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch for PHP < 5.0
|
* Patch for PHP < 5.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -388,16 +388,16 @@ class BasicsTest extends CakeTestCase {
|
||||||
function test__c() {
|
function test__c() {
|
||||||
Configure::write('Config.language', 'rule_1_po');
|
Configure::write('Config.language', 'rule_1_po');
|
||||||
|
|
||||||
$result = __c('Plural Rule 1', 5, true);
|
$result = __c('Plural Rule 1', LC_MESSAGES, true);
|
||||||
$expected = 'Plural Rule 1 (translated)';
|
$expected = 'Plural Rule 1 (translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = __c('Plural Rule 1 (from core)', 5, true);
|
$result = __c('Plural Rule 1 (from core)', LC_MESSAGES, true);
|
||||||
$expected = 'Plural Rule 1 (from core translated)';
|
$expected = 'Plural Rule 1 (from core translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
__c('Plural Rule 1 (from core)', 5);
|
__c('Plural Rule 1 (from core)', LC_MESSAGES);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = 'Plural Rule 1 (from core translated)';
|
$expected = 'Plural Rule 1 (from core translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
@ -411,24 +411,24 @@ class BasicsTest extends CakeTestCase {
|
||||||
function test__dc() {
|
function test__dc() {
|
||||||
Configure::write('Config.language', 'rule_1_po');
|
Configure::write('Config.language', 'rule_1_po');
|
||||||
|
|
||||||
$result = __dc('default', 'Plural Rule 1', 5, true);
|
$result = __dc('default', 'Plural Rule 1', LC_MESSAGES, true);
|
||||||
$expected = 'Plural Rule 1 (translated)';
|
$expected = 'Plural Rule 1 (translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = __dc('default', 'Plural Rule 1 (from core)', 5, true);
|
$result = __dc('default', 'Plural Rule 1 (from core)', LC_MESSAGES, true);
|
||||||
$expected = 'Plural Rule 1 (from core translated)';
|
$expected = 'Plural Rule 1 (from core translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = __dc('core', 'Plural Rule 1', 5, true);
|
$result = __dc('core', 'Plural Rule 1', LC_MESSAGES, true);
|
||||||
$expected = 'Plural Rule 1';
|
$expected = 'Plural Rule 1';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = __dc('core', 'Plural Rule 1 (from core)', 5, true);
|
$result = __dc('core', 'Plural Rule 1 (from core)', LC_MESSAGES, true);
|
||||||
$expected = 'Plural Rule 1 (from core translated)';
|
$expected = 'Plural Rule 1 (from core translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
__dc('default', 'Plural Rule 1 (from core)', 5);
|
__dc('default', 'Plural Rule 1 (from core)', LC_MESSAGES);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = 'Plural Rule 1 (from core translated)';
|
$expected = 'Plural Rule 1 (from core translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
@ -442,20 +442,20 @@ class BasicsTest extends CakeTestCase {
|
||||||
function test__dcn() {
|
function test__dcn() {
|
||||||
Configure::write('Config.language', 'rule_1_po');
|
Configure::write('Config.language', 'rule_1_po');
|
||||||
|
|
||||||
$result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, 5, true);
|
$result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, LC_MESSAGES, true);
|
||||||
$expected = '%d = 0 or > 1 (translated)';
|
$expected = '%d = 0 or > 1 (translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 5, true);
|
$result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, LC_MESSAGES, true);
|
||||||
$expected = '%d = 1 (from core translated)';
|
$expected = '%d = 1 (from core translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, 5, true);
|
$result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, LC_MESSAGES, true);
|
||||||
$expected = '%d = 0 or > 1';
|
$expected = '%d = 0 or > 1';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
__dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 5);
|
__dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, LC_MESSAGES);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = '%d = 1 (from core translated)';
|
$expected = '%d = 1 (from core translated)';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
Loading…
Add table
Reference in a new issue