-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from hirak/unittest
Improve test coverage
- Loading branch information
Showing
12 changed files
with
150 additions
and
44 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PATH_add ~/.php/7.0.6/bin |
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
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
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
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,40 @@ | ||
<?php | ||
namespace Hirak\Prestissimo; | ||
|
||
class BaseRequestTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testSetURL() | ||
{ | ||
$req = new BaseRequest; | ||
$req->setURL('http://www.example.com/'); | ||
|
||
self::assertEquals('http://www.example.com/', $req->getURL()); | ||
} | ||
|
||
public function testGetMaskedURL() | ||
{ | ||
$req = new BaseRequest; | ||
$req->setURL('http://user:pass@example.com/p/a/t/h?token=opensesame'); | ||
|
||
self::assertEquals('http://example.com/p/a/t/h', $req->getMaskedURL()); | ||
} | ||
|
||
public function testGetOriginURL() | ||
{ | ||
$req = new BaseRequest; | ||
$req->setURL('http://user:pass@example.com:1337/p/a/t/h?token=opensesame'); | ||
|
||
self::assertEquals('http://example.com:1337', $req->getOriginURL()); | ||
} | ||
|
||
public function testCA() | ||
{ | ||
$req = new BaseRequest; | ||
$req->setURL('http://www.example.com/'); | ||
$req->setCA('path/to/capath', 'path/to/ca.pem'); | ||
|
||
$options = $req->getCurlOptions(); | ||
self::assertArrayHasKey(CURLOPT_CAPATH, $options); | ||
self::assertArrayHasKey(CURLOPT_CAINFO, $options); | ||
} | ||
} |
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
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,13 @@ | ||
<?php | ||
namespace Hirak\Prestissimo; | ||
|
||
class ShareTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testSetup() | ||
{ | ||
$ch = curl_init(); | ||
Share::setup($ch); | ||
|
||
self::assertInternalType('resource', $ch); | ||
} | ||
} |