3 declare(strict_types=1);
31 protected static array
$result = [
"I am",
"a test string",
"for split"];
36 protected function setUp(): void
39 $language = $this->createMock(ilLanguage::class);
40 $this->f =
new Refinery($dataFactory, $language);
41 $this->split_string = $this->f->string()->splitString(
"#");
47 $this->split_string = null;
52 $arr = $this->split_string->transform(self::STRING_TO_SPLIT);
53 $this->assertEquals(static::$result, $arr);
61 $next_arr = $this->split_string->transform($arr);
65 $this->assertTrue($raised);
70 $with = $this->split_string->transform($without);
74 $this->assertTrue($raised);
79 $with = $this->split_string->transform($std_class);
83 $this->assertTrue($raised);
88 $split_string = $this->f->string()->splitString(
"#");
90 $this->assertEquals(static::$result, $arr);
95 $split_string = $this->f->string()->splitString(
"#");
104 $this->assertTrue($raised);
113 $this->assertTrue($raised);
122 $this->assertTrue($raised);
128 $valueObject =
$factory->ok(self::STRING_TO_SPLIT);
130 $resultObject = $this->split_string->applyTo($valueObject);
132 $this->assertEquals(self::$result, $resultObject->value());
133 $this->assertFalse($resultObject->isError());
141 $resultObject = $this->split_string->applyTo($valueObject);
143 $this->assertTrue($resultObject->isError());
Transformation $split_string
testApplyToWithValidValueReturnsAnOkResult()
testApplyToWithInvalidValueWillLeadToErrorResult()