AbstractConnectionFactoryTest.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php declare(strict_types=1);
  2. namespace mikemadisonweb\rabbitmq\tests\components;
  3. use mikemadisonweb\rabbitmq\components\AbstractConnectionFactory;
  4. use mikemadisonweb\rabbitmq\tests\TestCase;
  5. use PhpAmqpLib\Connection\AbstractConnection;
  6. use PhpAmqpLib\Connection\AMQPLazyConnection;
  7. class AbstractConnectionFactoryTest extends TestCase
  8. {
  9. public function testCreateConnection() {
  10. $testOptions = [
  11. 'name' => 'test',
  12. 'url' => null,
  13. 'host' => null,
  14. 'port' => 5672,
  15. 'user' => 'guest',
  16. 'password' => 'guest',
  17. 'vhost' => '/',
  18. 'connection_timeout' => 3,
  19. 'read_write_timeout' => 3,
  20. 'ssl_context' => null,
  21. 'keepalive' => false,
  22. 'heartbeat' => 0,
  23. 'channel_rpc_timeout' => 0.0,
  24. ];
  25. $factory = new AbstractConnectionFactory(AMQPLazyConnection::class, $testOptions);
  26. $connection = $factory->createConnection();
  27. $this->assertInstanceOf(AbstractConnection::class, $connection);
  28. }
  29. }