requestTest.php 591 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * @author nick fox <quixand gmail com>
  4. */
  5. namespace Httpful\Test;
  6. class requestTest extends \PHPUnit\Framework\TestCase
  7. {
  8. /**
  9. * @author Nick Fox
  10. */
  11. public function testGet_InvalidURL()
  12. {
  13. // Silence the default logger via whenError override
  14. $caught = false;
  15. try
  16. {
  17. \Httpful\Request::get('unavailable.url')->whenError(function($error) {})->send();
  18. }
  19. catch (\Httpful\Exception\ConnectionErrorException $e)
  20. {
  21. $caught = true;
  22. }
  23. $this->assertTrue($caught);
  24. }
  25. }