Skip to content

Commit 0a8dae2

Browse files
committed
Do not use deprecated classes.
1 parent 228bb9a commit 0a8dae2

21 files changed

+215
-215
lines changed

src/ConnectionFactorySpec.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Interop\Queue\Spec;
4+
5+
use Interop\Queue\ConnectionFactory;
6+
use Interop\Queue\Context;
7+
use PHPUnit\Framework\TestCase;
8+
9+
abstract class ConnectionFactorySpec extends TestCase
10+
{
11+
public function testShouldImplementConnectionFactoryInterface()
12+
{
13+
$this->assertInstanceOf(ConnectionFactory::class, $this->createConnectionFactory());
14+
}
15+
16+
public function testShouldReturnContextOnCreateContextMethodCall()
17+
{
18+
$factory = $this->createConnectionFactory();
19+
20+
$this->assertInstanceOf(Context::class, $factory->createContext());
21+
}
22+
23+
/**
24+
* @return ConnectionFactory
25+
*/
26+
abstract protected function createConnectionFactory();
27+
}

src/PsrContextSpec.php renamed to src/ContextSpec.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
namespace Interop\Queue\Spec;
44

5-
use Interop\Queue\PsrConsumer;
6-
use Interop\Queue\PsrContext;
7-
use Interop\Queue\PsrMessage;
8-
use Interop\Queue\PsrProducer;
9-
use Interop\Queue\PsrQueue;
10-
use Interop\Queue\PsrTopic;
5+
use Interop\Queue\Consumer;
6+
use Interop\Queue\Context;
7+
use Interop\Queue\Message;
8+
use Interop\Queue\Producer;
9+
use Interop\Queue\Queue;
10+
use Interop\Queue\Topic;
1111
use PHPUnit\Framework\TestCase;
1212

13-
abstract class PsrContextSpec extends TestCase
13+
abstract class ContextSpec extends TestCase
1414
{
15-
public function testShouldImplementPsrContextInterface()
15+
public function testShouldImplementContextInterface()
1616
{
17-
$this->assertInstanceOf(PsrContext::class, $this->createContext());
17+
$this->assertInstanceOf(Context::class, $this->createContext());
1818
}
1919

2020
public function testShouldCreateEmptyMessageOnCreateMessageMethodCallWithoutArguments()
@@ -23,7 +23,7 @@ public function testShouldCreateEmptyMessageOnCreateMessageMethodCallWithoutArgu
2323

2424
$message = $context->createMessage();
2525

26-
$this->assertInstanceOf(PsrMessage::class, $message);
26+
$this->assertInstanceOf(Message::class, $message);
2727
$this->assertSame('', $message->getBody());
2828
$this->assertSame([], $message->getHeaders());
2929
$this->assertSame([], $message->getProperties());
@@ -35,7 +35,7 @@ public function testShouldCreateMessageOnCreateMessageMethodCallWithArguments()
3535

3636
$message = $context->createMessage('theBody', ['foo' => 'fooVal'], ['bar' => 'barVal']);
3737

38-
$this->assertInstanceOf(PsrMessage::class, $message);
38+
$this->assertInstanceOf(Message::class, $message);
3939
$this->assertSame('theBody', $message->getBody());
4040
$this->assertSame(['bar' => 'barVal'], $message->getHeaders());
4141
$this->assertSame(['foo' => 'fooVal'], $message->getProperties());
@@ -47,7 +47,7 @@ public function testShouldCreateTopicWithGivenName()
4747

4848
$topic = $context->createTopic('theName');
4949

50-
$this->assertInstanceOf(PsrTopic::class, $topic);
50+
$this->assertInstanceOf(Topic::class, $topic);
5151
$this->assertSame('theName', $topic->getTopicName());
5252
}
5353

@@ -57,7 +57,7 @@ public function testShouldCreateQueueWithGivenName()
5757

5858
$queue = $context->createQueue('theName');
5959

60-
$this->assertInstanceOf(PsrQueue::class, $queue);
60+
$this->assertInstanceOf(Queue::class, $queue);
6161
$this->assertSame('theName', $queue->getQueueName());
6262
}
6363

@@ -67,7 +67,7 @@ public function testShouldCreateProducerOnCreateProducerMethodCall()
6767

6868
$producer = $context->createProducer();
6969

70-
$this->assertInstanceOf(PsrProducer::class, $producer);
70+
$this->assertInstanceOf(Producer::class, $producer);
7171
}
7272

7373
public function testShouldCreateConsumerOnCreateConsumerMethodCall()
@@ -76,11 +76,11 @@ public function testShouldCreateConsumerOnCreateConsumerMethodCall()
7676

7777
$consumer = $context->createConsumer($context->createQueue('aQueue'));
7878

79-
$this->assertInstanceOf(PsrConsumer::class, $consumer);
79+
$this->assertInstanceOf(Consumer::class, $consumer);
8080
}
8181

8282
/**
83-
* @return PsrContext
83+
* @return Context
8484
*/
8585
abstract protected function createContext();
8686
}

src/PsrMessageSpec.php renamed to src/MessageSpec.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace Interop\Queue\Spec;
44

5-
use Interop\Queue\PsrMessage;
5+
use Interop\Queue\Message;
66
use PHPUnit\Framework\TestCase;
77

8-
abstract class PsrMessageSpec extends TestCase
8+
abstract class MessageSpec extends TestCase
99
{
1010
public function testShouldImplementMessageInterface()
1111
{
12-
$this->assertInstanceOf(PsrMessage::class, $this->createMessage());
12+
$this->assertInstanceOf(Message::class, $this->createMessage());
1313
}
1414

1515
public function testShouldSetRedeliveredToFalseInConstructor()
@@ -186,7 +186,7 @@ public function testShouldReturnPreviouslySetReplyTo()
186186
}
187187

188188
/**
189-
* @return PsrMessage
189+
* @return Message
190190
*/
191191
abstract protected function createMessage();
192192
}

src/ProducerSpec.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Interop\Queue\Spec;
4+
5+
use Interop\Queue\CompletionListener;
6+
use Interop\Queue\Message;
7+
use Interop\Queue\Producer;
8+
use PHPUnit\Framework\TestCase;
9+
10+
abstract class ProducerSpec extends TestCase
11+
{
12+
public function testShouldImplementContextInterface()
13+
{
14+
$this->assertInstanceOf(Producer::class, $this->createProducer());
15+
}
16+
17+
/**
18+
* @return Producer
19+
*/
20+
abstract protected function createProducer();
21+
}

src/PsrConnectionFactorySpec.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/PsrProducerSpec.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/PsrQueueSpec.php renamed to src/QueueSpec.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
namespace Interop\Queue\Spec;
44

5-
use Interop\Queue\PsrQueue;
5+
use Interop\Queue\Queue;
66
use PHPUnit\Framework\TestCase;
77

8-
abstract class PsrQueueSpec extends TestCase
8+
abstract class QueueSpec extends TestCase
99
{
1010
const EXPECTED_QUEUE_NAME = 'theQueueName';
1111

1212
public function testShouldImplementQueueInterface()
1313
{
14-
$this->assertInstanceOf(PsrQueue::class, $this->createQueue());
14+
$this->assertInstanceOf(Queue::class, $this->createQueue());
1515
}
1616

1717
public function testShouldReturnQueueName()
@@ -22,7 +22,7 @@ public function testShouldReturnQueueName()
2222
}
2323

2424
/**
25-
* @return PsrQueue
25+
* @return Queue
2626
*/
2727
abstract protected function createQueue();
2828
}

src/RequeueMessageSpec.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Interop\Queue\Spec;
44

5-
use Interop\Queue\PsrContext;
6-
use Interop\Queue\PsrMessage;
7-
use Interop\Queue\PsrQueue;
8-
use Interop\Queue\PsrTopic;
5+
use Interop\Queue\Context;
6+
use Interop\Queue\Message;
7+
use Interop\Queue\Queue;
8+
use Interop\Queue\Topic;
99
use PHPUnit\Framework\TestCase;
1010

1111
/**
@@ -14,7 +14,7 @@
1414
abstract class RequeueMessageSpec extends TestCase
1515
{
1616
/**
17-
* @var PsrContext
17+
* @var Context
1818
*/
1919
private $context;
2020

@@ -42,39 +42,39 @@ public function test()
4242
$context->createProducer()->send($queue, $context->createMessage($expectedBody));
4343

4444
$message = $consumer->receive(2000);
45-
$this->assertInstanceOf(PsrMessage::class, $message);
45+
$this->assertInstanceOf(Message::class, $message);
4646
$consumer->reject($message, true);
4747

4848
$requeuedMessage = $message = $consumer->receive(2000);
49-
$this->assertInstanceOf(PsrMessage::class, $requeuedMessage);
49+
$this->assertInstanceOf(Message::class, $requeuedMessage);
5050
$consumer->acknowledge($message);
5151

5252
$this->assertSame($expectedBody, $requeuedMessage->getBody());
5353
}
5454

5555
/**
56-
* @return PsrContext
56+
* @return Context
5757
*/
5858
abstract protected function createContext();
5959

6060
/**
61-
* @param PsrContext $context
61+
* @param Context $context
6262
* @param string $queueName
6363
*
64-
* @return PsrQueue
64+
* @return Queue
6565
*/
66-
protected function createQueue(PsrContext $context, $queueName)
66+
protected function createQueue(Context $context, $queueName)
6767
{
6868
return $context->createQueue($queueName);
6969
}
7070

7171
/**
72-
* @param PsrContext $context
72+
* @param Context $context
7373
* @param string $topicName
7474
*
75-
* @return PsrTopic
75+
* @return Topic
7676
*/
77-
protected function createTopic(PsrContext $context, $topicName)
77+
protected function createTopic(Context $context, $topicName)
7878
{
7979
return $context->createTopic($topicName);
8080
}

src/SendAndReceiveDelayedMessageFromQueueSpec.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Interop\Queue\Spec;
44

5-
use Interop\Queue\PsrContext;
6-
use Interop\Queue\PsrMessage;
7-
use Interop\Queue\PsrQueue;
5+
use Interop\Queue\Context;
6+
use Interop\Queue\Message;
7+
use Interop\Queue\Queue;
88
use PHPUnit\Framework\TestCase;
99

1010
/**
@@ -13,7 +13,7 @@
1313
abstract class SendAndReceiveDelayedMessageFromQueueSpec extends TestCase
1414
{
1515
/**
16-
* @var PsrContext
16+
* @var Context
1717
*/
1818
private $context;
1919

@@ -46,25 +46,25 @@ public function test()
4646

4747
$message = $consumer->receive(8000); // 8 sec
4848

49-
$this->assertInstanceOf(PsrMessage::class, $message);
49+
$this->assertInstanceOf(Message::class, $message);
5050
$consumer->acknowledge($message);
5151
$this->assertSame($expectedBody, $message->getBody());
5252

5353
$this->assertGreaterThanOrEqual(4, microtime(true) - $sendAt);
5454
}
5555

5656
/**
57-
* @return PsrContext
57+
* @return Context
5858
*/
5959
abstract protected function createContext();
6060

6161
/**
62-
* @param PsrContext $context
62+
* @param Context $context
6363
* @param string $queueName
6464
*
65-
* @return PsrQueue
65+
* @return Queue
6666
*/
67-
protected function createQueue(PsrContext $context, $queueName)
67+
protected function createQueue(Context $context, $queueName)
6868
{
6969
return $context->createQueue($queueName);
7070
}

0 commit comments

Comments
 (0)