Skip to content

Add php 7.4 to test matrix #991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ git:
depth: 10

language: php
dist: bionic

matrix:
include:
@@ -29,6 +30,15 @@ matrix:
- php: 7.3
sudo: false
env: SYMFONY_VERSION=5.0.* UNIT_TESTS=true
- php: 7.4
sudo: false
env: SYMFONY_VERSION=4.3.* UNIT_TESTS=true
- php: 7.4
sudo: false
env: SYMFONY_VERSION=4.4.* UNIT_TESTS=true
- php: 7.4
sudo: false
env: SYMFONY_VERSION=5.0.* UNIT_TESTS=true
- php: 7.1
sudo: required
services: docker
10 changes: 6 additions & 4 deletions pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@
*/
class UseCasesTest extends WebTestCase
{
const RECEIVE_TIMEOUT = 500;

public function setUp()
{
// do not call parent::setUp.
@@ -172,7 +174,7 @@ public function testProducerSendsEventMessage(array $enqueueConfig)

$consumer = $this->getContext()->createConsumer($this->getTestQueue());

$message = $consumer->receive(100);
$message = $consumer->receive(self::RECEIVE_TIMEOUT);
$this->assertInstanceOf(Message::class, $message);
$consumer->acknowledge($message);

@@ -192,7 +194,7 @@ public function testProducerSendsCommandMessage(array $enqueueConfig)

$consumer = $this->getContext()->createConsumer($this->getTestQueue());

$message = $consumer->receive(100);
$message = $consumer->receive(self::RECEIVE_TIMEOUT);
$this->assertInstanceOf(Message::class, $message);
$consumer->acknowledge($message);

@@ -220,7 +222,7 @@ public function testProducerSendsEventMessageViaProduceCommand()

$consumer = $this->getContext()->createConsumer($this->getTestQueue());

$message = $consumer->receive(100);
$message = $consumer->receive(self::RECEIVE_TIMEOUT);
$this->assertInstanceOf(Message::class, $message);
$consumer->acknowledge($message);

@@ -247,7 +249,7 @@ public function testProducerSendsCommandMessageViaProduceCommand()

$consumer = $this->getContext()->createConsumer($this->getTestQueue());

$message = $consumer->receive(100);
$message = $consumer->receive(self::RECEIVE_TIMEOUT);
$this->assertInstanceOf(Message::class, $message);
$consumer->acknowledge($message);

10 changes: 5 additions & 5 deletions pkg/pheanstalk/PheanstalkConsumer.php
Original file line number Diff line number Diff line change
@@ -91,10 +91,8 @@ public function reject(Message $message, bool $requeue = false): void
InvalidMessageException::assertMessageInstanceOf($message, PheanstalkMessage::class);

if (false == $message->getJob()) {
throw new \LogicException(sprintf(
'The message could not be %s because it does not have job set.',
$requeue ? 'requeued' : 'rejected'
));
$state = $requeue ? 'requeued' : 'rejected';
throw new \LogicException(sprintf('The message could not be %s because it does not have job set.', $state));
}

if ($requeue) {
@@ -111,7 +109,9 @@ private function convertJobToMessage(Job $job): PheanstalkMessage
$stats = $this->pheanstalk->statsJob($job);

$message = PheanstalkMessage::jsonUnserialize($job->getData());
$message->setRedelivered($stats['reserves'] > 1);
if (isset($stats['reserves'])) {
$message->setRedelivered($stats['reserves'] > 1);
}
$message->setJob($job);

return $message;