File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types=1 );
2
+
3
+ namespace ApiClients \Tests \Supervisord \CommandBus \Handler ;
4
+
5
+ use ApiClients \Client \Supervisord \CommandBus \Command \ProgramCommand ;
6
+ use ApiClients \Client \Supervisord \CommandBus \Handler \ProgramHandler ;
7
+ use ApiClients \Client \Supervisord \Resource \ProgramInterface ;
8
+ use ApiClients \Client \Supervisord \Resource \StateInterface ;
9
+ use ApiClients \Foundation \Hydrator \Hydrator ;
10
+ use ApiClients \Tools \Services \XmlRpc \XmlRpcService ;
11
+ use ApiClients \Tools \TestUtilities \TestCase ;
12
+ use function React \Promise \resolve ;
13
+
14
+ final class ProgramHandlerTest extends TestCase
15
+ {
16
+ public function testCommand ()
17
+ {
18
+ $ program = [
19
+ 'name ' => 'ping ' ,
20
+ ];
21
+
22
+ $ resource = $ this ->prophesize (StateInterface::class)->reveal ();
23
+
24
+ $ service = $ this ->prophesize (XmlRpcService::class);
25
+ $ service ->call ('supervisor.getProcessInfo ' , ['ping ' ])->shouldBeCalled ()->willReturn (resolve ($ program ));
26
+
27
+ $ hydrator = $ this ->prophesize (Hydrator::class);
28
+ $ hydrator ->hydrate (ProgramInterface::HYDRATE_CLASS , $ program )->shouldBeCalled ()->willReturn ($ resource );
29
+
30
+ $ handler = new ProgramHandler ($ service ->reveal (), $ hydrator ->reveal ());
31
+ $ result = $ this ->await ($ handler ->handle (new ProgramCommand ('ping ' )));
32
+
33
+ self ::assertSame ($ resource , $ result );
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments