19declare(strict_types=1);
27use PHPUnit\Framework\TestCase;
39 $object = $transformation->transform([
'hello', 42]);
41 $result = $object->myMethod();
43 $this->assertEquals([
'hello', 42], $result);
48 $this->expectNotToPerformAssertions();
53 $object = $transformation->transform([
'hello',
'world']);
54 }
catch (TypeError $exception) {
68 $resultObject = $transformation->applyTo(
new Ok([
'hello', 42]));
70 $object = $resultObject->value();
72 $result = $object->myMethod();
74 $this->assertEquals([
'hello', 42], $result);
79 $this->expectNotToPerformAssertions();
84 $resultObject = $transformation->applyTo(
new Ok([
'hello',
'world']));
96 $resultObject = $transformation->applyTo(
new Ok([
'hello', 100]));
98 $this->assertTrue($resultObject->isError());
103 $this->expectNotToPerformAssertions();
108 $resultObject = $transformation->transform([
'hello', 100]);
A result encapsulates a value or an error and simplifies the handling of those.
A result encapsulates a value or an error and simplifies the handling of those.