check limit of serialized command in unit tests

This commit is contained in:
Robin Appelman 2015-03-24 10:48:21 +01:00
parent 268f249e8d
commit 8c903c100f
1 changed files with 3 additions and 0 deletions

View File

@ -41,6 +41,9 @@ class QueueBus implements IBus {
if ($command instanceof ICommand) { if ($command instanceof ICommand) {
// ensure the command can be serialized // ensure the command can be serialized
$serialized = serialize($command); $serialized = serialize($command);
if(strlen($serialized) > 4000) {
throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
}
$unserialized = unserialize($serialized); $unserialized = unserialize($serialized);
$unserialized->handle(); $unserialized->handle();
} else { } else {