FactoryTest.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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_Cloud
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. // Call Zend_Cloud_DocumentService_FactoryTest::main() if this source file is executed directly.
  22. if (!defined("PHPUnit_MAIN_METHOD")) {
  23. define("PHPUnit_MAIN_METHOD", "Zend_Cloud_DocumentService_FactoryTest::main");
  24. }
  25. /**
  26. * @see Zend_Config_Ini
  27. */
  28. require_once 'Zend/Config/Ini.php';
  29. /**
  30. * @see Zend_Cloud_DocumentService_Factory
  31. */
  32. require_once 'Zend/Cloud/DocumentService/Factory.php';
  33. /**
  34. * Test class for Zend_Cloud_DocumentService_Factory
  35. *
  36. * @category Zend
  37. * @package Zend_Cloud
  38. * @subpackage UnitTests
  39. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  40. * @license http://framework.zend.com/license/new-bsd New BSD License
  41. * @group Zend_Cloud
  42. */
  43. class Zend_Cloud_DocumentService_FactoryTest extends PHPUnit_Framework_TestCase
  44. {
  45. /**
  46. * Runs the test methods of this class.
  47. *
  48. * @return void
  49. */
  50. public static function main()
  51. {
  52. $suite = new PHPUnit_Framework_TestSuite(__CLASS__);
  53. $result = PHPUnit_TextUI_TestRunner::run($suite);
  54. }
  55. public function testGetDocumentAdapterKey()
  56. {
  57. $this->assertTrue(is_string(Zend_Cloud_DocumentService_Factory::DOCUMENT_ADAPTER_KEY));
  58. }
  59. public function testGetAdapterWithConfig() {
  60. // SimpleDB adapter
  61. $simpleDbAdapter = Zend_Cloud_DocumentService_Factory::getAdapter(
  62. new Zend_Config(Zend_Cloud_DocumentService_Adapter_SimpleDbTest::getConfigArray())
  63. );
  64. $this->assertEquals('Zend_Cloud_DocumentService_Adapter_SimpleDb', get_class($simpleDbAdapter));
  65. // Azure adapter
  66. $azureAdapter = Zend_Cloud_DocumentService_Factory::getAdapter(
  67. new Zend_Config(Zend_Cloud_DocumentService_Adapter_WindowsAzureTest::getConfigArray())
  68. );
  69. $this->assertEquals('Zend_Cloud_DocumentService_Adapter_WindowsAzure', get_class($azureAdapter));
  70. }
  71. }
  72. // Call Zend_Cloud_DocumentService_FactoryTest::main() if this source file is executed directly.
  73. if (PHPUnit_MAIN_METHOD == "Zend_Cloud_DocumentService_FactoryTest::main") {
  74. Zend_Cloud_DocumentService_FactoryTest::main();
  75. }