6use PHPUnit\Framework\TestCase;
16 protected static $result = array(
"I am",
"a test string",
"for split");
23 protected function setUp() : void
25 $dataFactory = new \ILIAS\Data\Factory();
26 $language = $this->createMock(
'\ilLanguage');
27 $this->f = new \ILIAS\Refinery\Factory($dataFactory, $language);
28 $this->split_string = $this->f->string()->splitString(
"#");
34 $this->split_string =
null;
39 $arr = $this->split_string->transform(self::STRING_TO_SPLIT);
48 $next_arr = $this->split_string->transform($arr);
49 }
catch (InvalidArgumentException
$e) {
52 $this->assertTrue($raised);
57 $with = $this->split_string->transform($without);
58 }
catch (InvalidArgumentException
$e) {
61 $this->assertTrue($raised);
66 $with = $this->split_string->transform($std_class);
67 }
catch (InvalidArgumentException
$e) {
70 $this->assertTrue($raised);
88 }
catch (InvalidArgumentException
$e) {
91 $this->assertTrue($raised);
97 }
catch (InvalidArgumentException
$e) {
100 $this->assertTrue($raised);
106 }
catch (InvalidArgumentException
$e) {
109 $this->assertTrue($raised);
114 $factory = new \ILIAS\Data\Factory();
115 $valueObject =
$factory->ok(self::STRING_TO_SPLIT);
117 $resultObject = $this->split_string->applyTo($valueObject);
120 $this->assertFalse($resultObject->isError());
125 $factory = new \ILIAS\Data\Factory();
128 $resultObject = $this->split_string->applyTo($valueObject);
130 $this->assertTrue($resultObject->isError());
An exception for terminatinating execution or to throw for unit testing.
TestCase for SplitString transformations.
testApplyToWithValidValueReturnsAnOkResult()
testApplyToWithInvalidValueWillLeadToErrorResult()