ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
IdentityTransformationTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Tests\Refinery;
22
26use PHPUnit\Framework\TestCase;
27
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}
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:31
ilErrorHandling $error
Definition: class.ilias.php:69
applyTo(Result $result)
@inheritDoc