|
10 | 10 | use Enqueue\Sns\SnsProducer;
|
11 | 11 | use Enqueue\Test\ClassExtensionTrait;
|
12 | 12 | use Interop\Queue\Destination;
|
| 13 | +use Interop\Queue\Exception\DeliveryDelayNotSupportedException; |
13 | 14 | use Interop\Queue\Exception\InvalidDestinationException;
|
14 | 15 | use Interop\Queue\Exception\InvalidMessageException;
|
| 16 | +use Interop\Queue\Exception\PriorityNotSupportedException; |
| 17 | +use Interop\Queue\Exception\TimeToLiveNotSupportedException; |
15 | 18 | use Interop\Queue\Producer;
|
16 | 19 | use PHPUnit\Framework\TestCase;
|
17 | 20 |
|
@@ -84,6 +87,48 @@ public function testShouldThrowIfPublishFailed()
|
84 | 87 | $producer->send($destination, $message);
|
85 | 88 | }
|
86 | 89 |
|
| 90 | + public function testShouldThrowIfsetTimeToLiveIsNotNull() |
| 91 | + { |
| 92 | + $this->expectException(TimeToLiveNotSupportedException::class); |
| 93 | + |
| 94 | + $producer = new SnsProducer($this->createSnsContextMock()); |
| 95 | + $result = $producer->setTimeToLive(); |
| 96 | + |
| 97 | + $this->assertInstanceOf(SnsProducer::class, $result); |
| 98 | + |
| 99 | + $this->expectExceptionMessage('The provider does not support time to live feature'); |
| 100 | + |
| 101 | + $producer->setTimeToLive(200); |
| 102 | + } |
| 103 | + |
| 104 | + public function testShouldThrowIfsetPriorityIsNotNull() |
| 105 | + { |
| 106 | + $this->expectException(PriorityNotSupportedException::class); |
| 107 | + |
| 108 | + $producer = new SnsProducer($this->createSnsContextMock()); |
| 109 | + $result = $producer->setPriority(); |
| 110 | + |
| 111 | + $this->assertInstanceOf(SnsProducer::class, $result); |
| 112 | + |
| 113 | + $this->expectExceptionMessage('The provider does not support priority feature'); |
| 114 | + |
| 115 | + $producer->setPriority(200); |
| 116 | + } |
| 117 | + |
| 118 | + public function testShouldThrowIfsetDeliveryDelayIsNotNull() |
| 119 | + { |
| 120 | + $this->expectException(DeliveryDelayNotSupportedException::class); |
| 121 | + |
| 122 | + $producer = new SnsProducer($this->createSnsContextMock()); |
| 123 | + $result = $producer->setDeliveryDelay(); |
| 124 | + |
| 125 | + $this->assertInstanceOf(SnsProducer::class, $result); |
| 126 | + |
| 127 | + $this->expectExceptionMessage('The provider does not support delivery delay feature'); |
| 128 | + |
| 129 | + $producer->setDeliveryDelay(200); |
| 130 | + } |
| 131 | + |
87 | 132 | public function testShouldPublish()
|
88 | 133 | {
|
89 | 134 | $destination = new SnsDestination('queue-name');
|
|
0 commit comments