mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Added more tests to wrap. Fixed to not cut words with more than should limit.
This commit is contained in:
parent
985743dc50
commit
f661e37ef1
2 changed files with 21 additions and 1 deletions
|
@ -889,7 +889,7 @@ class CakeEmail {
|
|||
$line = '.' . $line;
|
||||
}
|
||||
if (!preg_match('/\<[a-z]/i', $line)) {
|
||||
$formatted = array_merge($formatted, explode("\n", wordwrap($line, self::LINE_LENGTH_SHOULD, "\n", true)));
|
||||
$formatted = array_merge($formatted, explode("\n", wordwrap($line, self::LINE_LENGTH_SHOULD, "\n")));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -509,6 +509,26 @@ class CakeEmailTest extends CakeTestCase {
|
|||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$text = 'Lorem ipsum <a href="http://www.cakephp.org/controller/action/param1/param2" class="nice cool fine amazing awesome">ok</a>';
|
||||
$result = $this->CakeEmail->wrap($text);
|
||||
$expected = array(
|
||||
'Lorem ipsum',
|
||||
'<a href="http://www.cakephp.org/controller/action/param1/param2" class="nice cool fine amazing awesome">',
|
||||
'ok</a>',
|
||||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$text = 'Lorem ipsum withonewordverybigMorethanthelineshouldsizeofrfcspecificationbyieeeavailableonieeesite ok.';
|
||||
$result = $this->CakeEmail->wrap($text);
|
||||
$expected = array(
|
||||
'Lorem ipsum',
|
||||
'withonewordverybigMorethanthelineshouldsizeofrfcspecificationbyieeeavailableonieeesite',
|
||||
'ok.',
|
||||
''
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue