Skip to content

Commit 59d28a1

Browse files
committed
resolve invoke plugin
1 parent 5b4046b commit 59d28a1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Plugin/InvokeTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
namespace Mvc5\Test\Plugin;
77

88
use Mvc5\App;
9+
use Mvc5\Plugin\Call;
10+
use Mvc5\Plugin\Invokable;
911
use Mvc5\Plugin\Invoke;
12+
use Mvc5\Plugin\Value;
1013
use Mvc5\Test\Test\TestCase;
1114

1215
class InvokeTest
@@ -66,4 +69,21 @@ function test_not_named()
6669
$this->assertEquals('foobars', $callable('foo', 'bar'));
6770
$this->assertEquals('foobars', $app->call($callable, ['foo', 'bar']));
6871
}
72+
73+
/**
74+
* @throws \Throwable
75+
*/
76+
function test_resolve()
77+
{
78+
$app = new App;
79+
80+
$invoke = new Invoke(function($foo, $bar, $baz) {
81+
return new Call(new Invokable(new Value($foo . $bar . $baz)));
82+
}, ['s']);
83+
84+
$callable = $app->plugin($invoke);
85+
86+
$this->assertEquals('foobars', $callable('foo', 'bar'));
87+
$this->assertEquals('foobars', $app->call($callable, ['foo', 'bar']));
88+
}
6989
}

0 commit comments

Comments
 (0)