Skip to content

Commit 449603d

Browse files
committed
ReadLogHandler test
1 parent 1866632 commit 449603d

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

tests/CommandBus/Handler/IdentificationHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public function testCommand()
1616
$service->call('supervisor.getIdentification')->shouldBeCalled()->willReturn(resolve('supervisor'));
1717

1818
$handler = new IdentificationHandler($service->reveal());
19-
$version = $this->await($handler->handle(new IdentificationCommand()));
19+
$identification = $this->await($handler->handle(new IdentificationCommand()));
2020

21-
self::assertSame('supervisor', $version);
21+
self::assertSame('supervisor', $identification);
2222
}
2323
}

tests/CommandBus/Handler/PidHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public function testCommand()
1616
$service->call('supervisor.getPID')->shouldBeCalled()->willReturn(resolve(123456));
1717

1818
$handler = new PidHandler($service->reveal());
19-
$version = $this->await($handler->handle(new PidCommand()));
19+
$pid = $this->await($handler->handle(new PidCommand()));
2020

21-
self::assertSame(123456, $version);
21+
self::assertSame(123456, $pid);
2222
}
2323
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace ApiClients\Tests\Supervisord\CommandBus\Handler;
4+
5+
use ApiClients\Client\Supervisord\CommandBus\Command\ReadLogCommand;
6+
use ApiClients\Client\Supervisord\CommandBus\Handler\ReadLogHandler;
7+
use ApiClients\Tools\Services\XmlRpc\XmlRpcService;
8+
use ApiClients\Tools\TestUtilities\TestCase;
9+
use function React\Promise\resolve;
10+
11+
final class ReadLogHandlerTest extends TestCase
12+
{
13+
public function testCommand()
14+
{
15+
$service = $this->prophesize(XmlRpcService::class);
16+
$service->call('supervisor.readLog', [1, 2])->shouldBeCalled()->willReturn(resolve('foo.bar'));
17+
18+
$handler = new ReadLogHandler($service->reveal());
19+
$log = $this->await($handler->handle(new ReadLogCommand(1, 2)));
20+
21+
self::assertSame('foo.bar', $log);
22+
}
23+
}

0 commit comments

Comments
 (0)