Reorder methods

This commit is contained in:
ErickSkrauch
2019-04-07 22:46:30 +02:00
parent 36cab232b6
commit c9eed8e290
2 changed files with 57 additions and 57 deletions

View File

@@ -231,17 +231,6 @@ class ApiTest extends TestCase {
$this->assertTrue($result['mockusername']->isDemo());
}
public function testPlayernamesToUuidsInvalidArgumentException() {
$names = [];
for ($i = 0; $i < 101; $i++) {
$names[] = base64_encode(random_bytes(4));
}
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('You cannot request more than 100 names per request');
$this->api->playernamesToUuids($names);
}
public function testUsernameToTextures() {
$this->mockHandler->append($this->createResponse(200, [
'id' => '86f6e3695b764412a29820cac1d4d0d6',
@@ -262,6 +251,34 @@ class ApiTest extends TestCase {
$this->assertStringStartsWith('https://sessionserver.mojang.com/session/minecraft/profile/86f6e3695b764412a29820cac1d4d0d6', (string)$request2->getUri());
}
public function testUploadSkinNotSlim() {
$this->mockHandler->append(new Response(200));
$this->api->uploadSkin('mocked access token', '86f6e3695b764412a29820cac1d4d0d6', 'skin contents', false);
/** @var \Psr\Http\Message\RequestInterface $request */
$request = $this->history[0]['request'];
$this->assertSame('Bearer mocked access token', $request->getHeaderLine('Authorization'));
$this->assertStringNotContainsString('slim', $request->getBody()->getContents());
}
public function testUploadSkinSlim() {
$this->mockHandler->append(new Response(200));
$this->api->uploadSkin('mocked access token', '86f6e3695b764412a29820cac1d4d0d6', 'skin contents', true);
/** @var \Psr\Http\Message\RequestInterface $request */
$request = $this->history[0]['request'];
$this->assertStringContainsString('slim', $request->getBody()->getContents());
}
public function testPlayernamesToUuidsInvalidArgumentException() {
$names = [];
for ($i = 0; $i < 101; $i++) {
$names[] = base64_encode(random_bytes(4));
}
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('You cannot request more than 100 names per request');
$this->api->playernamesToUuids($names);
}
public function testAuthenticate() {
$this->mockHandler->append($this->createResponse(200, [
'accessToken' => 'access token value',
@@ -355,23 +372,6 @@ class ApiTest extends TestCase {
$this->assertFalse($this->api->validate('mocked access token'));
}
public function testUploadSkinNotSlim() {
$this->mockHandler->append(new Response(200));
$this->api->uploadSkin('mocked access token', '86f6e3695b764412a29820cac1d4d0d6', 'skin contents', false);
/** @var \Psr\Http\Message\RequestInterface $request */
$request = $this->history[0]['request'];
$this->assertSame('Bearer mocked access token', $request->getHeaderLine('Authorization'));
$this->assertStringNotContainsString('slim', $request->getBody()->getContents());
}
public function testUploadSkinSlim() {
$this->mockHandler->append(new Response(200));
$this->api->uploadSkin('mocked access token', '86f6e3695b764412a29820cac1d4d0d6', 'skin contents', true);
/** @var \Psr\Http\Message\RequestInterface $request */
$request = $this->history[0]['request'];
$this->assertStringContainsString('slim', $request->getBody()->getContents());
}
public function testJoinServer() {
$this->mockHandler->append(new Response(200));
$this->api->joinServer('mocked access token', '86f6e3695b764412a29820cac1d4d0d6', 'ad72fe1efe364e6eb78c644a9fba1d30');