16 require_once(
'./libs/composer/vendor/autoload.php');
27 $result = $listTransformation->transform(array(
'hello',
'world'));
29 $this->assertEquals(array(
'hello',
'world'),
$result);
35 $this->assertSame([], $listTransformation->transform([]));
41 $result = $listTransformation->applyTo(
new Ok(array()));
42 $this->assertFalse(
$result->isError());
47 $this->expectNotToPerformAssertions();
51 $result = $listTransformation->transform(null);
62 $result = $listTransformation->applyTo(
new Ok(null));
63 $this->assertTrue(
$result->isError());
69 $this->expectNotToPerformAssertions();
74 $result = $listTransformation->transform(array(
'hello', 2));
86 $result = $listTransformation->applyTo(
new Ok(array(
'hello',
'world')));
88 $this->assertEquals(array(
'hello',
'world'),
$result->value());
89 $this->assertTrue(
$result->isOK());
96 $result = $listTransformation->applyTo(
new Ok(array(
'hello', 2)));
98 $this->assertTrue(
$result->isError());
A result encapsulates a value or an error and simplifies the handling of those.