$this->assertEquals('<span>This is a test </span>...',StringHelper::truncate('<span>This is a test sentance</span>',14,'...',null,true));
$this->assertEquals('<span><img src="image.png" />This is a test </span>...',StringHelper::truncate('<span><img src="image.png" />This is a test sentance</span>',14,'...',null,true));
}
publicfunctiontestTruncateWords()
...
...
@@ -113,6 +117,10 @@ class StringHelperTest extends TestCase
$this->assertEquals('это строка с неожиданными...',StringHelper::truncateWords('это строка с неожиданными пробелами',4));
// With Html
$this->assertEquals('<span>This is a test</span>...',StringHelper::truncateWords('<span>This is a test sentance</span>',4,'...',true));
$this->assertEquals('<span><img src="image.png" />This is a test</span>...',StringHelper::truncateWords('<span><img src="image.png" />This is a test sentance</span>',4,'...',true));