AbstractTest.php 2.9 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_Oauth
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. require_once 'Zend/Oauth/Signature/Plaintext.php';
  23. /**
  24. * @category Zend
  25. * @package Zend_Oauth
  26. * @subpackage UnitTests
  27. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  28. * @license http://framework.zend.com/license/new-bsd New BSD License
  29. * @group Zend_Oauth
  30. * @group Zend_Oauth_Signature
  31. */
  32. class Zend_Oauth_Signature_AbstractTest extends PHPUnit_Framework_TestCase
  33. {
  34. public function testNormaliseHttpBaseSignatureUrl()
  35. {
  36. $sign = new Zend_Oauth_Signature_Plaintext('foo');
  37. $url = 'HTTP://WWW.EXAMPLE.COM:80/REQUEST';
  38. $this->assertEquals('http://www.example.com/REQUEST', $sign->normaliseBaseSignatureUrl($url));
  39. }
  40. public function testNormaliseHttpsBaseSignatureUrl()
  41. {
  42. $sign = new Zend_Oauth_Signature_Plaintext('foo');
  43. $url = 'HTTPS://WWW.EXAMPLE.COM:443/REQUEST';
  44. $this->assertEquals('https://www.example.com/REQUEST', $sign->normaliseBaseSignatureUrl($url));
  45. }
  46. public function testNormaliseHttpPortBaseSignatureUrl()
  47. {
  48. $sign = new Zend_Oauth_Signature_Plaintext('foo');
  49. $url = 'HTTP://WWW.EXAMPLE.COM:443/REQUEST';
  50. $this->assertEquals('http://www.example.com:443/REQUEST', $sign->normaliseBaseSignatureUrl($url));
  51. }
  52. public function testNormaliseHttpsPortBaseSignatureUrl()
  53. {
  54. $sign = new Zend_Oauth_Signature_Plaintext('foo');
  55. $url = 'HTTPS://WWW.EXAMPLE.COM:80/REQUEST';
  56. $this->assertEquals('https://www.example.com:80/REQUEST', $sign->normaliseBaseSignatureUrl($url));
  57. }
  58. public function testNormaliseHttpsRemovesFragmentFromBaseSignatureUrl()
  59. {
  60. $sign = new Zend_Oauth_Signature_Plaintext('foo');
  61. $url = 'https://www.example.com/request#foo';
  62. $this->assertEquals('https://www.example.com/request', $sign->normaliseBaseSignatureUrl($url));
  63. }
  64. public function testNormaliseHttpsRemovesQueryFromBaseSignatureUrl()
  65. {
  66. $sign = new Zend_Oauth_Signature_Plaintext('foo');
  67. $url = 'https://www.example.com/request?foo=bar';
  68. $this->assertEquals('https://www.example.com/request', $sign->normaliseBaseSignatureUrl($url));
  69. }
  70. }