Fixes #16266: Fixed yii\helpers\BaseStringHelper where explode would not allow 0 as trim string

This commit is contained in:
Thoulah
2018-05-13 00:14:39 +02:00
committed by Alexander Makarov
parent e4b559d720
commit a32cfcc8ef
3 changed files with 3 additions and 1 deletions

View File

@ -267,6 +267,7 @@ class StringHelperTest extends TestCase
$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(['Save', '', '', 'empty trimmed string'], StringHelper::explode('Save, ,, empty trimmed string', ','));
$this->assertEquals(['44', '512'], StringHelper::explode('0 0 440 512', ' ', '0', true));
$this->assertEquals(['Здесь', 'multibyte', 'строка'], StringHelper::explode('Здесь我 multibyte我 строка', '我'));
$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'));