From 4af9c1c656805986654e588ba94f7c54a5ec9f58 Mon Sep 17 00:00:00 2001 From: julianzangl Date: Thu, 6 Jul 2023 15:10:44 +0200 Subject: [PATCH] test changes --- src/Api/SkillSetProgress.php | 2 +- src/Entity/SkillSetProgress.php | 3 ++- tests/Unit/Api/SkillSetProgressTest.php | 8 +++----- tests/Unit/Entity/SkillSetProgressTest.php | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Api/SkillSetProgress.php b/src/Api/SkillSetProgress.php index e8412e0..788cb0a 100644 --- a/src/Api/SkillSetProgress.php +++ b/src/Api/SkillSetProgress.php @@ -69,7 +69,7 @@ class SkillSetProgress throw new \Exception('Did not get proper response for SkillSetProgress.', 1688639840720); } - $body = (string)$result->getBody(); + $body = (string) $result->getBody(); if (strpos($body, 'Oops, an error occurred') !== false) { throw new \Exception('Did not get proper response for SkillSetProgress. SkillSet with id "' . $id . '" does probably not exist.', 1688639873065); diff --git a/src/Entity/SkillSetProgress.php b/src/Entity/SkillSetProgress.php index 49b22b7..20c6c76 100644 --- a/src/Entity/SkillSetProgress.php +++ b/src/Entity/SkillSetProgress.php @@ -25,7 +25,8 @@ namespace SkillDisplay\PHPToolKit\Entity; use SkillDisplay\PHPToolKit\Configuration\Settings; -class SkillSetProgress { +class SkillSetProgress +{ private array $data; private Settings $settings; diff --git a/tests/Unit/Api/SkillSetProgressTest.php b/tests/Unit/Api/SkillSetProgressTest.php index f35a749..b833636 100644 --- a/tests/Unit/Api/SkillSetProgressTest.php +++ b/tests/Unit/Api/SkillSetProgressTest.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\SkillSetProgress; @@ -73,12 +74,11 @@ class SkillSetProgressTest extends TestCase return (string) $request->getUri() === 'https://example.com/api/v1/skillset/10/progress' && $request->getHeader('x-api-key') === ['none'] && $request->getHeader('Content-Type') === ['application/json'] - && $request->getMethod() === 'GET' - ; + && $request->getMethod() === 'GET'; }))->willReturn($response->reveal()); $response->getStatusCode()->willReturn(200); - $response->getBody()->willReturn('{"tier3":44.44444444444444,"tier2":40.74074074074074,"tier1":0,"tier4":0}'); + $response->getBody()->willReturn(Utils::streamFor('{"tier3":44.44444444444444,"tier2":40.74074074074074,"tier1":0,"tier4":0}')); $progress = new SkillSetProgress( $settings->reveal(), @@ -145,6 +145,4 @@ class SkillSetProgressTest extends TestCase ], ]; } - - } diff --git a/tests/Unit/Entity/SkillSetProgressTest.php b/tests/Unit/Entity/SkillSetProgressTest.php index 8f46314..3a1cfca 100644 --- a/tests/Unit/Entity/SkillSetProgressTest.php +++ b/tests/Unit/Entity/SkillSetProgressTest.php @@ -84,5 +84,4 @@ class SkillSetProgressTest extends TestCase $progress = SkillSetProgress::createFromJson('{"tier4": 0}', $settings->reveal()); static::assertSame(0.0, $progress->getTier4()); } - }