3 namespace Friendica\Test\src\Module\Api\Mastodon\Accounts;
5 use Friendica\App\Router;
7 use Friendica\Module\Api\Mastodon\Accounts\VerifyCredentials;
8 use Friendica\Test\src\Module\Api\ApiTest;
10 class VerifyCredentialsTest extends ApiTest
13 * Test the api_account_verify_credentials() function.
17 public function testApiAccountVerifyCredentials()
19 $verifyCredentials = new VerifyCredentials(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
20 $response = $verifyCredentials->run();
22 $body = (string)$response->getBody();
24 self::assertJson($body);
26 $json = json_decode($body);
28 self::assertEquals(42, $json->id);
29 self::assertIsArray($json->emojis);
30 self::assertIsArray($json->fields);
34 * Test the api_account_verify_credentials() function without an authenticated user.
38 public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
40 self::markTestIncomplete('Needs dynamic BasicAuth first');
42 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
43 // BasicAuth::setCurrentUserID();
44 // $_SESSION['authenticated'] = false;
45 // api_account_verify_credentials('json');