Repository navigation
Expand file tree
/
Copy pathStompConnectionFactoryTest.php
More file actions
55 lines (39 loc) · 1.67 KB
/
Copy pathStompConnectionFactoryTest.php
File metadata and controls
55 lines (39 loc) · 1.67 KB
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
50
51
52
53
54
55
<?php
namespace Enqueue\Stomp\Tests;
use Enqueue\Stomp\StompConnectionFactory;
use Enqueue\Stomp\StompContext;
use Enqueue\Test\ClassExtensionTrait;
use Interop\Queue\ConnectionFactory;
class StompConnectionFactoryTest extends \PHPUnit\Framework\TestCase
{
use ClassExtensionTrait;
public function testShouldImplementConnectionFactoryInterface()
{
$this->assertClassImplements(ConnectionFactory::class, StompConnectionFactory::class);
}
public function testShouldCreateLazyContext()
{
$factory = new StompConnectionFactory(['lazy' => true]);
$context = $factory->createContext();
$this->assertInstanceOf(StompContext::class, $context);
$this->assertAttributeEquals(null, 'stomp', $context);
$this->assertAttributeEquals(true, 'useExchangePrefix', $context);
$this->assertInternalType('callable', $this->readAttribute($context, 'stompFactory'));
}
public function testShouldCreateRabbitMQContext()
{
$factory = new StompConnectionFactory('stomp+rabbitmq://');
$context = $factory->createContext();
$this->assertInstanceOf(StompContext::class, $context);
$this->assertAttributeEquals(null, 'stomp', $context);
$this->assertAttributeEquals(true, 'useExchangePrefix', $context);
}
public function testShouldCreateActiveMQContext()
{
$factory = new StompConnectionFactory('stomp+activemq://');
$context = $factory->createContext();
$this->assertInstanceOf(StompContext::class, $context);
$this->assertAttributeEquals(null, 'stomp', $context);
$this->assertAttributeEquals(false, 'useExchangePrefix', $context);
}
}