2014-04-17 08:29:21 -04:00
|
|
|
<?php
|
2026-03-26 12:46:27 -04:00
|
|
|
|
|
|
|
|
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2014-04-17 08:29:21 -04:00
|
|
|
|
|
|
|
|
namespace Tests\Icinga\Util;
|
|
|
|
|
|
|
|
|
|
use Icinga\Test\BaseTestCase;
|
2016-01-27 09:56:27 -05:00
|
|
|
use Icinga\Util\StringHelper;
|
2014-04-17 08:29:21 -04:00
|
|
|
|
2025-12-12 05:23:40 -05:00
|
|
|
class StringHelperTest extends BaseTestCase
|
2014-04-17 08:29:21 -04:00
|
|
|
{
|
|
|
|
|
public function testWhetherTrimSplitReturnsACorrectValue()
|
|
|
|
|
{
|
|
|
|
|
$this->assertEquals(
|
|
|
|
|
array('one', 'two', 'three'),
|
2016-01-27 09:56:27 -05:00
|
|
|
StringHelper::trimSplit(' one ,two , three'),
|
2014-04-17 08:29:21 -04:00
|
|
|
'String::trimSplit does not properly split a string and/or trim its elements'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testWhetherTrimSplitSplitsByTheGivenDelimiter()
|
|
|
|
|
{
|
|
|
|
|
$this->assertEquals(
|
|
|
|
|
array('one', 'two', 'three'),
|
2016-01-27 09:56:27 -05:00
|
|
|
StringHelper::trimSplit('one.two.three', '.'),
|
2014-04-17 08:29:21 -04:00
|
|
|
'String::trimSplit does not split a string by the given delimiter'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|