mirror of
https://github.com/SkillDisplay/PHPToolKit.git
synced 2024-12-22 10:46:09 +01:00
test changes
This commit is contained in:
parent
f28d2af8e0
commit
4af9c1c656
4 changed files with 6 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -25,7 +25,8 @@ namespace SkillDisplay\PHPToolKit\Entity;
|
|||
|
||||
use SkillDisplay\PHPToolKit\Configuration\Settings;
|
||||
|
||||
class SkillSetProgress {
|
||||
class SkillSetProgress
|
||||
{
|
||||
private array $data;
|
||||
|
||||
private Settings $settings;
|
||||
|
|
|
@ -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
|
|||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -84,5 +84,4 @@ class SkillSetProgressTest extends TestCase
|
|||
$progress = SkillSetProgress::createFromJson('{"tier4": 0}', $settings->reveal());
|
||||
static::assertSame(0.0, $progress->getTier4());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue