ILIAS
release_8 Revision v8.24
◀ ilDoc Overview
NullTransformationTest.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
21
use
ILIAS\Refinery\KindlyTo\Transformation\NullTransformation
;
22
use
ILIAS\Tests\Refinery\TestCase
;
23
use
ILIAS\Refinery\ConstraintViolationException
;
24
25
class
NullTransformationTest
extends
TestCase
26
{
27
private
NullTransformation
$transformation
;
28
29
protected
function
setUp
(): void
30
{
31
$this->transformation =
new
NullTransformation
();
32
}
33
34
public
function
NullTestDataProvider
(): array
35
{
36
return
[
37
'empty string'
=> [
''
,
true
],
38
'space'
=> [
' '
,
true
],
39
'spaces'
=> [
' '
,
true
],
40
'null'
=> [
null
,
true
],
41
'string'
=> [
'str'
,
false
],
42
'int'
=> [1,
false
],
43
'negative int'
=> [-1,
false
],
44
'zero'
=> [0,
false
],
45
'array'
=> [[],
false
],
46
'bool (false)'
=> [
false
,
false
],
47
'bool (true)'
=> [
true
,
false
]
48
];
49
}
50
57
public
function
testNullTransformation
($value,
bool
$valid
): void
58
{
59
if
(!
$valid
) {
60
$this->expectException(ConstraintViolationException::class);
61
}
62
$transformed = $this->transformation->transform($value);
63
$this->assertNull($transformed);
64
}
65
}
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:30
ILIAS\Refinery\KindlyTo\Transformation\NullTransformation
Definition:
NullTransformation.php:29
ILIAS\Tests\Refinery\TestCase
Definition:
TestCase.php:53
NullTransformationTest
Definition:
NullTransformationTest.php:26
NullTransformationTest\NullTestDataProvider
NullTestDataProvider()
Definition:
NullTransformationTest.php:34
NullTransformationTest\setUp
setUp()
Definition:
NullTransformationTest.php:29
NullTransformationTest\testNullTransformation
testNullTransformation($value, bool $valid)
@dataProvider NullTestDataProvider
Definition:
NullTransformationTest.php:57
NullTransformationTest\$transformation
NullTransformation $transformation
Definition:
NullTransformationTest.php:27
$valid
$valid
Definition:
dummy_client.php:57
tests
Refinery
KindlyTo
Transformation
NullTransformationTest.php
Generated on Sun Nov 2 2025 22:02:04 for ILIAS by
1.9.4 (using
Doxyfile
)