GetHttpUrlTest.php 951 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * HttpUtils' tests
  4. */
  5. require_once 'application/HttpUtils.php';
  6. /**
  7. * Unitary tests for get_http_response()
  8. */
  9. class GetHttpUrlTest extends PHPUnit_Framework_TestCase
  10. {
  11. /**
  12. * Get an invalid local URL
  13. */
  14. public function testGetInvalidLocalUrl()
  15. {
  16. // Local
  17. list($headers, $content) = get_http_response('/non/existent', 1);
  18. $this->assertEquals('Invalid HTTP Url', $headers[0]);
  19. $this->assertFalse($content);
  20. // Non HTTP
  21. list($headers, $content) = get_http_response('ftp://save.tld/mysave', 1);
  22. $this->assertEquals('Invalid HTTP Url', $headers[0]);
  23. $this->assertFalse($content);
  24. }
  25. /**
  26. * Get an invalid remote URL
  27. */
  28. public function testGetInvalidRemoteUrl()
  29. {
  30. list($headers, $content) = @get_http_response('http://non.existent', 1);
  31. $this->assertFalse($headers);
  32. $this->assertFalse($content);
  33. }
  34. }