-
Notifications
You must be signed in to change notification settings - Fork 439
/
Copy pathDbalProducerTest.php
49 lines (40 loc) · 1.28 KB
/
DbalProducerTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Enqueue\Dbal\Tests;
use Enqueue\Dbal\DbalContext;
use Enqueue\Dbal\DbalMessage;
use Enqueue\Dbal\DbalProducer;
use Enqueue\Test\ClassExtensionTrait;
use Interop\Queue\Destination;
use Interop\Queue\Exception\InvalidDestinationException;
use Interop\Queue\Producer;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
class DbalProducerTest extends TestCase
{
use ClassExtensionTrait;
public function testShouldImplementProducerInterface()
{
$this->assertClassImplements(Producer::class, DbalProducer::class);
}
public function testShouldThrowIfDestinationOfInvalidType()
{
$this->expectException(InvalidDestinationException::class);
$this->expectExceptionMessage(
'The destination must be an instance of '.
'Enqueue\Dbal\DbalDestination but got '.
'Enqueue\Dbal\Tests\NotSupportedDestination1.'
);
$producer = new DbalProducer($this->createContextMock());
$producer->send(new NotSupportedDestination1(), new DbalMessage());
}
/**
* @return MockObject|DbalContext
*/
private function createContextMock()
{
return $this->createMock(DbalContext::class);
}
}
class NotSupportedDestination1 implements Destination
{
}