Skip to content

Commit

Permalink
Merge pull request #11 from mhetreramesh/master
Browse files Browse the repository at this point in the history
Phpunit config for hhvm
  • Loading branch information
mhetreramesh authored Jul 2, 2018
2 parents f6f8bed + 65cd763 commit ddb51cb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
24 changes: 24 additions & 0 deletions phpunit.hhvm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./phpunit.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="true"
>
<testsuites>
<testsuite name="backblaze-b2">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit>
10 changes: 7 additions & 3 deletions tests/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
namespace BackblazeB2\Tests;

use BackblazeB2\Http\Client as HttpClient;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;


trait TestHelper
{
protected function buildGuzzleFromResponses(array $responses, $history = null)
{
$mock = new \GuzzleHttp\Handler\MockHandler($responses);
$handler = new \GuzzleHttp\HandlerStack($mock);
$mock = new MockHandler($responses);
$handler = new HandlerStack($mock);

if ($history) {
$handler->push($history);
Expand All @@ -22,6 +26,6 @@ protected function buildResponseFromStub($statusCode, array $headers = [], $resp
{
$response = file_get_contents(dirname(__FILE__) . '/responses/' . $responseFile);

return new \GuzzleHttp\Psr7\Response($statusCode, $headers, $response);
return new Response($statusCode, $headers, $response);
}
}

0 comments on commit ddb51cb

Please sign in to comment.