$this->assertEquals('<span>This is a test</span>...', StringHelper::truncate('<span>This is a test sentance</span>', 14, '...', null, true));
$this->assertEquals('<span>This is a test</span>...', StringHelper::truncate('<span>This is a test </span>sentance', 14, '...', null, true));
$this->assertEquals('<span>This is a test </span><strong>for</strong>...', StringHelper::truncate('<span>This is a test </span><strong>for a sentance</strong>', 18, '...', null, true));
$this->assertEquals('<span>This is a test</span><strong> for</strong>...', StringHelper::truncate('<span>This is a test</span><strong> for a sentance</strong>', 18, '...', null, true));
$this->assertEquals('<span><imgsrc="image.png"/>This is a test</span>...', StringHelper::truncate('<span><imgsrc="image.png"/>This is a test sentance</span>', 14, '...', null, true));
$this->assertEquals('<span><imgsrc="image.png"/>This is a test</span>...', StringHelper::truncate('<span><imgsrc="image.png"/>This is a test </span>sentance', 14, '...', null, true));
$this->assertEquals('<span><imgsrc="image.png"/>This is a test </span><strong>for</strong>...', StringHelper::truncate('<span><imgsrc="image.png"/>This is a test </span><strong>for a sentance</strong>', 18, '...', null, true));
$this->assertEquals('<p>This is a test</p><ul><li>bullet1</li><li>b</li></ul>...', StringHelper::truncate('<p>This is a test</p><ul><li>bullet1</li><li>bullet2</li><li>bullet3</li><li>bullet4</li></ul>', 22, '...', null, true));
$this->assertEquals('<span>This is a test </span><strong>for</strong>...', StringHelper::truncateWords('<span>This is a test </span><strong>for a sentance</strong>', 5, '...', true));
$this->assertEquals('<span>This is a test</span><strong> for</strong>...', StringHelper::truncateWords('<span>This is a test</span><strong> for a sentance</strong>', 5, '...', true));
$this->assertEquals('<p> раз два три четыре пять </p><p> шесть</p>...', StringHelper::truncateWords('<p> раз два три четыре пять </p><p> шесть семь восемь девять десять</p>', 6, '...', true));
$this->assertEquals('<span><imgsrc="image.png"/>This is a test</span>...', StringHelper::truncateWords('<span><imgsrc="image.png"/>This is a test sentance</span>', 4, '...', true));
$this->assertEquals('<span><imgsrc="image.png"/>This is a test </span><strong>for</strong>...', StringHelper::truncateWords('<span><imgsrc="image.png"/>This is a test </span><strong>for a sentance</strong>', 5, '...', true));
$this->assertEquals('<span><imgsrc="image.png"/>This is a test</span><strong> for</strong>...', StringHelper::truncateWords('<span><imgsrc="image.png"/>This is a test</span><strong> for a sentance</strong>', 5, '...', true));
$this->assertEquals(['It', 'is', 'a first', 'test'], StringHelper::explode('It, is, a first, test'));
$this->assertEquals(['It', 'is', 'a test with trimmed digits', '0', '1', '2'], StringHelper::explode('It, is, a test with trimmed digits, 0, 1, 2', ',', true, true));
$this->assertEquals(['It', 'is', 'a second', 'test'], StringHelper::explode('It+ is+ a second+ test', '+'));
$this->assertEquals(['Disable', ' trim ', 'here but ignore empty'], StringHelper::explode('Disable, trim ,,,here but ignore empty', ',', false, true));
$this->assertEquals(['It/', ' is?', ' a', ' test with rtrim'], StringHelper::explode('It/, is?, a , test with rtrim', ',', 'rtrim'));
$this->assertEquals(['It', ' is', ' a ', ' test with closure'], StringHelper::explode('It/, is?, a , test with closure', ',', function ($value) { return trim($value, '/?'); }));