mirror of
https://github.com/SkillDisplay/PHPToolKit.git
synced 2024-11-24 00:26:09 +01:00
Merge pull request #13 from SkillDisplay/fix-guzzle-mocking
[BUGFIX] Guzzle mocking for response body
This commit is contained in:
commit
d4bc19dd20
3 changed files with 6 additions and 3 deletions
|
@ -26,6 +26,7 @@ namespace SkillDisplay\PHPToolKit\Tests\Unit\Api;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Psr7\Request;
|
use GuzzleHttp\Psr7\Request;
|
||||||
use GuzzleHttp\Psr7\Response;
|
use GuzzleHttp\Psr7\Response;
|
||||||
|
use GuzzleHttp\Psr7\Utils;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use SkillDisplay\PHPToolKit\Api\Campaigns;
|
use SkillDisplay\PHPToolKit\Api\Campaigns;
|
||||||
|
@ -75,7 +76,7 @@ class CampaignsTest extends TestCase
|
||||||
}))->willReturn($response->reveal());
|
}))->willReturn($response->reveal());
|
||||||
|
|
||||||
$response->getStatusCode()->willReturn(200);
|
$response->getStatusCode()->willReturn(200);
|
||||||
$response->getBody()->willReturn('{"Version": "1.0","ErrorMessage": "","Campaigns": [{"uid": 1},{"uid": 2}]}');
|
$response->getBody()->willReturn(Utils::streamFor('{"Version": "1.0","ErrorMessage": "","Campaigns": [{"uid": 1},{"uid": 2}]}'));
|
||||||
|
|
||||||
$subject = new Campaigns(
|
$subject = new Campaigns(
|
||||||
$settings->reveal(),
|
$settings->reveal(),
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace SkillDisplay\PHPToolKit\Tests\Unit\Api;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Psr7\Request;
|
use GuzzleHttp\Psr7\Request;
|
||||||
use GuzzleHttp\Psr7\Response;
|
use GuzzleHttp\Psr7\Response;
|
||||||
|
use GuzzleHttp\Psr7\Utils;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use SkillDisplay\PHPToolKit\Api\SkillSet;
|
use SkillDisplay\PHPToolKit\Api\SkillSet;
|
||||||
|
@ -77,7 +78,7 @@ class SkillSetTest extends TestCase
|
||||||
}))->willReturn($response->reveal());
|
}))->willReturn($response->reveal());
|
||||||
|
|
||||||
$response->getStatusCode()->willReturn(200);
|
$response->getStatusCode()->willReturn(200);
|
||||||
$response->getBody()->willReturn('{"uid":10}');
|
$response->getBody()->willReturn(Utils::streamFor('{"uid":10}'));
|
||||||
|
|
||||||
$subject = new SkillSet(
|
$subject = new SkillSet(
|
||||||
$settings->reveal(),
|
$settings->reveal(),
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace SkillDisplay\PHPToolKit\Tests\Unit\Api;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Psr7\Request;
|
use GuzzleHttp\Psr7\Request;
|
||||||
use GuzzleHttp\Psr7\Response;
|
use GuzzleHttp\Psr7\Response;
|
||||||
|
use GuzzleHttp\Psr7\Utils;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use SkillDisplay\PHPToolKit\Api\Skill;
|
use SkillDisplay\PHPToolKit\Api\Skill;
|
||||||
|
@ -77,7 +78,7 @@ class SkillTest extends TestCase
|
||||||
}))->willReturn($response->reveal());
|
}))->willReturn($response->reveal());
|
||||||
|
|
||||||
$response->getStatusCode()->willReturn(200);
|
$response->getStatusCode()->willReturn(200);
|
||||||
$response->getBody()->willReturn('{"uid":10}');
|
$response->getBody()->willReturn(Utils::streamFor('{"uid":10}'));
|
||||||
|
|
||||||
$subject = new Skill(
|
$subject = new Skill(
|
||||||
$settings->reveal(),
|
$settings->reveal(),
|
||||||
|
|
Loading…
Reference in a new issue