-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from php-enqueue/dbal-add-priority-support
[dbal] add priority support on transport level.
- Loading branch information
Showing
4 changed files
with
78 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
pkg/dbal/Tests/Spec/DbalSendAndReceivePriorityMessagesFromQueueTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace Enqueue\Dbal\Tests\Spec; | ||
|
||
use Enqueue\Dbal\DbalConnectionFactory; | ||
use Enqueue\Dbal\DbalDestination; | ||
use Enqueue\Dbal\DbalMessage; | ||
use Interop\Queue\PsrContext; | ||
use Interop\Queue\Spec\SendAndReceivePriorityMessagesFromQueueSpec; | ||
|
||
/** | ||
* @group functional | ||
*/ | ||
class DbalSendAndReceivePriorityMessagesFromQueueTest extends SendAndReceivePriorityMessagesFromQueueSpec | ||
{ | ||
/** | ||
* @return PsrContext | ||
*/ | ||
protected function createContext() | ||
{ | ||
$factory = new DbalConnectionFactory([ | ||
'lazy' => true, | ||
'connection' => [ | ||
'dbname' => getenv('SYMFONY__DB__NAME'), | ||
'user' => getenv('SYMFONY__DB__USER'), | ||
'password' => getenv('SYMFONY__DB__PASSWORD'), | ||
'host' => getenv('SYMFONY__DB__HOST'), | ||
'port' => getenv('SYMFONY__DB__PORT'), | ||
'driver' => getenv('SYMFONY__DB__DRIVER'), | ||
], | ||
]); | ||
|
||
$context = $factory->createContext(); | ||
$context->createDataBaseTable(); | ||
|
||
return $context; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* | ||
* @return DbalMessage | ||
*/ | ||
protected function createMessage(PsrContext $context, $priority) | ||
{ | ||
/** @var DbalMessage $message */ | ||
$message = $context->createMessage('priority'.$priority); | ||
$message->setPriority($priority); | ||
|
||
return $message; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* | ||
* @return DbalDestination | ||
*/ | ||
protected function createQueue(PsrContext $context, $queueName) | ||
{ | ||
return parent::createQueue($context, $queueName.time()); | ||
} | ||
} |