17 require_once(
'./libs/composer/vendor/autoload.php');
32 $result = $recordTransformation->transform(array(
'stringTrafo' =>
'hello',
'integerTrafo' => 1));
34 $this->assertEquals(array(
'stringTrafo' =>
'hello',
'integerTrafo' => 1),
$result);
39 $this->expectNotToPerformAssertions();
56 $this->expectNotToPerformAssertions();
65 $result = $recordTransformation->transform(array(
'stringTrafo' =>
'hello',
'anotherIntTrafo' => 1));
75 $this->expectNotToPerformAssertions();
84 $result = $recordTransformation->transform(array(
'stringTrafo' =>
'hello',
'floatTrafo' => 1));
94 $this->expectNotToPerformAssertions();
104 $result = $recordTransformation->transform(
106 'stringTrafo' =>
'hello',
120 $this->expectNotToPerformAssertions();
129 $result = $recordTransformation->transform(array(
'someKey' =>
'hello', 1));
148 $result = $recordTransformation->applyTo(
new Ok(array(
'stringTrafo' =>
'hello',
'integerTrafo' => 1)));
150 $this->assertEquals(array(
'stringTrafo' =>
'hello',
'integerTrafo' => 1),
$result->value());
164 $result = $recordTransformation->applyTo(
new Ok(array(
'stringTrafo' =>
'hello',
'anotherIntTrafo' => 1)));
166 $this->assertTrue(
$result->isError());
180 $result = $recordTransformation->applyTo(
new Ok(array(
'stringTrafo' =>
'hello',
'floatTrafo' => 1)));
182 $this->assertTrue(
$result->isError());
196 $result = $recordTransformation->applyTo(
199 'stringTrafo' =>
'hello',
206 $this->assertTrue(
$result->isError());
220 $result = $recordTransformation->applyTo(
new Ok(array(
'someKey' =>
'hello', 1)));
222 $this->assertTrue(
$result->isError());
A result encapsulates a value or an error and simplifies the handling of those.