From eb066e224d5c3f14586c2b95226291c438f18f5c Mon Sep 17 00:00:00 2001 From: Markus Klein Date: Thu, 6 Jul 2023 14:47:47 +0200 Subject: [PATCH] [BUGFIX] Guzzle mocking for response body --- tests/Unit/Api/CampaignsTest.php | 3 ++- tests/Unit/Api/SkillSetTest.php | 3 ++- tests/Unit/Api/SkillTest.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Unit/Api/CampaignsTest.php b/tests/Unit/Api/CampaignsTest.php index e2adb64..d50af9b 100644 --- a/tests/Unit/Api/CampaignsTest.php +++ b/tests/Unit/Api/CampaignsTest.php @@ -26,6 +26,7 @@ namespace SkillDisplay\PHPToolKit\Tests\Unit\Api; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; +use GuzzleHttp\Psr7\Utils; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use SkillDisplay\PHPToolKit\Api\Campaigns; @@ -75,7 +76,7 @@ class CampaignsTest extends TestCase }))->willReturn($response->reveal()); $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( $settings->reveal(), diff --git a/tests/Unit/Api/SkillSetTest.php b/tests/Unit/Api/SkillSetTest.php index cb4ff9e..154e9ef 100644 --- a/tests/Unit/Api/SkillSetTest.php +++ b/tests/Unit/Api/SkillSetTest.php @@ -26,6 +26,7 @@ namespace SkillDisplay\PHPToolKit\Tests\Unit\Api; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; +use GuzzleHttp\Psr7\Utils; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use SkillDisplay\PHPToolKit\Api\SkillSet; @@ -77,7 +78,7 @@ class SkillSetTest extends TestCase }))->willReturn($response->reveal()); $response->getStatusCode()->willReturn(200); - $response->getBody()->willReturn('{"uid":10}'); + $response->getBody()->willReturn(Utils::streamFor('{"uid":10}')); $subject = new SkillSet( $settings->reveal(), diff --git a/tests/Unit/Api/SkillTest.php b/tests/Unit/Api/SkillTest.php index 55a0517..e3e0ad8 100644 --- a/tests/Unit/Api/SkillTest.php +++ b/tests/Unit/Api/SkillTest.php @@ -26,6 +26,7 @@ namespace SkillDisplay\PHPToolKit\Tests\Unit\Api; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; +use GuzzleHttp\Psr7\Utils; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use SkillDisplay\PHPToolKit\Api\Skill; @@ -77,7 +78,7 @@ class SkillTest extends TestCase }))->willReturn($response->reveal()); $response->getStatusCode()->willReturn(200); - $response->getBody()->willReturn('{"uid":10}'); + $response->getBody()->willReturn(Utils::streamFor('{"uid":10}')); $subject = new Skill( $settings->reveal(),