ILIAS  release_8 Revision v8.24
IdentityTransformationTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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: Error.php:18
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:17
ilErrorHandling $error
Definition: class.ilias.php:55
applyTo(Result $result)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...