V1Test.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_Service_Amazon_Authentication
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2012 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 11973 2008-10-15 16:00:56Z matthew $
  21. */
  22. require_once 'Zend/Service/Amazon/Authentication/V1.php';
  23. /**
  24. * Amazon V1 authentication test case
  25. *
  26. * @category Zend
  27. * @package Zend_Service_Amazon_Authentication
  28. * @subpackage UnitTests
  29. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class Zend_Service_Amazon_Authentication_V1Test extends PHPUnit_Framework_TestCase
  33. {
  34. /**
  35. * @var Zend_Service_Amazon_Authentication_V2
  36. */
  37. private $Zend_Service_Amazon_Authentication_V2;
  38. /**
  39. * Prepares the environment before running a test.
  40. */
  41. protected function setUp()
  42. {
  43. parent::setUp();
  44. $this->Zend_Service_Amazon_Authentication_V1 = new Zend_Service_Amazon_Authentication_V1('0PN5J17HBGZHT7JJ3X82', 'uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o', '2007-12-01');
  45. }
  46. /**
  47. * Cleans up the environment after running a test.
  48. */
  49. protected function tearDown()
  50. {
  51. $this->Zend_Service_Amazon_Authentication_V1 = null;
  52. parent::tearDown();
  53. }
  54. /**
  55. * Tests Zend_Service_Amazon_Authentication_V2::generateSignature()
  56. */
  57. public function testGenerateDevPaySignature()
  58. {
  59. $url = "https://ls.amazonaws.com/";
  60. $params = array();
  61. $params['Action'] = "ActivateHostedProduct";
  62. $params['Timestamp'] = "2009-11-11T13:52:38Z";
  63. $ret = $this->Zend_Service_Amazon_Authentication_V1->generateSignature($url, $params);
  64. $this->assertEquals('31Q2YlgABM5X3GkYQpGErcL10Xc=', $params['Signature']);
  65. $this->assertEquals("ActionActivateHostedProductAWSAccessKeyId0PN5J17HBGZHT7JJ3X82SignatureVersion1Timestamp2009-11-11T13:52:38ZVersion2007-12-01", $ret);
  66. }
  67. }