/tests/tests/lib/ezutils/ezhttptool_regression.php

http://github.com/ezsystems/ezpublish · PHP · 49 lines · 22 code · 5 blank · 22 comment · 0 complexity · 59f5a51fddfbe3dcd0aa8bdd61c01a39 MD5 · raw file

  1. <?php
  2. /**
  3. * File containing the eZHTTPToolRegression class
  4. *
  5. * @copyright Copyright (C) eZ Systems AS. All rights reserved.
  6. * @license For full copyright and license information view LICENSE file distributed with this source code.
  7. * @version //autogentag//
  8. * @package tests
  9. */
  10. class eZHTTPToolRegression extends ezpTestCase
  11. {
  12. /**
  13. * If you send an HTTP request using eZHTTPTool::sendHTTPRequest( ) to an
  14. * URL with a domain name containing a dash ( -), it's misunderpreted and
  15. * doesn't get executed.
  16. *
  17. * @link http://issues.ez.no/10651
  18. */
  19. public function testSendRequestContainingDashes()
  20. {
  21. self::markTestSkipped( "Test disabled pending update." );
  22. $url = 'http://php-og.mgdm.net/';
  23. $this->assertInternalType(
  24. PHPUnit_Framework_Constraint_IsType::TYPE_STRING,
  25. eZHTTPTool::sendHTTPRequest( $url, 80, false, 'eZ Publish', false )
  26. );
  27. }
  28. /**
  29. * Some parts of eZ do not benefit from the enhanced checks implemented
  30. * in eZSys::isSSLNow(), especially when using an SSL reverse proxy
  31. * configured to send the HTTP_X_FORWARDED_PROTO header.
  32. *
  33. * @link http://issues.ez.no/21731
  34. */
  35. public function test_createRedirectUrl()
  36. {
  37. $path = '/a/root/rel/ative';
  38. self::assertEquals( 'http://example.com' . $path, eZHTTPTool::createRedirectUrl( $path, array() ) );
  39. $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
  40. self::assertEquals( 'https://example.com' . $path, eZHTTPTool::createRedirectUrl( $path, array() ) );
  41. unset( $_SERVER['HTTP_X_FORWARDED_PROTO'] );
  42. }
  43. }
  44. ?>