test changes

This commit is contained in:
julianzangl 2023-07-06 15:10:44 +02:00
parent f28d2af8e0
commit 4af9c1c656
4 changed files with 6 additions and 8 deletions

View file

@ -25,7 +25,8 @@ namespace SkillDisplay\PHPToolKit\Entity;
use SkillDisplay\PHPToolKit\Configuration\Settings; use SkillDisplay\PHPToolKit\Configuration\Settings;
class SkillSetProgress { class SkillSetProgress
{
private array $data; private array $data;
private Settings $settings; private Settings $settings;

View file

@ -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\SkillSetProgress; 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' return (string) $request->getUri() === 'https://example.com/api/v1/skillset/10/progress'
&& $request->getHeader('x-api-key') === ['none'] && $request->getHeader('x-api-key') === ['none']
&& $request->getHeader('Content-Type') === ['application/json'] && $request->getHeader('Content-Type') === ['application/json']
&& $request->getMethod() === 'GET' && $request->getMethod() === 'GET';
;
}))->willReturn($response->reveal()); }))->willReturn($response->reveal());
$response->getStatusCode()->willReturn(200); $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( $progress = new SkillSetProgress(
$settings->reveal(), $settings->reveal(),
@ -145,6 +145,4 @@ class SkillSetProgressTest extends TestCase
], ],
]; ];
} }
} }

View file

@ -84,5 +84,4 @@ class SkillSetProgressTest extends TestCase
$progress = SkillSetProgress::createFromJson('{"tier4": 0}', $settings->reveal()); $progress = SkillSetProgress::createFromJson('{"tier4": 0}', $settings->reveal());
static::assertSame(0.0, $progress->getTier4()); static::assertSame(0.0, $progress->getTier4());
} }
} }