Skip to content

Commit 6472e05

Browse files
committed
fix tests.
1 parent dc493eb commit 6472e05

File tree

6 files changed

+37
-13
lines changed

6 files changed

+37
-13
lines changed

tests/Functional/SendAndReceiveDelayedMessageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Jobs\RabbitMQJob;
1313
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
1414

15+
/**
16+
* @group functional
17+
*/
1518
class SendAndReceiveDelayedMessageTest extends TestCase
1619
{
1720
public function test()

tests/Functional/SendAndReceiveMessageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Jobs\RabbitMQJob;
1313
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
1414

15+
/**
16+
* @group functional
17+
*/
1518
class SendAndReceiveMessageTest extends TestCase
1619
{
1720
public function test()

tests/Functional/SslConnectionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Connectors\RabbitMQConnector;
1212
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
1313

14+
/**
15+
* @group functional
16+
*/
1417
class SslConnectionTest extends TestCase
1518
{
1619
public function testConnectorEstablishSecureConnectionWithRabbitMQBroker()

tests/Functional/StreamConnectionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Connectors\RabbitMQConnector;
1212
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
1313

14+
/**
15+
* @group functional
16+
*/
1417
class StreamConnectionTest extends TestCase
1518
{
1619
public function testConnectorEstablishSecureConnectionWithRabbitMQBroker()

tests/Queue/Jobs/RabbitMQJobTest.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,36 @@ public function testShouldUseDetectDeadlocksTrait()
3838

3939
public function testCouldBeConstructedWithExpectedArguments()
4040
{
41-
new RabbitMQJob(
41+
$queue = $this->createMock(\Interop\Amqp\AmqpQueue::class);
42+
$queue
43+
->expects($this->once())
44+
->method('getQueueName')
45+
->willReturn('theQueueName')
46+
;
47+
48+
$consumerMock = $this->createConsumerMock();
49+
$consumerMock
50+
->expects($this->once())
51+
->method('getQueue')
52+
->willReturn($queue)
53+
;
54+
55+
$job = new RabbitMQJob(
4256
new Container(),
4357
$this->createRabbitMQQueueMock(),
44-
$this->createConsumerMock(),
58+
$consumerMock,
4559
new AmqpMessage()
4660
);
61+
62+
$this->assertAttributeSame('theQueueName', 'queue', $job);
4763
}
4864

4965
/**
5066
* @return AmqpConsumer|\PHPUnit_Framework_MockObject_MockObject|AmqpConsumer
5167
*/
52-
private function createConsumerMock(string $queueName = 'test')
68+
private function createConsumerMock()
5369
{
54-
$mock = $this->createMock(AmqpConsumer::class);
55-
56-
if ($queueName !== '')
57-
{
58-
$mock->expects($this->once())
59-
->method('getQueue')
60-
->willReturn(new AmqpQueue($queueName));
61-
}
62-
63-
return $mock;
70+
return $this->createMock(AmqpConsumer::class);
6471
}
6572

6673
/**

tests/Queue/RabbitMQQueueTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,11 @@ public function testShouldReturnRabbitMQJobIfMessageReceivedFromQueue()
363363
->method('receiveNoWait')
364364
->willReturn($message)
365365
;
366+
$consumer
367+
->expects($this->once())
368+
->method('getQueue')
369+
->willReturn($queue)
370+
;
366371

367372
$context = $this->createAmqpContext();
368373
$context

0 commit comments

Comments
 (0)