FactoryTest.php 2.9 KB

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