|
|
@@ -711,7 +711,7 @@ HTML;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * testHighlight method
|
|
|
+ * Tests highlight() method.
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
@@ -746,6 +746,24 @@ HTML;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Tests highlight() method with limit.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testHighlightLimit()
|
|
|
+ {
|
|
|
+ $text = 'This is a test text with some more text';
|
|
|
+ $phrases = ['This', 'text'];
|
|
|
+ $result = $this->Text->highlight($text, $phrases, ['format' => '<b>\1</b>']);
|
|
|
+ $expected = '<b>This</b> is a test <b>text</b> with some more <b>text</b>';
|
|
|
+ $this->assertEquals($expected, $result);
|
|
|
+
|
|
|
+ $result = $this->Text->highlight($text, $phrases, ['format' => '<b>\1</b>', 'limit' => 1]);
|
|
|
+ $expected = '<b>This</b> is a test <b>text</b> with some more text';
|
|
|
+ $this->assertEquals($expected, $result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* testHighlightHtml method
|
|
|
*
|
|
|
* @return void
|