mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
legacy support with test cases
This commit is contained in:
parent
40398429ff
commit
7969062614
2 changed files with 23 additions and 3 deletions
|
@ -459,6 +459,27 @@ podeís adquirirla.</span></p>
|
|||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testTruncate method with non utf8 sites
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testTruncateLegacy() {
|
||||
Configure::write('App.encoding', 'ISO-8859-1');
|
||||
$text = '<b>© 2005-2007, Cake Software Foundation, Inc.</b><br />written by Alexander Wegener';
|
||||
$result = $this->Text->truncate($text, 31, array(
|
||||
'exact' => false,
|
||||
));
|
||||
$expected = '<b>© 2005-2007, Cake...';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Text->truncate($text, 31, array(
|
||||
'exact' => true,
|
||||
));
|
||||
$expected = '<b>© 2005-2007, Cake So...';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testTail method
|
||||
*
|
||||
|
|
|
@ -480,11 +480,10 @@ class String {
|
|||
$default = array(
|
||||
'ellipsis' => '...', 'exact' => true, 'html' => false
|
||||
);
|
||||
if (!empty($options['html'])) {
|
||||
$default['ellipsis'] = chr(226);
|
||||
}
|
||||
if (isset($options['ending'])) {
|
||||
$default['ellipsis'] = $options['ending'];
|
||||
} elseif (!empty($options['html']) && Configure::read('App.encoding') == 'UTF-8') {
|
||||
$default['ellipsis'] = chr(226);
|
||||
}
|
||||
$options = array_merge($default, $options);
|
||||
extract($options);
|
||||
|
|
Loading…
Add table
Reference in a new issue