mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fix failing tests using chr(226) instead of unicode codes.
This commit is contained in:
parent
7e00be8f76
commit
8b7b139353
2 changed files with 11 additions and 10 deletions
|
@ -372,6 +372,7 @@ TEXT;
|
|||
$text9 = 'НОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыь';
|
||||
$text10 = 'http://example.com/something/foo:bar';
|
||||
|
||||
$elipsis = "\xe2\x80\xa6";
|
||||
$this->assertSame($this->Text->truncate($text1, 15), 'The quick br...');
|
||||
$this->assertSame($this->Text->truncate($text1, 15, array('exact' => false)), 'The quick...');
|
||||
$this->assertSame($this->Text->truncate($text1, 100), 'The quick brown fox jumps over the lazy dog');
|
||||
|
@ -380,17 +381,17 @@ TEXT;
|
|||
$this->assertSame($this->Text->truncate($text3, 20), '<b>© 2005-20...');
|
||||
$this->assertSame($this->Text->truncate($text4, 15), '<img src="my...');
|
||||
$this->assertSame($this->Text->truncate($text5, 6, array('ellipsis' => '')), '0<b>1<');
|
||||
$this->assertSame($this->Text->truncate($text1, 15, array('html' => true)), 'The quick brow' . chr(226));
|
||||
$this->assertSame($this->Text->truncate($text1, 15, array('exact' => false, 'html' => true)), 'The quick' . chr(226));
|
||||
$this->assertSame($this->Text->truncate($text2, 10, array('html' => true)), 'Heizölrüc' . chr(226));
|
||||
$this->assertSame($this->Text->truncate($text2, 10, array('exact' => false, 'html' => true)), chr(226));
|
||||
$this->assertSame($this->Text->truncate($text3, 20, array('html' => true)), '<b>© 2005-2007, Cake S' . chr(226) . '</b>');
|
||||
$this->assertSame($this->Text->truncate($text4, 15, array('html' => true)), '<img src="mypic.jpg"> This image ta' . chr(226));
|
||||
$this->assertSame($this->Text->truncate($text4, 45, array('html' => true)), '<img src="mypic.jpg"> This image tag is not XHTML conform!<br><hr/><b>But the' . chr(226) . '</b>');
|
||||
$this->assertSame($this->Text->truncate($text4, 90, array('html' => true)), '<img src="mypic.jpg"> This image tag is not XHTML conform!<br><hr/><b>But the following image tag should be conform <img src="mypic.jpg" alt="Me, myself and I" /></b><br />Great,' . chr(226));
|
||||
$this->assertSame($this->Text->truncate($text1, 15, array('html' => true)), 'The quick brow' . $elipsis);
|
||||
$this->assertSame($this->Text->truncate($text1, 15, array('exact' => false, 'html' => true)), 'The quick' . $elipsis);
|
||||
$this->assertSame($this->Text->truncate($text2, 10, array('html' => true)), 'Heizölrüc' . $elipsis);
|
||||
$this->assertSame($this->Text->truncate($text2, 10, array('exact' => false, 'html' => true)), $elipsis);
|
||||
$this->assertSame($this->Text->truncate($text3, 20, array('html' => true)), '<b>© 2005-2007, Cake S' . $elipsis . '</b>');
|
||||
$this->assertSame($this->Text->truncate($text4, 15, array('html' => true)), '<img src="mypic.jpg"> This image ta' . $elipsis);
|
||||
$this->assertSame($this->Text->truncate($text4, 45, array('html' => true)), '<img src="mypic.jpg"> This image tag is not XHTML conform!<br><hr/><b>But the' . $elipsis . '</b>');
|
||||
$this->assertSame($this->Text->truncate($text4, 90, array('html' => true)), '<img src="mypic.jpg"> This image tag is not XHTML conform!<br><hr/><b>But the following image tag should be conform <img src="mypic.jpg" alt="Me, myself and I" /></b><br />Great,' . $elipsis);
|
||||
$this->assertSame($this->Text->truncate($text5, 6, array('ellipsis' => '', 'html' => true)), '0<b>1<i>2<span class="myclass">3</span>4<u>5</u></i></b>');
|
||||
$this->assertSame($this->Text->truncate($text5, 20, array('ellipsis' => '', 'html' => true)), $text5);
|
||||
$this->assertSame($this->Text->truncate($text6, 57, array('exact' => false, 'html' => true)), "<p><strong>Extra dates have been announced for this year's" . chr(226) . "</strong></p>");
|
||||
$this->assertSame($this->Text->truncate($text6, 57, array('exact' => false, 'html' => true)), "<p><strong>Extra dates have been announced for this year's" . $elipsis . "</strong></p>");
|
||||
$this->assertSame($this->Text->truncate($text7, 255), $text7);
|
||||
$this->assertSame($this->Text->truncate($text7, 15), 'El moño está...');
|
||||
$this->assertSame($this->Text->truncate($text8, 15), 'Vive la R' . chr(195) . chr(169) . 'pu...');
|
||||
|
|
|
@ -479,7 +479,7 @@ class String {
|
|||
if (isset($options['ending'])) {
|
||||
$default['ellipsis'] = $options['ending'];
|
||||
} elseif (!empty($options['html']) && Configure::read('App.encoding') == 'UTF-8') {
|
||||
$default['ellipsis'] = "\xE2\x80\xA6";
|
||||
$default['ellipsis'] = "\xe2\x80\xa6";
|
||||
}
|
||||
$options = array_merge($default, $options);
|
||||
extract($options);
|
||||
|
|
Loading…
Add table
Reference in a new issue