ILIAS
release_9 Revision v9.13-25-g2c18ec4c24f
◀ ilDoc Overview
StringTransformationTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Tests\Refinery\KindlyTo\Transformation
;
22
23
use
ILIAS\Refinery\KindlyTo\Transformation\StringTransformation
;
24
use
ILIAS\Tests\Refinery\TestCase
;
25
use
stdClass
;
26
27
class
StringTransformationTest
extends
TestCase
28
{
29
private
StringTransformation
$transformation
;
30
31
protected
function
setUp
(): void
32
{
33
$this->transformation =
new
StringTransformation
();
34
}
35
41
public
function
testStringTransformation
($originVal,
string
$expectedVal): void
42
{
43
$transformedValue = $this->transformation->transform($originVal);
44
$this->assertIsString($transformedValue);
45
$this->assertEquals($expectedVal, $transformedValue);
46
}
47
48
public
function
StringTestDataProvider
(): array
49
{
50
$obj =
new
class
() extends
stdClass
{
51
public
function
__toString()
52
{
53
return
'an object'
;
54
}
55
};
56
return
[
57
'string_val'
=> [
'hello'
,
'hello'
],
58
'int_val'
=> [300,
'300'
],
59
'neg_int_val'
=> [-300,
'-300'
],
60
'zero_int_val'
=> [0,
'0'
],
61
'pos_bool'
=> [
true
,
'true'
],
62
'neg_bool'
=> [
false
,
'false'
],
63
'float_val'
=> [20.5,
'20.5'
],
64
'object_val'
=> [$obj,
'an object'
]
65
];
66
}
67
}
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\$transformation
StringTransformation $transformation
Definition:
StringTransformationTest.php:29
ILIAS\Refinery\KindlyTo\Transformation\StringTransformation
Definition:
StringTransformation.php:28
stdClass
StringTransformation
TestCase
ILIAS\Tests\Refinery\KindlyTo\Transformation
Definition:
BooleanTransformationTest.php:21
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\setUp
setUp()
Definition:
StringTransformationTest.php:31
ILIAS\Tests\Refinery\TestCase
Definition:
TestCase.php:52
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest
Definition:
StringTransformationTest.php:27
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\testStringTransformation
testStringTransformation($originVal, string $expectedVal)
StringTestDataProvider
Definition:
StringTransformationTest.php:41
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\StringTestDataProvider
StringTestDataProvider()
Definition:
StringTransformationTest.php:48
tests
Refinery
KindlyTo
Transformation
StringTransformationTest.php
Generated on Wed Sep 10 2025 14:12:13 for ILIAS by
1.8.13 (using
Doxyfile
)