FactoryTest.php 3.6 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-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: AllTests.php 13626 2009-01-14 18:24:57Z matthew $
  21. */
  22. /** PHPUnit Test Case */
  23. require_once 'PHPUnit/Framework/TestCase.php';
  24. /** Zend_Queue */
  25. require_once 'Zend/Queue.php';
  26. /** Zend_Queue_Exception */
  27. require_once 'Zend/Queue/Exception.php';
  28. /** Zend_Queue_Adapter_* */
  29. require_once 'Zend/Queue/Adapter/Array.php';
  30. require_once 'Zend/Queue/Adapter/Db.php';
  31. require_once 'Zend/Queue/Adapter/Memcacheq.php';
  32. require_once 'Zend/Queue/Adapter/Apachemq.php';
  33. /**
  34. * @category Zend
  35. * @package Zend_Queue
  36. * @subpackage UnitTests
  37. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  38. * @license http://framework.zend.com/license/new-bsd New BSD License
  39. * @version $Id: AllTests.php 13626 2009-01-14 18:24:57Z matthew $
  40. */
  41. class Zend_Queue_FactoryTest extends PHPUnit_Framework_TestCase
  42. {
  43. protected function setUp()
  44. {
  45. date_default_timezone_set('GMT');
  46. }
  47. public function testDb()
  48. {
  49. $this->markTestSkipped('Db setup required');
  50. $config = array('name' => 'queue1',
  51. 'driverOptions' => array('host' => 'db1.domain.tld',
  52. 'username' => 'my_username',
  53. 'password' => 'my_password',
  54. 'dbname' => 'messaging',
  55. 'type' => 'pdo_mysql',
  56. 'port' => 3306)); // optional parameter
  57. $adapter = new Zend_Queue('Db', $config);
  58. $this->assertTrue($adapter instanceof Zend_Queue);
  59. }
  60. public function testMemcacheq()
  61. {
  62. $this->markTestSkipped('MemcacheQ setup required');
  63. $config = array('name' => 'queue1',
  64. 'driverOptions' => array('host' => 'memcacheq.domain.tld',
  65. 'port' => 22201));
  66. $adapter = new Zend_Queue('Memcacheq', $config);
  67. $this->assertTrue($adapter instanceof Zend_Queue);
  68. }
  69. public function testApachemq()
  70. {
  71. $this->markTestSkipped('Stomp setup required');
  72. $config = array('name' => 'queue1',
  73. 'driverOptions' => array('host' => 'msg.domain.tld',
  74. 'port' => 61613,
  75. 'username' => 'username',
  76. 'password' => 'password'));
  77. $adapter = new Zend_Queue('Stomp', $config);
  78. $this->assertTrue($adapter instanceof Zend_Queue);
  79. }
  80. public function testArray()
  81. {
  82. $config = array('name' => 'queue1',
  83. 'driverOptions' => array());
  84. $adapter = new Zend_Queue('Array', $config);
  85. $this->assertTrue($adapter instanceof Zend_Queue);
  86. }
  87. }