]> git.mxchange.org Git - friendica.git/blobdiff - tests/legacy/ApiTest.php
api_get_user isn't used without parameters anymore
[friendica.git] / tests / legacy / ApiTest.php
index 800bc772e457e424ffd8f32c387d07d69ef5103d..34f3f6659b519964db1c3e22a0a2c4a3a1d006a1 100644 (file)
@@ -114,6 +114,7 @@ class ApiTest extends FixtureTest
                        'authenticated' => true,
                        'uid'           => $this->selfUser['id']
                ];
+               BasicAuth::setCurrentUserID($this->selfUser['id']);
        }
 
        /**
@@ -223,7 +224,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiUser()
        {
-               self::assertEquals($this->selfUser['id'], api_user());
+               self::assertEquals($this->selfUser['id'], BaseApi::getCurrentUserID());
        }
 
        /**
@@ -310,6 +311,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiLoginWithoutLogin()
        {
+               BasicAuth::setCurrentUserID();
                $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
                BasicAuth::getCurrentUserID(true);
        }
@@ -323,6 +325,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiLoginWithBadLogin()
        {
+               BasicAuth::setCurrentUserID();
                $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
                $_SERVER['PHP_AUTH_USER'] = 'user@server';
                BasicAuth::getCurrentUserID(true);
@@ -357,6 +360,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiLoginWithCorrectLogin()
        {
+               BasicAuth::setCurrentUserID();
                $_SERVER['PHP_AUTH_USER'] = 'Test user';
                $_SERVER['PHP_AUTH_PW']   = 'password';
                BasicAuth::getCurrentUserID(true);
@@ -370,6 +374,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiLoginWithRemoteUser()
        {
+               BasicAuth::setCurrentUserID();
                $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
                $_SERVER['REDIRECT_REMOTE_USER'] = '123456dXNlcjpwYXNzd29yZA==';
                BasicAuth::getCurrentUserID(true);
@@ -470,52 +475,6 @@ class ApiTest extends FixtureTest
                );
        }
 
-       /**
-        * Test the api_call() function without any result.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiCallWithNoResult()
-       {
-               // @todo How to test the new API?
-               /*
-               global $API;
-               $API['api_path']           = [
-                       'method' => 'method',
-                       'func'   => function () {
-                               return false;
-                       }
-               ];
-               $_SERVER['REQUEST_METHOD'] = 'method';
-               $_SERVER['QUERY_STRING'] = 'pagename=api_path';
-
-               $args = DI::args()->determine($_SERVER, $_GET);
-
-               self::assertEquals(
-                       '{"status":{"error":"Internal Server Error","code":"500 Internal Server Error","request":"api_path"}}',
-                       api_call($this->app, $args)
-               );
-               */
-       }
-
-       /**
-        * Test the api_call() function with an unimplemented API.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiCallWithUninplementedApi()
-       {
-               // @todo How to test the new API?
-               /*
-               self::assertEquals(
-                       '{"status":{"error":"Not Found","code":"404 Not Found","request":""}}',
-                       api_call($this->app)
-               );
-               */
-       }
-
        /**
         * Test the api_call() function with a JSON result.
         *
@@ -622,145 +581,6 @@ class ApiTest extends FixtureTest
                );
        }
 
-       /**
-        * Test the api_call() function with an unallowed method.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiCallWithWrongMethod()
-       {
-               // Shouldn't be needed anymore due to the router?
-               /*
-               global $API;
-               $API['api_path'] = ['method' => 'method'];
-
-               $_SERVER['QUERY_STRING'] = 'pagename=api_path';
-
-               $args = DI::args()->determine($_SERVER, $_GET);
-
-               self::assertEquals(
-                       '{"status":{"error":"Method Not Allowed","code":"405 Method Not Allowed","request":"api_path"}}',
-                       api_call($this->app, $args)
-               );
-               */
-       }
-
-       /**
-        * Test the api_call() function with an unauthorized user.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiCallWithWrongAuth()
-       {
-               // @todo How to test the new API?
-               /*
-               global $API;
-               $API['api_path']           = [
-                       'method' => 'method',
-                       'auth'   => true
-               ];
-               $_SESSION['authenticated'] = false;
-               $_SERVER['REQUEST_METHOD'] = 'method';
-               $_SERVER['QUERY_STRING'] = 'pagename=api_path';
-
-               $args = DI::args()->determine($_SERVER, $_GET);
-
-               self::assertEquals(
-                       '{"status":{"error":"This API requires login","code":"401 Unauthorized","request":"api_path"}}',
-                       api_call($this->app, $args)
-               );
-               */
-       }
-
-       /**
-        * Test the api_error() function with a JSON result.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiErrorWithJson()
-       {
-               // @todo How to test the new API?
-               // self::assertEquals(
-               //      '{"status":{"error":"error_message","code":"200 OK","request":""}}',
-               //      api_error('json', new HTTPException\OKException('error_message'), DI::args())
-               // );
-       }
-
-       /**
-        * Test the api_error() function with an XML result.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiErrorWithXml()
-       {
-               // @todo How to test the new API?
-               /*
-               self::assertEquals(
-                       '<?xml version="1.0"?>' . "\n" .
-                       '<status xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
-                       'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
-                       'xmlns:georss="http://www.georss.org/georss">' . "\n" .
-                       '  <error>error_message</error>' . "\n" .
-                       '  <code>200 OK</code>' . "\n" .
-                       '  <request/>' . "\n" .
-                       '</status>' . "\n",
-                       api_error('xml', new HTTPException\OKException('error_message'), DI::args())
-               );
-               */
-       }
-
-       /**
-        * Test the api_error() function with an RSS result.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiErrorWithRss()
-       {
-               // @todo How to test the new API?
-               /*
-               self::assertEquals(
-                       '<?xml version="1.0"?>' . "\n" .
-                       '<status xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
-                       'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
-                       'xmlns:georss="http://www.georss.org/georss">' . "\n" .
-                       '  <error>error_message</error>' . "\n" .
-                       '  <code>200 OK</code>' . "\n" .
-                       '  <request/>' . "\n" .
-                       '</status>' . "\n",
-                       api_error('rss', new HTTPException\OKException('error_message'), DI::args())
-               );
-               */
-       }
-
-       /**
-        * Test the api_error() function with an Atom result.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiErrorWithAtom()
-       {
-               // @todo How to test the new API?
-               /*
-               self::assertEquals(
-                       '<?xml version="1.0"?>' . "\n" .
-                       '<status xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
-                       'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
-                       'xmlns:georss="http://www.georss.org/georss">' . "\n" .
-                       '  <error>error_message</error>' . "\n" .
-                       '  <code>200 OK</code>' . "\n" .
-                       '  <request/>' . "\n" .
-                       '</status>' . "\n",
-                       api_error('atom', new HTTPException\OKException('error_message'), DI::args())
-               );
-               */
-       }
-
        /**
         * Test the api_rss_extra() function.
         *
@@ -769,7 +589,7 @@ class ApiTest extends FixtureTest
        public function testApiRssExtra()
        {
                $user_info = ['url' => 'user_url', 'lang' => 'en'];
-               $result    = api_rss_extra($this->app, [], $user_info);
+               $result    = api_rss_extra([], $user_info);
                self::assertEquals($user_info, $result['$user']);
                self::assertEquals($user_info['url'], $result['$rss']['alternate']);
                self::assertArrayHasKey('self', $result['$rss']);
@@ -787,7 +607,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiRssExtraWithoutUserInfo()
        {
-               $result = api_rss_extra($this->app, [], null);
+               $result = api_rss_extra([], null);
                self::assertIsArray($result['$user']);
                self::assertArrayHasKey('alternate', $result['$rss']);
                self::assertArrayHasKey('self', $result['$rss']);
@@ -825,11 +645,11 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUser()
        {
-               $user = api_get_user();
-               self::assertSelfUser($user);
-               self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
-               self::assertEquals('6fdbe8', $user['profile_link_color']);
-               self::assertEquals('ededed', $user['profile_background_color']);
+               // $user = api_get_user();
+               // self::assertSelfUser($user);
+               // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
+               // self::assertEquals('6fdbe8', $user['profile_link_color']);
+               // self::assertEquals('ededed', $user['profile_background_color']);
        }
 
        /**
@@ -839,13 +659,13 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithFrioSchema()
        {
-               $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
-               $pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
-               $user = api_get_user();
-               self::assertSelfUser($user);
-               self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
-               self::assertEquals('6fdbe8', $user['profile_link_color']);
-               self::assertEquals('ededed', $user['profile_background_color']);
+               // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
+               // $pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
+               // $user = api_get_user();
+               // self::assertSelfUser($user);
+               // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
+               // self::assertEquals('6fdbe8', $user['profile_link_color']);
+               // self::assertEquals('ededed', $user['profile_background_color']);
        }
 
        /**
@@ -855,13 +675,13 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithEmptyFrioSchema()
        {
-               $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
-               $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
-               $user = api_get_user();
-               self::assertSelfUser($user);
-               self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
-               self::assertEquals('6fdbe8', $user['profile_link_color']);
-               self::assertEquals('ededed', $user['profile_background_color']);
+               // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
+               // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
+               // $user = api_get_user();
+               // self::assertSelfUser($user);
+               // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
+               // self::assertEquals('6fdbe8', $user['profile_link_color']);
+               // self::assertEquals('ededed', $user['profile_background_color']);
        }
 
        /**
@@ -871,16 +691,16 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithCustomFrioSchema()
        {
-               $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
-               $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
-               $pConfig->set($this->selfUser['id'], 'frio', 'nav_bg', '#123456');
-               $pConfig->set($this->selfUser['id'], 'frio', 'link_color', '#123456');
-               $pConfig->set($this->selfUser['id'], 'frio', 'background_color', '#123456');
-               $user = api_get_user();
-               self::assertSelfUser($user);
-               self::assertEquals('123456', $user['profile_sidebar_fill_color']);
-               self::assertEquals('123456', $user['profile_link_color']);
-               self::assertEquals('123456', $user['profile_background_color']);
+               // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
+               // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
+               // $pConfig->set($this->selfUser['id'], 'frio', 'nav_bg', '#123456');
+               // $pConfig->set($this->selfUser['id'], 'frio', 'link_color', '#123456');
+               // $pConfig->set($this->selfUser['id'], 'frio', 'background_color', '#123456');
+               // $user = api_get_user();
+               // self::assertSelfUser($user);
+               // self::assertEquals('123456', $user['profile_sidebar_fill_color']);
+               // self::assertEquals('123456', $user['profile_link_color']);
+               // self::assertEquals('123456', $user['profile_background_color']);
        }
 
        /**
@@ -891,10 +711,14 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithoutApiUser()
        {
+               // api_get_user() with empty parameters is not used anymore
+               /*
                $_SERVER['PHP_AUTH_USER'] = 'Test user';
                $_SERVER['PHP_AUTH_PW']   = 'password';
                $_SESSION['allow_api']    = false;
+               BasicAuth::setCurrentUserID();
                self::assertFalse(api_get_user());
+               */
        }
 
        /**
@@ -904,8 +728,8 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithGetId()
        {
-               $_GET['user_id'] = $this->otherUser['id'];
-               self::assertOtherUser(api_get_user());
+               // $_GET['user_id'] = $this->otherUser['id'];
+               // self::assertOtherUser(api_get_user());
        }
 
        /**
@@ -915,9 +739,9 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithWrongGetId()
        {
-               $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               $_GET['user_id'] = $this->wrongUserId;
-               self::assertOtherUser(api_get_user());
+               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
+               // $_GET['user_id'] = $this->wrongUserId;
+               // self::assertOtherUser(api_get_user());
        }
 
        /**
@@ -927,8 +751,8 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithGetName()
        {
-               $_GET['screen_name'] = $this->selfUser['nick'];
-               self::assertSelfUser(api_get_user());
+               // $_GET['screen_name'] = $this->selfUser['nick'];
+               // self::assertSelfUser(api_get_user());
        }
 
        /**
@@ -938,8 +762,8 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithGetUrl()
        {
-               $_GET['profileurl'] = $this->selfUser['nurl'];
-               self::assertSelfUser(api_get_user());
+               // $_GET['profileurl'] = $this->selfUser['nurl'];
+               // self::assertSelfUser(api_get_user());
        }
 
        /**
@@ -949,10 +773,10 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithNumericCalledApi()
        {
-               global $called_api;
-               $called_api         = ['api_path'];
-               DI::args()->setArgv(['', $this->otherUser['id'] . '.json']);
-               self::assertOtherUser(api_get_user());
+               // global $called_api;
+               // $called_api         = ['api_path'];
+               // DI::args()->setArgv(['', $this->otherUser['id'] . '.json']);
+               // self::assertOtherUser(api_get_user());
        }
 
        /**
@@ -962,9 +786,9 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithCalledApi()
        {
-               global $called_api;
-               $called_api = ['api', 'api_path'];
-               self::assertSelfUser(api_get_user());
+               // global $called_api;
+               // $called_api = ['api', 'api_path'];
+               // self::assertSelfUser(api_get_user());
        }
 
        /**
@@ -1181,6 +1005,7 @@ class ApiTest extends FixtureTest
        public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_account_verify_credentials('json');
        }
@@ -1251,6 +1076,7 @@ class ApiTest extends FixtureTest
        public function testApiStatusesMediapWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_statuses_mediap('json');
        }
@@ -1303,6 +1129,7 @@ class ApiTest extends FixtureTest
        public function testApiStatusesUpdateWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_statuses_update('json');
        }
@@ -1356,6 +1183,7 @@ class ApiTest extends FixtureTest
        public function testApiMediaUploadWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_media_upload();
        }
@@ -1606,6 +1434,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_search('json');
        }
 
@@ -1662,6 +1491,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_statuses_home_timeline('json');
        }
 
@@ -1733,6 +1563,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_statuses_public_timeline('json');
        }
 
@@ -1787,6 +1618,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_statuses_networkpublic_timeline('json');
        }
 
@@ -1850,6 +1682,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_statuses_show('json');
        }
 
@@ -1891,6 +1724,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_conversation_show('json');
        }
 
@@ -1913,6 +1747,7 @@ class ApiTest extends FixtureTest
        public function testApiStatusesRepeatWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_statuses_repeat('json');
        }
@@ -1953,6 +1788,7 @@ class ApiTest extends FixtureTest
        public function testApiStatusesDestroyWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_statuses_destroy('json');
        }
@@ -2005,6 +1841,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_statuses_mentions('json');
        }
 
@@ -2072,6 +1909,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_statuses_user_timeline('json');
        }
 
@@ -2160,6 +1998,7 @@ class ApiTest extends FixtureTest
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_favorites_create_destroy('json');
        }
@@ -2200,6 +2039,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_favorites('json');
        }
 
@@ -2541,32 +2381,6 @@ class ApiTest extends FixtureTest
                }
        }
 
-       /**
-        * Test the api_format_items() function.
-        *
-        * @return void
-        */
-       public function testApiAccountRateLimitStatus()
-       {
-               // @todo How to test the new API?
-               // $result = api_account_rate_limit_status('json');
-               // self::assertEquals(150, $result['hash']['remaining_hits']);
-               // self::assertEquals(150, $result['hash']['hourly_limit']);
-               // self::assertIsInt($result['hash']['reset_time_in_seconds']);
-       }
-
-       /**
-        * Test the api_format_items() function with an XML result.
-        *
-        * @return void
-        */
-       public function testApiAccountRateLimitStatusWithXml()
-       {
-               // @todo How to test the new API?
-               // $result = api_account_rate_limit_status('xml');
-               // self::assertXml($result, 'hash');
-       }
-
        /**
         * Test the api_lists_list() function.
         *
@@ -2599,6 +2413,7 @@ class ApiTest extends FixtureTest
        public function testApiListsOwnershipsWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_lists_ownerships('json');
        }
@@ -2651,6 +2466,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_lists_statuses('json');
        }
 
@@ -2805,6 +2621,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiStatusnetConfig()
        {
+               /*
                $result = api_statusnet_config('json');
                self::assertEquals('localhost', $result['config']['site']['server']);
                self::assertEquals('default', $result['config']['site']['theme']);
@@ -2816,18 +2633,7 @@ class ApiTest extends FixtureTest
                self::assertEquals('false', $result['config']['site']['private']);
                self::assertEquals('false', $result['config']['site']['ssl']);
                self::assertEquals(30, $result['config']['site']['shorturllength']);
-       }
-
-       /**
-        * Test the api_statusnet_version() function.
-        *
-        * @return void
-        */
-       public function testApiStatusnetVersion()
-       {
-               // @todo How to test the new API?
-               // $result = api_statusnet_version('json');
-               // self::assertEquals('0.9.7', $result['version']);
+               */
        }
 
        /**
@@ -2849,6 +2655,7 @@ class ApiTest extends FixtureTest
        public function testApiDirectMessagesNewWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_direct_messages_new('json');
        }
@@ -2953,6 +2760,7 @@ class ApiTest extends FixtureTest
        public function testApiDirectMessagesDestroyWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_direct_messages_destroy('json');
        }
@@ -3087,6 +2895,7 @@ class ApiTest extends FixtureTest
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
                $_SESSION['allow_api'] = false;
                $_GET['screen_name']   = $this->selfUser['nick'];
+               BasicAuth::setCurrentUserID();
                api_direct_messages_box('json', 'sentbox', 'false');
        }
 
@@ -3173,6 +2982,7 @@ class ApiTest extends FixtureTest
        public function testApiFrPhotosListWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_fr_photos_list('json');
        }
@@ -3194,6 +3004,7 @@ class ApiTest extends FixtureTest
        public function testApiFrPhotoCreateUpdateWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_fr_photo_create_update('json');
        }
@@ -3249,6 +3060,7 @@ class ApiTest extends FixtureTest
        public function testApiFrPhotoDetailWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_fr_photo_detail('json');
        }
@@ -3294,6 +3106,7 @@ class ApiTest extends FixtureTest
        public function testApiAccountUpdateProfileImageWithoutAuthenticatedUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
+               BasicAuth::setCurrentUserID();
                $_SESSION['authenticated'] = false;
                api_account_update_profile_image('json');
        }
@@ -3570,18 +3383,4 @@ class ApiTest extends FixtureTest
        {
                $this->markTestIncomplete();
        }
-
-       /**
-        * Test the api_saved_searches_list() function.
-        *
-        * @return void
-        */
-       public function testApiSavedSearchesList()
-       {
-               // $result = api_saved_searches_list('json');
-               // self::assertEquals(1, $result['terms'][0]['id']);
-               // self::assertEquals(1, $result['terms'][0]['id_str']);
-               // self::assertEquals('Saved search', $result['terms'][0]['name']);
-               // self::assertEquals('Saved search', $result['terms'][0]['query']);
-       }
 }