ILIAS
release_8 Revision v8.24
◀ ilDoc Overview
StringTransformationTest.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
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\Refinery\KindlyTo\Transformation\StringTransformation
Definition:
StringTransformation.php:29
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest
Definition:
StringTransformationTest.php:28
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\testStringTransformation
testStringTransformation($originVal, string $expectedVal)
@dataProvider StringTestDataProvider
Definition:
StringTransformationTest.php:41
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\setUp
setUp()
Definition:
StringTransformationTest.php:31
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\StringTestDataProvider
StringTestDataProvider()
Definition:
StringTransformationTest.php:48
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\$transformation
StringTransformation $transformation
Definition:
StringTransformationTest.php:29
ILIAS\Tests\Refinery\TestCase
Definition:
TestCase.php:53
ILIAS\Tests\Refinery\KindlyTo\Transformation
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
BooleanTransformationTest.php:21
tests
Refinery
KindlyTo
Transformation
StringTransformationTest.php
Generated on Mon Nov 3 2025 22:02:14 for ILIAS by
1.9.4 (using
Doxyfile
)