File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * @see https://github.com/phly/phly-event-dispatcher for the canonical source repository
4+ * @copyright Copyright (c) 2018 Matthew Weier O'Phinney (https:/mwop.net)
5+ * @license https://github.com/phly/phly-event-dispatcher/blob/master/LICENSE.md New BSD License
6+ */
7+
8+ declare (strict_types=1 );
9+
10+ namespace PhlyTest \EventDispatcher ;
11+
12+ use Phly \EventDispatcher \LazyListener ;
13+ use PHPUnit \Framework \TestCase ;
14+ use Psr \Container \ContainerInterface ;
15+
16+ use function Phly \EventDispatcher \lazyListener ;
17+
18+ class LazyListenerFunctionTest extends TestCase
19+ {
20+ public function testFunctionReturnsALazyListenerUsingProvidedArguments ()
21+ {
22+ $ container = $ this ->prophesize (ContainerInterface::class)->reveal ();
23+ $ listener = lazyListener ($ container , TestAsset \Listener::class, 'onTest ' );
24+
25+ $ this ->assertInstanceOf (LazyListener::class, $ listener );
26+ $ this ->assertAttributeSame ($ container , 'container ' , $ listener );
27+ $ this ->assertAttributeSame (TestAsset \Listener::class, 'service ' , $ listener );
28+ $ this ->assertAttributeSame ('onTest ' , 'method ' , $ listener );
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments