From 91ae4cc1d0a16ac5856d5687e12e649ecf43be42 Mon Sep 17 00:00:00 2001 From: f7h Date: Mon, 22 Jan 2018 20:00:32 +0100 Subject: [PATCH] [dbal] Consumer never fetches messages ordered by published time --- pkg/dbal/DbalContext.php | 2 +- pkg/dbal/DbalMessage.php | 2 +- pkg/dbal/Tests/DbalContextTest.php | 2 +- pkg/dbal/Tests/DbalMessageTest.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/dbal/DbalContext.php b/pkg/dbal/DbalContext.php index d7d462aa1..b531bb4b5 100644 --- a/pkg/dbal/DbalContext.php +++ b/pkg/dbal/DbalContext.php @@ -178,7 +178,7 @@ public function createDataBaseTable() $table->addColumn('properties', 'text', ['notnull' => false]); $table->addColumn('redelivered', 'boolean', ['notnull' => false]); $table->addColumn('queue', 'string'); - $table->addColumn('priority', 'smallint'); + $table->addColumn('priority', 'smallint', ['notnull' => false]); $table->addColumn('delayed_until', 'integer', ['notnull' => false]); $table->addColumn('time_to_live', 'integer', ['notnull' => false]); diff --git a/pkg/dbal/DbalMessage.php b/pkg/dbal/DbalMessage.php index 979a53657..24f3b2b49 100644 --- a/pkg/dbal/DbalMessage.php +++ b/pkg/dbal/DbalMessage.php @@ -52,7 +52,7 @@ public function __construct($body = '', array $properties = [], array $headers = $this->properties = $properties; $this->headers = $headers; $this->redelivered = false; - $this->priority = 0; + $this->priority = null; $this->deliveryDelay = null; } diff --git a/pkg/dbal/Tests/DbalContextTest.php b/pkg/dbal/Tests/DbalContextTest.php index 746a4f83d..fc24249e7 100644 --- a/pkg/dbal/Tests/DbalContextTest.php +++ b/pkg/dbal/Tests/DbalContextTest.php @@ -59,7 +59,7 @@ public function testShouldCreateMessage() $this->assertEquals('body', $message->getBody()); $this->assertEquals(['pkey' => 'pval'], $message->getProperties()); $this->assertEquals(['hkey' => 'hval'], $message->getHeaders()); - $this->assertSame(0, $message->getPriority()); + $this->assertNull($message->getPriority()); $this->assertFalse($message->isRedelivered()); } diff --git a/pkg/dbal/Tests/DbalMessageTest.php b/pkg/dbal/Tests/DbalMessageTest.php index c0af060d5..537ab99fd 100644 --- a/pkg/dbal/Tests/DbalMessageTest.php +++ b/pkg/dbal/Tests/DbalMessageTest.php @@ -27,11 +27,11 @@ public function testCouldBeConstructedWithOptionalArguments() $this->assertSame(['fooHeader' => 'fooHeaderVal'], $message->getHeaders()); } - public function testShouldSetPriorityToZeroInConstructor() + public function testShouldSetPriorityToNullInConstructor() { $message = new DbalMessage(); - $this->assertSame(0, $message->getPriority()); + $this->assertNull($message->getPriority()); } public function testShouldSetDelayToNullInConstructor()