ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ ilDoc Overview
StringTransformationTest.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 2020 Luka K. A. Stocker, Extended GPL, see docs/LICENSE */
3
4
namespace
ILIAS\Tests\Refinery\KindlyTo\Transformation
;
5
6
require_once(
'./libs/composer/vendor/autoload.php'
);
7
8
use
ILIAS\Refinery\KindlyTo\Transformation\StringTransformation
;
9
use
ILIAS\Tests\Refinery\TestCase
;
10
14
class
StringTransformationTest
extends
TestCase
15
{
16
private
$transformation
;
17
18
public
function
setUp
() : void
19
{
20
$this->transformation =
new
StringTransformation
();
21
}
22
28
public
function
testStringTransformation
($originVal, $expectedVal)
29
{
30
$transformedValue = $this->transformation->transform($originVal);
31
$this->assertIsString($transformedValue);
32
$this->assertEquals($expectedVal, $transformedValue);
33
}
34
35
public
function
StringTestDataProvider
()
36
{
37
$obj =
new
class
extends \StdClass {
38
public
function
__toString()
39
{
40
return
'an object'
;
41
}
42
};
43
return
[
44
'string_val'
=> [
'hello'
,
'hello'
],
45
'int_val'
=> [300,
'300'
],
46
'neg_int_val'
=> [-300,
'-300'
],
47
'zero_int_val'
=> [0,
'0'
],
48
'pos_bool'
=> [
true
,
'true'
],
49
'neg_bool'
=> [
false
,
'false'
],
50
'float_val'
=> [20.5,
'20.5'
],
51
'object_val'
=> [$obj,
'an object'
]
52
];
53
}
54
}
ILIAS\Refinery\KindlyTo\Transformation\StringTransformation
Definition:
StringTransformation.php:12
StringTransformation
TestCase
ILIAS\Tests\Refinery\KindlyTo\Transformation
Definition:
BooleanTransformationTest.php:4
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\setUp
setUp()
Definition:
StringTransformationTest.php:18
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\testStringTransformation
testStringTransformation($originVal, $expectedVal)
StringTestDataProvider
Definition:
StringTransformationTest.php:28
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest
Test transformations in this Group.
Definition:
StringTransformationTest.php:14
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\StringTestDataProvider
StringTestDataProvider()
Definition:
StringTransformationTest.php:35
ILIAS\Tests\Refinery\KindlyTo\Transformation\StringTransformationTest\$transformation
$transformation
Definition:
StringTransformationTest.php:16
TestCase
tests
Refinery
KindlyTo
Transformation
StringTransformationTest.php
Generated on Wed Sep 3 2025 21:01:47 for ILIAS by
1.8.13 (using
Doxyfile
)