Merge branch '3.5' into 3

This commit is contained in:
Daniel Hensby 2017-01-10 12:52:06 +00:00
commit 733511565e
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
2 changed files with 3 additions and 3 deletions

View File

@ -265,8 +265,7 @@ class Text extends StringField {
foreach($stringPieces as $stringPiece) {
if(strlen($stringPiece) > 2) {
$summary = str_ireplace($stringPiece, "<span class=\"highlight\">$stringPiece</span>",
$summary);
$summary = preg_replace('/' . preg_quote($stringPiece, '/') . '/i', '<span class="highlight">$0</span>', $summary);
}
}
}

View File

@ -194,9 +194,10 @@ class TextTest extends SapphireTest {
$textObj->setValue($testString2);
// test that it preserves case
$this->assertEquals(
'This is <span class="highlight">some</span> <span class="highlight">test</span> text.'
. ' <span class="highlight">test</span> <span class="highlight">test</span> what if you have...',
. ' <span class="highlight">Test</span> <span class="highlight">test</span> what if you have...',
$textObj->ContextSummary(50, $testKeywords2)
);