Add MessageTest

This commit is contained in:
2021-01-23 03:39:35 +03:00
parent 33b1ee129b
commit d0594c601c
5 changed files with 80 additions and 5 deletions

View File

@@ -4,8 +4,6 @@ declare(strict_types=1);
namespace Nsq;
use LogicException;
final class Message
{
/**
@@ -50,7 +48,7 @@ final class Message
public function finish(): void
{
if ($this->finished) {
throw new LogicException('Can\'t finish message as it already finished.');
throw new Exception('Can\'t finish message as it already finished.');
}
$this->consumer->fin($this->id);
@@ -60,7 +58,7 @@ final class Message
public function requeue(int $timeout): void
{
if ($this->finished) {
throw new LogicException('Can\'t requeue message as it already finished.');
throw new Exception('Can\'t requeue message as it already finished.');
}
$this->consumer->req($this->id, $timeout);
@@ -70,7 +68,7 @@ final class Message
public function touch(): void
{
if ($this->finished) {
throw new LogicException('Can\'t touch message as it already finished.');
throw new Exception('Can\'t touch message as it already finished.');
}
$this->consumer->touch($this->id);