mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.1' into 2.2
Conflicts: lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
This commit is contained in:
commit
f8966a64f2
12 changed files with 319 additions and 275 deletions
|
@ -58,7 +58,7 @@ class EmailConfig {
|
|||
'username' => 'user',
|
||||
'password' => 'secret',
|
||||
'client' => null,
|
||||
'log' => false
|
||||
'log' => false,
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
|
|
@ -88,7 +88,8 @@ class L10n {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_l10nMap = array(/* Afrikaans */ 'afr' => 'af',
|
||||
protected $_l10nMap = array(
|
||||
/* Afrikaans */ 'afr' => 'af',
|
||||
/* Albanian */ 'alb' => 'sq',
|
||||
/* Arabic */ 'ara' => 'ar',
|
||||
/* Armenian - Armenia */ 'hye' => 'hy',
|
||||
|
@ -166,7 +167,8 @@ class L10n {
|
|||
/* Welsh */ 'cym' => 'cy',
|
||||
/* Xhosa */ 'xho' => 'xh',
|
||||
/* Yiddish */ 'yid' => 'yi',
|
||||
/* Zulu */ 'zul' => 'zu');
|
||||
/* Zulu */ 'zul' => 'zu'
|
||||
);
|
||||
|
||||
/**
|
||||
* HTTP_ACCEPT_LANGUAGE catalog
|
||||
|
@ -175,7 +177,8 @@ class L10n {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_l10nCatalog = array('af' => array('language' => 'Afrikaans', 'locale' => 'afr', 'localeFallback' => 'afr', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
protected $_l10nCatalog = array(
|
||||
'af' => array('language' => 'Afrikaans', 'locale' => 'afr', 'localeFallback' => 'afr', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'ar' => array('language' => 'Arabic', 'locale' => 'ara', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||
'ar-ae' => array('language' => 'Arabic (U.A.E.)', 'locale' => 'ar_ae', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||
'ar-bh' => array('language' => 'Arabic (Bahrain)', 'locale' => 'ar_bh', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||
|
@ -317,7 +320,8 @@ class L10n {
|
|||
'zh-hk' => array('language' => 'Chinese (Hong Kong)', 'locale' => 'zh_hk', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'zh-sg' => array('language' => 'Chinese (Singapore)', 'locale' => 'zh_sg', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'zh-tw' => array('language' => 'Chinese (Taiwan)', 'locale' => 'zh_tw', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'zu' => array('language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8', 'direction' => 'ltr'));
|
||||
'zu' => array('language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
);
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
|
@ -339,9 +343,12 @@ class L10n {
|
|||
public function get($language = null) {
|
||||
if ($language !== null) {
|
||||
return $this->_setLanguage($language);
|
||||
} elseif ($this->_autoLanguage() === false) {
|
||||
return $this->_setLanguage();
|
||||
}
|
||||
|
||||
if (!$this->_autoLanguage()) {
|
||||
$this->_setLanguage();
|
||||
}
|
||||
return $this->lang;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -137,7 +137,7 @@ class DboSource extends DataSource {
|
|||
/**
|
||||
* Caches serialized results of executed queries
|
||||
*
|
||||
* @var array Maximum number of queries in the queries log.
|
||||
* @var array Cache of results from executed sql queries.
|
||||
*/
|
||||
protected $_queryCache = array();
|
||||
|
||||
|
|
|
@ -54,14 +54,16 @@ class ShellTestShell extends Shell {
|
|||
$this->stopped = $status;
|
||||
}
|
||||
|
||||
public function do_something() {
|
||||
protected function _secret() {
|
||||
}
|
||||
|
||||
protected function _secret() {
|
||||
//@codingStandardsIgnoreStart
|
||||
public function do_something() {
|
||||
}
|
||||
|
||||
protected function no_access() {
|
||||
}
|
||||
//@codingStandardsIgnoreEnd
|
||||
|
||||
public function mergeVars($properties, $class, $normalize = true) {
|
||||
return $this->_mergeVars($properties, $class, $normalize);
|
||||
|
|
|
@ -289,6 +289,7 @@ class TestController extends ControllerTestAppController {
|
|||
return 'I am from the controller.';
|
||||
}
|
||||
|
||||
//@codingStandardsIgnoreStart
|
||||
protected function protected_m() {
|
||||
}
|
||||
|
||||
|
@ -297,6 +298,7 @@ class TestController extends ControllerTestAppController {
|
|||
|
||||
public function _hidden() {
|
||||
}
|
||||
//@codingStandardsIgnoreEnd
|
||||
|
||||
public function admin_add() {
|
||||
}
|
||||
|
|
|
@ -34,8 +34,9 @@ class L10nTest extends CakeTestCase {
|
|||
$localize = new L10n();
|
||||
|
||||
// Catalog Entry
|
||||
$localize->get('en');
|
||||
$lang = $localize->get('en');
|
||||
|
||||
$this->assertEquals('en', $lang);
|
||||
$this->assertEquals('English', $localize->language);
|
||||
$this->assertEquals(array('eng', 'eng'), $localize->languagePath);
|
||||
$this->assertEquals('eng', $localize->locale);
|
||||
|
@ -57,8 +58,9 @@ class L10nTest extends CakeTestCase {
|
|||
// Default Entry
|
||||
define('DEFAULT_LANGUAGE', 'en-us');
|
||||
|
||||
$localize->get('use_default');
|
||||
$lang = $localize->get('use_default');
|
||||
|
||||
$this->assertEquals('en-us', $lang);
|
||||
$this->assertEquals('English (United States)', $localize->language);
|
||||
$this->assertEquals(array('en_us', 'eng'), $localize->languagePath);
|
||||
$this->assertEquals('en_us', $localize->locale);
|
||||
|
@ -86,15 +88,17 @@ class L10nTest extends CakeTestCase {
|
|||
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'inexistent,en-ca';
|
||||
|
||||
$localize = new L10n();
|
||||
$localize->get();
|
||||
$lang = $localize->get();
|
||||
|
||||
$this->assertEquals('en-ca', $lang);
|
||||
$this->assertEquals('English (Canadian)', $localize->language);
|
||||
$this->assertEquals(array('en_ca', 'eng', 'eng'), $localize->languagePath);
|
||||
$this->assertEquals('en_ca', $localize->locale);
|
||||
|
||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'es_mx';
|
||||
$localize->get();
|
||||
$lang = $localize->get();
|
||||
|
||||
$this->assertEquals('es-mx', $lang);
|
||||
$this->assertEquals('Spanish (Mexican)', $localize->language);
|
||||
$this->assertEquals(array('es_mx', 'spa', 'eng'), $localize->languagePath);
|
||||
$this->assertEquals('es_mx', $localize->locale);
|
||||
|
|
|
@ -1241,7 +1241,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
$this->assertContains('Content-Type: text/html; charset=utf-8', $message);
|
||||
|
||||
// UTF-8 is 8bit
|
||||
$this->assertTrue($this->checkContentTransferEncoding($message, '8bit'));
|
||||
$this->assertTrue($this->_checkContentTransferEncoding($message, '8bit'));
|
||||
|
||||
$this->CakeEmail->charset = 'ISO-2022-JP';
|
||||
$this->CakeEmail->send();
|
||||
|
@ -1250,7 +1250,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
$this->assertContains('Content-Type: text/html; charset=ISO-2022-JP', $message);
|
||||
|
||||
// ISO-2022-JP is 7bit
|
||||
$this->assertTrue($this->checkContentTransferEncoding($message, '7bit'));
|
||||
$this->assertTrue($this->_checkContentTransferEncoding($message, '7bit'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,7 +1511,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
$this->assertContains(mb_convert_encoding('ってテーブルを作ってやってたらう','ISO-2022-JP'), $result['message']);
|
||||
}
|
||||
|
||||
public function checkContentTransferEncoding($message, $charset) {
|
||||
protected function _checkContentTransferEncoding($message, $charset) {
|
||||
$boundary = '--alt-' . $this->CakeEmail->getBoundary();
|
||||
$result['text'] = false;
|
||||
$result['html'] = false;
|
||||
|
@ -1541,6 +1541,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
/**
|
||||
* Test CakeEmail::_encode function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEncode() {
|
||||
$this->skipIf(!function_exists('mb_convert_encoding'));
|
||||
|
|
|
@ -32,7 +32,7 @@ require_once dirname(dirname(__FILE__)) . DS . 'Model' . DS . 'models.php';
|
|||
* @package Cake.Test.Case.TestSuite
|
||||
*/
|
||||
if (!class_exists('AppController', false)) {
|
||||
/**
|
||||
/**
|
||||
* AppController class
|
||||
*
|
||||
* @package Cake.Test.Case.TestSuite
|
||||
|
|
|
@ -355,6 +355,9 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$result = $this->Html->image('/test/view/1.gif');
|
||||
$this->assertTags($result, array('img' => array('src' => '/test/view/1.gif', 'alt' => '')));
|
||||
|
||||
$result = $this->Html->image('test.gif?one=two&three=four');
|
||||
$this->assertTags($result, array('img' => array('src' => 'img/test.gif?one=two&three=four', 'alt' => '')));
|
||||
|
||||
$result = $this->Html->image('test.gif', array('fullBase' => true));
|
||||
$here = $this->Html->url('/', true);
|
||||
$this->assertTags($result, array('img' => array('src' => $here . 'img/test.gif', 'alt' => '')));
|
||||
|
@ -515,6 +518,10 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected['link']['href'] = 'preg:/.*css\/screen\.css\?1234/';
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Html->css('screen.css?with=param&other=param');
|
||||
$expected['link']['href'] = 'css/screen.css?with=param&other=param';
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Html->css('http://whatever.com/screen.css?1234');
|
||||
$expected['link']['href'] = 'preg:/http:\/\/.*\/screen\.css\?1234/';
|
||||
$this->assertTags($result, $expected);
|
||||
|
@ -787,6 +794,12 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Html->script('test.json.js?foo=bar&other=test');
|
||||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => 'js/test.json.js?foo=bar&other=test')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Html->script('foo');
|
||||
$this->assertNull($result, 'Script returned upon duplicate inclusion %s');
|
||||
|
||||
|
|
|
@ -193,6 +193,8 @@ class HelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
ClassRegistry::flush();
|
||||
Router::reload();
|
||||
$null = null;
|
||||
|
@ -215,9 +217,11 @@ class HelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
Configure::delete('Asset');
|
||||
|
||||
CakePlugin::unload();
|
||||
unset($this->Helper, $this->View);
|
||||
ClassRegistry::flush();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -565,9 +569,7 @@ class HelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testAssetTimestamp() {
|
||||
$_timestamp = Configure::read('Asset.timestamp');
|
||||
$_debug = Configure::read('debug');
|
||||
|
||||
Configure::write('Foo.bar', 'test');
|
||||
Configure::write('Asset.timestamp', false);
|
||||
$result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css');
|
||||
$this->assertEquals(CSS_URL . 'cake.generic.css', $result);
|
||||
|
@ -593,9 +595,6 @@ class HelperTest extends CakeTestCase {
|
|||
$this->Helper->request->webroot = '/some/dir/';
|
||||
$result = $this->Helper->assetTimestamp('/some/dir/' . CSS_URL . 'cake.generic.css');
|
||||
$this->assertRegExp('/' . preg_quote(CSS_URL . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
||||
|
||||
Configure::write('debug', $_debug);
|
||||
Configure::write('Asset.timestamp', $_timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -605,8 +604,6 @@ class HelperTest extends CakeTestCase {
|
|||
*/
|
||||
public function testAssetUrl() {
|
||||
$this->Helper->webroot = '';
|
||||
$_timestamp = Configure::read('Asset.timestamp');
|
||||
|
||||
$result = $this->Helper->assetUrl(array(
|
||||
'controller' => 'js',
|
||||
'action' => 'post',
|
||||
|
@ -625,6 +622,17 @@ class HelperTest extends CakeTestCase {
|
|||
$result = $this->Helper->assetUrl('style', array('ext' => '.css'));
|
||||
$this->assertEqual('style.css', $result);
|
||||
|
||||
$result = $this->Helper->assetUrl('foo.jpg?one=two&three=four');
|
||||
$this->assertEquals('foo.jpg?one=two&three=four', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test assetUrl with plugins.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAssetUrlPlugin() {
|
||||
$this->Helper->webroot = '';
|
||||
CakePlugin::load('TestPlugin');
|
||||
|
||||
$result = $this->Helper->assetUrl('TestPlugin.style', array('ext' => '.css'));
|
||||
|
@ -634,13 +642,19 @@ class HelperTest extends CakeTestCase {
|
|||
$this->assertEqual('TestPlugin.style.css', $result);
|
||||
|
||||
CakePlugin::unload('TestPlugin');
|
||||
}
|
||||
|
||||
/**
|
||||
* test assetUrl and Asset.timestamp = force
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAssetUrlTimestampForce() {
|
||||
$this->Helper->webroot = '';
|
||||
Configure::write('Asset.timestamp', 'force');
|
||||
|
||||
$result = $this->Helper->assetUrl('cake.generic.css', array('pathPrefix' => CSS_URL));
|
||||
$this->assertRegExp('/' . preg_quote(CSS_URL . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
||||
|
||||
Configure::write('Asset.timestamp', $_timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -649,7 +663,6 @@ class HelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testAssetTimestampPluginsAndThemes() {
|
||||
$timestamp = Configure::read('Asset.timestamp');
|
||||
Configure::write('Asset.timestamp', 'force');
|
||||
App::build(array(
|
||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS),
|
||||
|
@ -667,9 +680,6 @@ class HelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Helper->assetTimestamp('/theme/test_theme/js/non_existant.js');
|
||||
$this->assertRegExp('#/theme/test_theme/js/non_existant.js\?$#', $result, 'No error on missing file');
|
||||
|
||||
App::build();
|
||||
Configure::write('Asset.timestamp', $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -192,19 +192,30 @@ class CakeNumber {
|
|||
*
|
||||
* ### Options
|
||||
*
|
||||
* - `before` - The currency symbol to place before whole numbers ie. '$'
|
||||
* - `after` - The currency symbol to place after decimal numbers ie. 'c'. Set to boolean false to
|
||||
* use no decimal symbol. eg. 0.35 => $0.35.
|
||||
* - `zero` - The text to use for zero values, can be a string or a number. ie. 0, 'Free!'
|
||||
* - `wholeSymbol` - The currency symbol to use for whole numbers,
|
||||
* greater than 1, or less than -1.
|
||||
* - `wholePosition` - The position the whole symbol should be placed
|
||||
* valid options are 'before' & 'after'.
|
||||
* - `fractionSymbol` - The currency symbol to use for fractional numbers.
|
||||
* - `fractionPosition` - The position the fraction symbol should be placed
|
||||
* valid options are 'before' & 'after'.
|
||||
* - `before` - The currency symbol to place before whole numbers
|
||||
* ie. '$'. `before` is an alias for `wholeSymbol`.
|
||||
* - `after` - The currency symbol to place after decimal numbers
|
||||
* ie. 'c'. Set to boolean false to use no decimal symbol.
|
||||
* eg. 0.35 => $0.35. `after` is an alias for `fractionSymbol`
|
||||
* - `zero` - The text to use for zero values, can be a
|
||||
* string or a number. ie. 0, 'Free!'
|
||||
* - `places` - Number of decimal places to use. ie. 2
|
||||
* - `thousands` - Thousands separator ie. ','
|
||||
* - `decimals` - Decimal separator symbol ie. '.'
|
||||
* - `negative` - Symbol for negative numbers. If equal to '()', the number will be wrapped with ( and )
|
||||
* - `negative` - Symbol for negative numbers. If equal to '()',
|
||||
* the number will be wrapped with ( and )
|
||||
* - `escape` - Should the output be htmlentity escaped? Defaults to true
|
||||
*
|
||||
* @param float $number
|
||||
* @param string $currency Shortcut to default options. Valid values are 'USD', 'EUR', 'GBP', otherwise
|
||||
* set at least 'before' and 'after' options.
|
||||
* @param string $currency Shortcut to default options. Valid values are
|
||||
* 'USD', 'EUR', 'GBP', otherwise set at least 'before' and 'after' options.
|
||||
* @param array $options
|
||||
* @return string Number formatted as a currency.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::currency
|
||||
|
@ -269,14 +280,8 @@ class CakeNumber {
|
|||
*
|
||||
* {{{ $number->currency($value, 'NOK'); }}}
|
||||
*
|
||||
* Added formats are merged with the following defaults.
|
||||
*
|
||||
* {{{
|
||||
* array(
|
||||
* 'before' => '$', 'after' => 'c', 'zero' => 0, 'places' => 2, 'thousands' => ',',
|
||||
* 'decimals' => '.', 'negative' => '()', 'escape' => true
|
||||
* )
|
||||
* }}}
|
||||
* Added formats are merged with the defaults defined in CakeNumber::$_currencyDefaults
|
||||
* See CakeNumber::currency() for more information on the various options and their function.
|
||||
*
|
||||
* @param string $formatName The format name to be used in the future.
|
||||
* @param array $options The array of options for this format.
|
||||
|
|
|
@ -296,7 +296,7 @@ class Helper extends Object {
|
|||
if (isset($plugin)) {
|
||||
$path = Inflector::underscore($plugin) . '/' . $path;
|
||||
}
|
||||
$path = $this->assetTimestamp($this->webroot($path));
|
||||
$path = h($this->assetTimestamp($this->webroot($path)));
|
||||
|
||||
if (!empty($options['fullBase'])) {
|
||||
$path = $this->url('/', true) . $path;
|
||||
|
|
Loading…
Reference in a new issue