2
0

V1Test.php 2.7 KB

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