ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
IdentityTransformationTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Tests\Refinery
;
22
23
use
ILIAS\Data\Result\Ok
;
24
use
ILIAS\Data\Result\Error
;
25
use
ILIAS\Refinery\IdentityTransformation
;
26
use
PHPUnit\Framework\TestCase
;
27
28
class
IdentityTransformationTest
extends
TestCase
29
{
30
public
function
testTransform
(): void
31
{
32
$value =
'hejaaa'
;
33
34
$actual = (
new
IdentityTransformation
())->
transform
($value);
35
36
$this->assertEquals($value, $actual);
37
}
38
39
public
function
testApplyToOk
(): void
40
{
41
$value = [
'im in an array'
];
42
$result = (
new
IdentityTransformation
())->
applyTo
(
new
Ok
($value));
43
$this->assertInstanceOf(Ok::class, $result);
44
$this->assertEquals($value, $result->value());
45
}
46
47
public
function
testApplyToError
(): void
48
{
49
$error
=
new
Error
(
'some error'
);
50
$result = (
new
IdentityTransformation
())->
applyTo
(
$error
);
51
$this->assertEquals(
$error
, $result);
52
}
53
}
ILIAS\Refinery\transform
transform($from)
Definition:
DeriveTransformWithProblem.php:36
ILIAS\Refinery\applyTo
applyTo(Result $result)
Definition:
DeriveApplyToFromTransform.php:38
ILIAS\Tests\Refinery\IdentityTransformationTest\testApplyToOk
testApplyToOk()
Definition:
IdentityTransformationTest.php:39
ILIAS\MetaData\OERExposer\OAIPMH\Responses\Error
Error
Definition:
Error.php:23
ILIAS\Tests\Refinery\IdentityTransformationTest\testApplyToError
testApplyToError()
Definition:
IdentityTransformationTest.php:47
ILIAS\Tests\Refinery\IdentityTransformationTest\testTransform
testTransform()
Definition:
IdentityTransformationTest.php:30
ILIAS\Tests\Refinery\TestCase
Definition:
TestCase.php:58
ILIAS\Data\Result\Ok
A result encapsulates a value or an error and simplifies the handling of those.
Definition:
Ok.php:30
ILIAS\Refinery\IdentityTransformation
Definition:
IdentityTransformation.php:23
ILIAS\Tests\Refinery
Definition:
ConstantTransformationTest.php:21
ILIAS\Tests\Refinery\IdentityTransformationTest
Definition:
IdentityTransformationTest.php:28
Ok
IdentityTransformation
ILIAS\$error
ilErrorHandling $error
Definition:
class.ilias.php:69
TestCase
components
ILIAS
Refinery
tests
IdentityTransformationTest.php
Generated on Sun Aug 31 2025 23:03:32 for ILIAS by
1.8.13 (using
Doxyfile
)