Skip to content

Upgrade php-amqplib #4

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
38 changes: 15 additions & 23 deletions Tests/AmqpConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ public function testShouldImplementConsumerInterface()

public function testCouldBeConstructedWithContextAndQueueAsArguments()
{
new AmqpConsumer(
$this->createContextMock(),
new AmqpQueue('aName')
self::assertInstanceOf(AmqpConsumer::class,
new AmqpConsumer(
$this->createContextMock(),
new AmqpQueue('aName')
)
);
}

Expand Down Expand Up @@ -68,15 +70,13 @@ public function testOnAcknowledgeShouldAcknowledgeMessage()
$channel
->expects($this->once())
->method('basic_ack')
->with(167)
;
->with(167);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autoformatter did this, I could change it back if necessary


$context = $this->createContextMock();
$context
->expects($this->once())
->method('getLibChannel')
->willReturn($channel)
;
->willReturn($channel);

$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

Expand All @@ -92,15 +92,13 @@ public function testOnRejectShouldRejectMessage()
$channel
->expects($this->once())
->method('basic_reject')
->with(125, $this->isTrue())
;
->with(125, $this->isTrue());

$context = $this->createContextMock();
$context
->expects($this->once())
->method('getLibChannel')
->willReturn($channel)
;
->willReturn($channel);

$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

Expand All @@ -124,21 +122,18 @@ public function testShouldReturnMessageOnReceiveNoWait()
$channel
->expects($this->once())
->method('basic_get')
->willReturn($libMessage)
;
->willReturn($libMessage);

$context = $this->createContextMock();
$context
->expects($this->once())
->method('getLibChannel')
->willReturn($channel)
;
->willReturn($channel);
$context
->expects($this->once())
->method('convertMessage')
->with($this->identicalTo($libMessage))
->willReturn($message)
;
->willReturn($message);

$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

Expand All @@ -160,21 +155,18 @@ public function testShouldReturnMessageOnReceiveWithReceiveMethodBasicGet()
$channel
->expects($this->once())
->method('basic_get')
->willReturn($libMessage)
;
->willReturn($libMessage);

$context = $this->createContextMock();
$context
->expects($this->once())
->method('getLibChannel')
->willReturn($channel)
;
->willReturn($channel);
$context
->expects($this->once())
->method('convertMessage')
->with($this->identicalTo($libMessage))
->willReturn($message)
;
->willReturn($message);

$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

Expand Down
2 changes: 1 addition & 1 deletion Tests/AmqpProducerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AmqpProducerTest extends TestCase

public function testCouldBeConstructedWithRequiredArguments()
{
new AmqpProducer($this->createAmqpChannelMock(), $this->createContextMock());
self::assertInstanceOf(AmqpProducer::class, new AmqpProducer($this->createAmqpChannelMock(), $this->createContextMock()));
}

public function testShouldImplementProducerInterface()
Expand Down
5 changes: 4 additions & 1 deletion Tests/AmqpSubscriptionConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public function testShouldImplementSubscriptionConsumerInterface()

public function testCouldBeConstructedWithAmqpContextAndHeartbeatOnTickAsArguments()
{
new AmqpSubscriptionConsumer($this->createAmqpContextMock(), $heartbeatOnTick = true);
self::assertInstanceOf(
AmqpSubscriptionConsumer::class,
new AmqpSubscriptionConsumer($this->createAmqpContextMock(), $heartbeatOnTick = true)
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"php-amqplib/php-amqplib": "^2.10",
"php-amqplib/php-amqplib": "^3.0",
"queue-interop/amqp-interop": "^0.8",
"queue-interop/queue-interop": "^0.8",
"enqueue/amqp-tools": "^0.10"
Expand Down