-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed call to error_log and added detail exception output from curl…
… execute to capturing exception
- Loading branch information
nick.fox
committed
Nov 22, 2013
1 parent
3d0eb21
commit cd87e6a
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Port over the original tests into a more traditional PHPUnit | ||
* format. Still need to hook into a lightweight HTTP server to | ||
* better test some things (e.g. obscure cURL settings). I've moved | ||
* the old tests and node.js server to the tests/.legacy directory. | ||
* @author nick fox <quixand gmail com> | ||
*/ | ||
namespace Httpful\Test; | ||
|
||
class curlOutputBugTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
/** | ||
* @author Nick Fox | ||
* @expectedException Httpful\Exception\ConnectionErrorException | ||
* @expectedExceptionMessage Unable to connect | ||
*/ | ||
public function testInvalidURLGeneratesUnexpectedOutput() | ||
{ | ||
\Httpful\Request::get('unavailable.url')->send(); | ||
} | ||
|
||
/** | ||
* @author Nick Fox | ||
*/ | ||
public function testInvalidURLGeneratesUnexpectedOutput_catchException() | ||
{ | ||
try { | ||
$output = \Httpful\Request::get('unavailable.url')->send(); | ||
} catch (\Httpful\Exception\ConnectionErrorException $expected) { | ||
$this->assertEquals('Unable to connect: 6 Couldn\'t resolve host \'unavailable.url\'', $expected->getMessage()); | ||
return; | ||
} | ||
$this->fail('An expected exception has not been raised.'); | ||
} | ||
} |