ActivemqTest.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Queue
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /*
  23. * The adapter test class provides a universal test class for all of the
  24. * abstract methods.
  25. *
  26. * All methods marked not supported are explictly checked for for throwing
  27. * an exception.
  28. */
  29. /** PHPUnit Test Case */
  30. require_once 'PHPUnit/Framework/TestCase.php';
  31. /** TestHelp.php */
  32. require_once dirname(__FILE__) . '/../../../TestHelper.php';
  33. require_once 'Zend/Queue/Adapter/AdapterTest.php';
  34. /**
  35. * @category Zend
  36. * @package Zend_Queue
  37. * @subpackage UnitTests
  38. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  39. * @license http://framework.zend.com/license/new-bsd New BSD License
  40. * @group Zend_Queue
  41. */
  42. class Zend_Queue_Adapter_ActivemqTest extends Zend_Queue_Adapter_AdapterTest
  43. {
  44. /**
  45. * Test setup
  46. */
  47. public function setUp()
  48. {
  49. if (!TESTS_ZEND_QUEUE_ACTIVEMQ_ENABLED) {
  50. $this->markTestSkipped('TESTS_ZEND_QUEUE_ACTIVEMQ_ENABLED is not enabled in TestConfiguration.php');
  51. }
  52. parent::setUp();
  53. }
  54. /**
  55. * getAdapterName() is an method to help make AdapterTest work with any
  56. * new adapters
  57. *
  58. * You must overload this method
  59. *
  60. * @return string
  61. */
  62. public function getAdapterName()
  63. {
  64. return 'Activemq';
  65. }
  66. public function getTestConfig()
  67. {
  68. $driverOptions = array();
  69. if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST')) {
  70. $driverOptions['host'] = TESTS_ZEND_QUEUE_ACTIVEMQ_HOST;
  71. }
  72. if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_PORT')) {
  73. $driverOptions['port'] = TESTS_ZEND_QUEUE_ACTIVEMQ_PORT;
  74. }
  75. if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME')) {
  76. $driverOptions['scheme'] = TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME;
  77. }
  78. return array('driverOptions' => $driverOptions);
  79. }
  80. /**
  81. * Stomped requires specific name types
  82. */
  83. public function createQueueName($name)
  84. {
  85. return '/temp-queue/' . $name;
  86. }
  87. public function testConst()
  88. {
  89. /**
  90. * @see Zend_Queue_Adapter_Activemq
  91. */
  92. require_once 'Zend/Queue/Adapter/Activemq.php';
  93. $this->assertTrue(is_string(Zend_Queue_Adapter_Activemq::DEFAULT_SCHEME));
  94. $this->assertTrue(is_string(Zend_Queue_Adapter_Activemq::DEFAULT_HOST));
  95. $this->assertTrue(is_integer(Zend_Queue_Adapter_Activemq::DEFAULT_PORT));
  96. }
  97. }