]> 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 4ea5c784a61760457b91963cdedaa607d23e4a87..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());
        }
 
        /**
@@ -1114,7 +938,7 @@ class ApiTest extends FixtureTest
                        'xmlns:georss="http://www.georss.org/georss">' . "\n" .
                        '  <data>some_data</data>' . "\n" .
                        '</root_element>' . "\n",
-                       ApiResponse::createXML(['data' => ['some_data']], 'root_element')
+                       DI::apiResponse()->createXML(['data' => ['some_data']], 'root_element')
                );
        }
 
@@ -1130,7 +954,7 @@ class ApiTest extends FixtureTest
                        '<ok>' . "\n" .
                        '  <data>some_data</data>' . "\n" .
                        '</ok>' . "\n",
-                       ApiResponse::createXML(['data' => ['some_data']], 'ok')
+                       DI::apiResponse()->createXML(['data' => ['some_data']], 'ok')
                );
        }
 
@@ -1142,7 +966,7 @@ class ApiTest extends FixtureTest
        public function testApiFormatData()
        {
                $data = ['some_data'];
-               self::assertEquals($data, ApiResponse::formatData('root_element', 'json', $data));
+               self::assertEquals($data, DI::apiResponse()->formatData('root_element', 'json', $data));
        }
 
        /**
@@ -1159,7 +983,7 @@ class ApiTest extends FixtureTest
                        'xmlns:georss="http://www.georss.org/georss">' . "\n" .
                        '  <data>some_data</data>' . "\n" .
                        '</root_element>' . "\n",
-                       ApiResponse::formatData('root_element', 'xml', ['data' => ['some_data']])
+                       DI::apiResponse()->formatData('root_element', 'xml', ['data' => ['some_data']])
                );
        }
 
@@ -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,56 +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_help_test() function.
-        *
-        * @return void
-        */
-       public function testApiHelpTest()
-       {
-               // @todo How to test the new API?
-               // $result = \Friendica\Module\Api\Friendica\Help\Test::rawcontent(['extension' => 'json']);
-               // self::assertEquals(['ok' => 'ok'], $result);
-       }
-
-       /**
-        * Test the api_help_test() function with an XML result.
-        *
-        * @return void
-        */
-       public function testApiHelpTestWithXml()
-       {
-               // @todo How to test the new API?
-               // $result = api_help_test('xml');
-               // self::assertXml($result, 'ok');
-       }
-
        /**
         * Test the api_lists_list() function.
         *
@@ -2623,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');
        }
@@ -2675,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');
        }
 
@@ -2829,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']);
@@ -2840,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']);
+               */
        }
 
        /**
@@ -2873,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');
        }
@@ -2977,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');
        }
@@ -3111,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');
        }
 
@@ -3178,97 +2963,6 @@ class ApiTest extends FixtureTest
                $this->markTestIncomplete('exit() kills phpunit as well');
        }
 
-       /**
-        * Test the api_fr_photoalbum_delete() function.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoalbumDelete()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               // api_fr_photoalbum_delete('json');
-       }
-
-       /**
-        * Test the api_fr_photoalbum_delete() function with an album name.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoalbumDeleteWithAlbum()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               // $_REQUEST['album'] = 'album_name';
-               // api_fr_photoalbum_delete('json');
-       }
-
-       /**
-        * Test the api_fr_photoalbum_delete() function with an album name.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoalbumDeleteWithValidAlbum()
-       {
-               $this->markTestIncomplete('We need to add a dataset for this.');
-       }
-
-       /**
-        * Test the api_fr_photoalbum_delete() function.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoalbumUpdate()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               // api_fr_photoalbum_update('json');
-       }
-
-       /**
-        * Test the api_fr_photoalbum_delete() function with an album name.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoalbumUpdateWithAlbum()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               // $_REQUEST['album'] = 'album_name';
-               // api_fr_photoalbum_update('json');
-       }
-
-       /**
-        * Test the api_fr_photoalbum_delete() function with an album name.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoalbumUpdateWithAlbumAndNewAlbum()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               // $_REQUEST['album']     = 'album_name';
-               // $_REQUEST['album_new'] = 'album_name';
-               // api_fr_photoalbum_update('json');
-       }
-
-       /**
-        * Test the api_fr_photoalbum_update() function without an authenticated user.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoalbumUpdateWithoutAuthenticatedUser()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
-               // $_SESSION['authenticated'] = false;
-               // api_fr_photoalbum_update('json');
-       }
-
-       /**
-        * Test the api_fr_photoalbum_delete() function with an album name.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoalbumUpdateWithValidAlbum()
-       {
-               $this->markTestIncomplete('We need to add a dataset for this.');
-       }
-
        /**
         * Test the api_fr_photos_list() function.
         *
@@ -3288,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');
        }
@@ -3309,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');
        }
@@ -3345,51 +3041,6 @@ class ApiTest extends FixtureTest
                $this->markTestIncomplete();
        }
 
-       /**
-        * Test the api_fr_photo_delete() function.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoDelete()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               // api_fr_photo_delete('json');
-       }
-
-       /**
-        * Test the api_fr_photo_delete() function without an authenticated user.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoDeleteWithoutAuthenticatedUser()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
-               // $_SESSION['authenticated'] = false;
-               // api_fr_photo_delete('json');
-       }
-
-       /**
-        * Test the api_fr_photo_delete() function with a photo ID.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoDeleteWithPhotoId()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               // $_REQUEST['photo_id'] = 1;
-               // api_fr_photo_delete('json');
-       }
-
-       /**
-        * Test the api_fr_photo_delete() function with a correct photo ID.
-        *
-        * @return void
-        */
-       public function testApiFrPhotoDeleteWithCorrectPhotoId()
-       {
-               $this->markTestIncomplete('We need to create a dataset for this.');
-       }
-
        /**
         * Test the api_fr_photo_detail() function.
         *
@@ -3409,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');
        }
@@ -3454,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');
        }
@@ -3701,77 +3354,6 @@ class ApiTest extends FixtureTest
                $this->markTestIncomplete();
        }
 
-       /**
-        * Test the api_friendica_notification() function.
-        *
-        * @return void
-        */
-       public function testApiFriendicaNotification()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               // api_friendica_notification('json');
-       }
-
-       /**
-        * Test the api_friendica_notification() function without an authenticated user.
-        *
-        * @return void
-        */
-       public function testApiFriendicaNotificationWithoutAuthenticatedUser()
-       {
-               // $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
-               // $_SESSION['authenticated'] = false;
-               // api_friendica_notification('json');
-       }
-
-       /**
-        * Test the api_friendica_notification() function with empty result
-        *
-        * @return void
-        */
-       public function testApiFriendicaNotificationWithEmptyResult()
-       {
-               // DI::args()->setArgv(['api', 'friendica', 'notification']);
-               // $_SESSION['uid'] = 41;
-               // $result          = api_friendica_notification('json');
-               // self::assertEquals(['note' => false], $result);
-       }
-
-       /**
-        * Test the api_friendica_notification() function with an XML result.
-        *
-        * @return void
-        */
-       public function testApiFriendicaNotificationWithXmlResult()
-       {
-               /*
-               DI::args()->setArgv(['api', 'friendica', 'notification']);
-               $result  = api_friendica_notification('xml');
-               $date = DateTimeFormat::local('2020-01-01 12:12:02');
-               $dateRel = Temporal::getRelativeDate('2020-01-01 07:12:02');
-
-               $assertXml=<<<XML
-<?xml version="1.0"?>
-<notes>
-  <note date="$date" date_rel="$dateRel" id="1" iid="4" link="http://localhost/notification/1" msg="A test reply from an item" msg_cache="A test reply from an item" msg_html="A test reply from an item" msg_plain="A test reply from an item" name="Reply to" name_cache="Reply to" otype="item" parent="" photo="http://localhost/" seen="false" timestamp="1577880722" type="8" uid="42" url="http://localhost/display/1" verb="http://activitystrea.ms/schema/1.0/post"/>
-</notes>
-XML;
-               self::assertXmlStringEqualsXmlString($assertXml, $result);
-               */
-       }
-
-       /**
-        * Test the api_friendica_notification() function with an JSON result.
-        *
-        * @return void
-        */
-       public function testApiFriendicaNotificationWithJsonResult()
-       {
-               // DI::args()->setArgv(['api', 'friendica', 'notification']);
-               // $result = json_encode(api_friendica_notification('json'));
-               // self::assertJson($result);
-       }
-
        /**
         * Test the api_friendica_notification_seen() function.
         *
@@ -3801,18 +3383,4 @@ XML;
        {
                $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']);
-       }
 }