]> git.mxchange.org Git - friendica.git/blob - tests/src/Module/Api/Mastodon/Accounts/VerifyCredentialsTest.php
Merge pull request #11069 from nupplaphil/feat/reenable_tests
[friendica.git] / tests / src / Module / Api / Mastodon / Accounts / VerifyCredentialsTest.php
1 <?php
2
3 namespace Friendica\Test\src\Module\Api\Mastodon\Accounts;
4
5 use Friendica\App\Router;
6 use Friendica\DI;
7 use Friendica\Module\Api\Mastodon\Accounts\VerifyCredentials;
8 use Friendica\Test\src\Module\Api\ApiTest;
9
10 class VerifyCredentialsTest extends ApiTest
11 {
12         /**
13          * Test the api_account_verify_credentials() function.
14          *
15          * @return void
16          */
17         public function testApiAccountVerifyCredentials()
18         {
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();
21
22                 $body = (string)$response->getBody();
23
24                 self::assertJson($body);
25
26                 $json = json_decode($body);
27
28                 self::assertEquals(48, $json->id);
29                 self::assertIsArray($json->emojis);
30                 self::assertIsArray($json->fields);
31         }
32
33         /**
34          * Test the api_account_verify_credentials() function without an authenticated user.
35          *
36          * @return void
37          */
38         public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
39         {
40                 self::markTestIncomplete('Needs dynamic BasicAuth first');
41
42                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
43                 // BasicAuth::setCurrentUserID();
44                 // $_SESSION['authenticated'] = false;
45                 // api_account_verify_credentials('json');
46         }
47 }