mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Merged changes to TextTest that weren't merged in from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71793 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5ccca85e7f
commit
e9757a57b2
@ -12,6 +12,7 @@ class TextTest extends SapphireTest {
|
|||||||
$cases = array(
|
$cases = array(
|
||||||
/* Standard words limited, ellipsis added if truncated */
|
/* Standard words limited, ellipsis added if truncated */
|
||||||
'The little brown fox jumped over the lazy cow.' => 'The little brown...',
|
'The little brown fox jumped over the lazy cow.' => 'The little brown...',
|
||||||
|
' This text has white space around the ends ' => 'This text has...',
|
||||||
|
|
||||||
/* Words less than the limt word count don't get truncated, ellipsis not added */
|
/* Words less than the limt word count don't get truncated, ellipsis not added */
|
||||||
'Two words' => 'Two words', // Two words shouldn't have an ellipsis
|
'Two words' => 'Two words', // Two words shouldn't have an ellipsis
|
||||||
@ -20,7 +21,8 @@ class TextTest extends SapphireTest {
|
|||||||
|
|
||||||
/* HTML tags get stripped out, leaving the raw text */
|
/* HTML tags get stripped out, leaving the raw text */
|
||||||
'<p>Text inside a paragraph tag should also work</p>' => 'Text inside a...',
|
'<p>Text inside a paragraph tag should also work</p>' => 'Text inside a...',
|
||||||
'<p><span>Text nested inside another tag should also work</span></p>' => 'Text nested inside...'
|
'<p><span>Text nested inside another tag should also work</span></p>' => 'Text nested inside...',
|
||||||
|
'<p>Two words</p>' => 'Two words'
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($cases as $originalValue => $expectedValue) {
|
foreach($cases as $originalValue => $expectedValue) {
|
||||||
@ -33,9 +35,12 @@ class TextTest extends SapphireTest {
|
|||||||
/**
|
/**
|
||||||
* Test {@link Text->LimitWordCountXML()}
|
* Test {@link Text->LimitWordCountXML()}
|
||||||
*/
|
*/
|
||||||
/*function testLimitWordCountXML() {
|
function testLimitWordCountXML() {
|
||||||
$cases = array(
|
$cases = array(
|
||||||
// @todo add cases to test by
|
'<p>Stuff & stuff</p>' => 'Stuff &...',
|
||||||
|
"Stuff\nBlah Blah Blah" => "Stuff<br />Blah Blah...",
|
||||||
|
"Stuff<Blah Blah" => "Stuff<Blah Blah",
|
||||||
|
"Stuff>Blah Blah" => "Stuff>Blah Blah"
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($cases as $originalValue => $expectedValue) {
|
foreach($cases as $originalValue => $expectedValue) {
|
||||||
@ -43,7 +48,7 @@ class TextTest extends SapphireTest {
|
|||||||
$textObj->setValue($originalValue);
|
$textObj->setValue($originalValue);
|
||||||
$this->assertEquals($expectedValue, $textObj->LimitWordCountXML(3));
|
$this->assertEquals($expectedValue, $textObj->LimitWordCountXML(3));
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user