mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.5
This commit is contained in:
commit
3c1f775ab2
3 changed files with 33 additions and 18 deletions
|
@ -44,8 +44,10 @@ class MailTransport extends AbstractTransport {
|
|||
$headers[$key] = str_replace(array("\r", "\n"), '', $header);
|
||||
}
|
||||
$headers = $this->_headersToString($headers, $eol);
|
||||
$message = implode($eol, $email->message());
|
||||
$subject = str_replace(array("\r", "\n"), '', $email->subject());
|
||||
$to = str_replace(array("\r", "\n"), '', $to);
|
||||
|
||||
$message = implode($eol, $email->message());
|
||||
|
||||
$params = isset($this->_config['additionalParameters']) ? $this->_config['additionalParameters'] : null;
|
||||
$this->_mail($to, $subject, $message, $headers, $params);
|
||||
|
|
|
@ -141,31 +141,31 @@ class CakeNumberTest extends CakeTestCase {
|
|||
public function testMultibyteFormat() {
|
||||
$value = '5199100.0006';
|
||||
$result = $this->Number->format($value, array(
|
||||
'thousands' => ' ',
|
||||
'decimals' => '&',
|
||||
'places' => 3,
|
||||
'escape' => false,
|
||||
'before' => '',
|
||||
'thousands' => ' ',
|
||||
'decimals' => '&',
|
||||
'places' => 3,
|
||||
'escape' => false,
|
||||
'before' => '',
|
||||
));
|
||||
$expected = '5 199 100&001';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$value = 1000.45;
|
||||
$result = $this->Number->format($value, array(
|
||||
'thousands' => ',,',
|
||||
'decimals' => '.a',
|
||||
'escape' => false,
|
||||
'thousands' => ',,',
|
||||
'decimals' => '.a',
|
||||
'escape' => false,
|
||||
));
|
||||
$expected = '$1,,000.a45';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$value = 519919827593784.00;
|
||||
$this->Number->addFormat('RUR', array(
|
||||
'thousands' => 'ø€ƒ‡™',
|
||||
'decimals' => '(§.§)',
|
||||
'escape' => false,
|
||||
'wholeSymbol' => '€',
|
||||
'wholePosition' => 'after',
|
||||
'thousands' => 'ø€ƒ‡™',
|
||||
'decimals' => '(§.§)',
|
||||
'escape' => false,
|
||||
'wholeSymbol' => '€',
|
||||
'wholePosition' => 'after',
|
||||
));
|
||||
$result = $this->Number->currency($value, 'RUR');
|
||||
$expected = '519ø€ƒ‡™919ø€ƒ‡™827ø€ƒ‡™593ø€ƒ‡™784(§.§)00€';
|
||||
|
@ -173,9 +173,9 @@ class CakeNumberTest extends CakeTestCase {
|
|||
|
||||
$value = '13371337.1337';
|
||||
$result = CakeNumber::format($value, array(
|
||||
'thousands' => '- |-| /-\ >< () |2 -',
|
||||
'decimals' => '- £€€† -',
|
||||
'before' => ''
|
||||
'thousands' => '- |-| /-\ >< () |2 -',
|
||||
'decimals' => '- £€€† -',
|
||||
'before' => ''
|
||||
));
|
||||
$expected = '13- |-| /-\ >< () |2 -371- |-| /-\ >< () |2 -337- £€€† -13';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -335,6 +335,19 @@ class CakeNumberTest extends CakeTestCase {
|
|||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the default fraction handling does not cause issues.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCurrencyFractionSymbol() {
|
||||
$result = $this->Number->currency(0.2, '', array(
|
||||
'places' => 2,
|
||||
'decimal' => '.'
|
||||
));
|
||||
$this->assertEquals('0.2', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test adding currency format options to the number helper
|
||||
*
|
||||
|
|
|
@ -75,7 +75,7 @@ class CakeNumber {
|
|||
* @var array
|
||||
*/
|
||||
protected static $_currencyDefaults = array(
|
||||
'wholeSymbol' => '', 'wholePosition' => 'before', 'fractionSymbol' => '', 'fractionPosition' => 'after',
|
||||
'wholeSymbol' => '', 'wholePosition' => 'before', 'fractionSymbol' => false, 'fractionPosition' => 'after',
|
||||
'zero' => '0', 'places' => 2, 'thousands' => ',', 'decimals' => '.', 'negative' => '()', 'escape' => true,
|
||||
'fractionExponent' => 2
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue