]> 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 2e6d49ebf2320622d52617e48edc22553709775e..34f3f6659b519964db1c3e22a0a2c4a3a1d006a1 100644 (file)
@@ -6,12 +6,17 @@
 namespace Friendica\Test\legacy;
 
 use Friendica\App;
-use Friendica\Core\Config\IConfig;
-use Friendica\Core\PConfig\IPConfig;
+use Friendica\Core\Config\Capability\IManageConfigValues;
+use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
 use Friendica\Core\Protocol;
 use Friendica\DI;
+use Friendica\Module\Api\ApiResponse;
+use Friendica\Module\BaseApi;
 use Friendica\Network\HTTPException;
+use Friendica\Security\BasicAuth;
 use Friendica\Test\FixtureTest;
+use Friendica\Util\Arrays;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Temporal;
 use Monolog\Handler\TestHandler;
 
@@ -44,7 +49,7 @@ class ApiTest extends FixtureTest
        /** @var App */
        protected $app;
 
-       /** @var IConfig */
+       /** @var IManageConfigValues */
        protected $config;
 
        /**
@@ -58,8 +63,8 @@ class ApiTest extends FixtureTest
 
                parent::setUp();
 
-               /** @var IConfig $config */
-               $this->config = $this->dice->create(IConfig::class);
+               /** @var IManageConfigValues $config */
+               $this->config = $this->dice->create(IManageConfigValues::class);
 
                $this->config->set('system', 'url', 'http://localhost');
                $this->config->set('system', 'hostname', 'localhost');
@@ -109,6 +114,7 @@ class ApiTest extends FixtureTest
                        'authenticated' => true,
                        'uid'           => $this->selfUser['id']
                ];
+               BasicAuth::setCurrentUserID($this->selfUser['id']);
        }
 
        /**
@@ -218,7 +224,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiUser()
        {
-               self::assertEquals($this->selfUser['id'], api_user());
+               self::assertEquals($this->selfUser['id'], BaseApi::getCurrentUserID());
        }
 
        /**
@@ -297,7 +303,7 @@ class ApiTest extends FixtureTest
        }
 
        /**
-        * Test the api_login() function without any login.
+        * Test the BasicAuth::getCurrentUserID() function without any login.
         *
         * @runInSeparateProcess
         * @preserveGlobalState disabled
@@ -305,12 +311,13 @@ class ApiTest extends FixtureTest
         */
        public function testApiLoginWithoutLogin()
        {
+               BasicAuth::setCurrentUserID();
                $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
-               api_login($this->app);
+               BasicAuth::getCurrentUserID(true);
        }
 
        /**
-        * Test the api_login() function with a bad login.
+        * Test the BasicAuth::getCurrentUserID() function with a bad login.
         *
         * @runInSeparateProcess
         * @preserveGlobalState disabled
@@ -318,13 +325,14 @@ class ApiTest extends FixtureTest
         */
        public function testApiLoginWithBadLogin()
        {
+               BasicAuth::setCurrentUserID();
                $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
                $_SERVER['PHP_AUTH_USER'] = 'user@server';
-               api_login($this->app);
+               BasicAuth::getCurrentUserID(true);
        }
 
        /**
-        * Test the api_login() function with oAuth.
+        * Test the BasicAuth::getCurrentUserID() function with oAuth.
         *
         * @return void
         */
@@ -334,7 +342,7 @@ class ApiTest extends FixtureTest
        }
 
        /**
-        * Test the api_login() function with authentication provided by an addon.
+        * Test the BasicAuth::getCurrentUserID() function with authentication provided by an addon.
         *
         * @return void
         */
@@ -344,7 +352,7 @@ class ApiTest extends FixtureTest
        }
 
        /**
-        * Test the api_login() function with a correct login.
+        * Test the BasicAuth::getCurrentUserID() function with a correct login.
         *
         * @runInSeparateProcess
         * @preserveGlobalState disabled
@@ -352,22 +360,24 @@ class ApiTest extends FixtureTest
         */
        public function testApiLoginWithCorrectLogin()
        {
+               BasicAuth::setCurrentUserID();
                $_SERVER['PHP_AUTH_USER'] = 'Test user';
                $_SERVER['PHP_AUTH_PW']   = 'password';
-               api_login($this->app);
+               BasicAuth::getCurrentUserID(true);
        }
 
        /**
-        * Test the api_login() function with a remote user.
+        * Test the BasicAuth::getCurrentUserID() function with a remote user.
         *
         * @runInSeparateProcess
         * @preserveGlobalState disabled
         */
        public function testApiLoginWithRemoteUser()
        {
+               BasicAuth::setCurrentUserID();
                $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
                $_SERVER['REDIRECT_REMOTE_USER'] = '123456dXNlcjpwYXNzd29yZA==';
-               api_login($this->app);
+               BasicAuth::getCurrentUserID(true);
        }
 
        /**
@@ -465,46 +475,6 @@ class ApiTest extends FixtureTest
                );
        }
 
-       /**
-        * Test the api_call() function without any result.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiCallWithNoResult()
-       {
-               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()
-       {
-               self::assertEquals(
-                       '{"status":{"error":"Not Found","code":"404 Not Found","request":""}}',
-                       api_call($this->app)
-               );
-       }
-
        /**
         * Test the api_call() function with a JSON result.
         *
@@ -611,129 +581,6 @@ class ApiTest extends FixtureTest
                );
        }
 
-       /**
-        * Test the api_call() function with an unallowed method.
-        *
-        * @runInSeparateProcess
-        * @preserveGlobalState disabled
-        */
-       public function testApiCallWithWrongMethod()
-       {
-               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()
-       {
-               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()
-       {
-               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()
-       {
-               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()
-       {
-               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()
-       {
-               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.
         *
@@ -742,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']);
@@ -760,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']);
@@ -798,11 +645,11 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUser()
        {
-               $user = api_get_user($this->app);
-               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']);
        }
 
        /**
@@ -812,13 +659,13 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithFrioSchema()
        {
-               $pConfig = $this->dice->create(IPConfig::class);
-               $pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
-               $user = api_get_user($this->app);
-               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']);
        }
 
        /**
@@ -828,13 +675,13 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithEmptyFrioSchema()
        {
-               $pConfig = $this->dice->create(IPConfig::class);
-               $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
-               $user = api_get_user($this->app);
-               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']);
        }
 
        /**
@@ -844,16 +691,16 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithCustomFrioSchema()
        {
-               $pConfig = $this->dice->create(IPConfig::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($this->app);
-               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']);
        }
 
        /**
@@ -864,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;
-               self::assertFalse(api_get_user($this->app));
+               BasicAuth::setCurrentUserID();
+               self::assertFalse(api_get_user());
+               */
        }
 
        /**
@@ -877,8 +728,8 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithGetId()
        {
-               $_GET['user_id'] = $this->otherUser['id'];
-               self::assertOtherUser(api_get_user($this->app));
+               // $_GET['user_id'] = $this->otherUser['id'];
+               // self::assertOtherUser(api_get_user());
        }
 
        /**
@@ -888,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->app));
+               // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
+               // $_GET['user_id'] = $this->wrongUserId;
+               // self::assertOtherUser(api_get_user());
        }
 
        /**
@@ -900,8 +751,8 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithGetName()
        {
-               $_GET['screen_name'] = $this->selfUser['nick'];
-               self::assertSelfUser(api_get_user($this->app));
+               // $_GET['screen_name'] = $this->selfUser['nick'];
+               // self::assertSelfUser(api_get_user());
        }
 
        /**
@@ -911,8 +762,8 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithGetUrl()
        {
-               $_GET['profileurl'] = $this->selfUser['nurl'];
-               self::assertSelfUser(api_get_user($this->app));
+               // $_GET['profileurl'] = $this->selfUser['nurl'];
+               // self::assertSelfUser(api_get_user());
        }
 
        /**
@@ -922,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($this->app));
+               // global $called_api;
+               // $called_api         = ['api_path'];
+               // DI::args()->setArgv(['', $this->otherUser['id'] . '.json']);
+               // self::assertOtherUser(api_get_user());
        }
 
        /**
@@ -935,9 +786,9 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithCalledApi()
        {
-               global $called_api;
-               $called_api = ['api', 'api_path'];
-               self::assertSelfUser(api_get_user($this->app));
+               // global $called_api;
+               // $called_api = ['api', 'api_path'];
+               // self::assertSelfUser(api_get_user());
        }
 
        /**
@@ -947,7 +798,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithCorrectUser()
        {
-               self::assertOtherUser(api_get_user($this->app, $this->otherUser['id']));
+               self::assertOtherUser(api_get_user($this->otherUser['id']));
        }
 
        /**
@@ -958,7 +809,7 @@ class ApiTest extends FixtureTest
        public function testApiGetUserWithWrongUser()
        {
                $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
-               self::assertOtherUser(api_get_user($this->app, $this->wrongUserId));
+               self::assertOtherUser(api_get_user($this->wrongUserId));
        }
 
        /**
@@ -968,7 +819,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiGetUserWithZeroUser()
        {
-               self::assertSelfUser(api_get_user($this->app, 0));
+               self::assertSelfUser(api_get_user(0));
        }
 
        /**
@@ -995,7 +846,7 @@ class ApiTest extends FixtureTest
        }
 
        /**
-        * Test the api_walk_recursive() function.
+        * Test the Arrays::walkRecursive() function.
         *
         * @return void
         */
@@ -1004,7 +855,7 @@ class ApiTest extends FixtureTest
                $array = ['item1'];
                self::assertEquals(
                        $array,
-                       api_walk_recursive(
+                       Arrays::walkRecursive(
                                $array,
                                function () {
                                        // Should we test this with a callback that actually does something?
@@ -1015,7 +866,7 @@ class ApiTest extends FixtureTest
        }
 
        /**
-        * Test the api_walk_recursive() function with an array.
+        * Test the Arrays::walkRecursive() function with an array.
         *
         * @return void
         */
@@ -1024,7 +875,7 @@ class ApiTest extends FixtureTest
                $array = [['item1'], ['item2']];
                self::assertEquals(
                        $array,
-                       api_walk_recursive(
+                       Arrays::walkRecursive(
                                $array,
                                function () {
                                        // Should we test this with a callback that actually does something?
@@ -1035,7 +886,7 @@ class ApiTest extends FixtureTest
        }
 
        /**
-        * Test the api_reformat_xml() function.
+        * Test the BaseApi::reformatXML() function.
         *
         * @return void
         */
@@ -1043,12 +894,12 @@ class ApiTest extends FixtureTest
        {
                $item = true;
                $key  = '';
-               self::assertTrue(api_reformat_xml($item, $key));
+               self::assertTrue(ApiResponse::reformatXML($item, $key));
                self::assertEquals('true', $item);
        }
 
        /**
-        * Test the api_reformat_xml() function with a statusnet_api key.
+        * Test the BaseApi::reformatXML() function with a statusnet_api key.
         *
         * @return void
         */
@@ -1056,12 +907,12 @@ class ApiTest extends FixtureTest
        {
                $item = '';
                $key  = 'statusnet_api';
-               self::assertTrue(api_reformat_xml($item, $key));
+               self::assertTrue(ApiResponse::reformatXML($item, $key));
                self::assertEquals('statusnet:api', $key);
        }
 
        /**
-        * Test the api_reformat_xml() function with a friendica_api key.
+        * Test the BaseApi::reformatXML() function with a friendica_api key.
         *
         * @return void
         */
@@ -1069,12 +920,12 @@ class ApiTest extends FixtureTest
        {
                $item = '';
                $key  = 'friendica_api';
-               self::assertTrue(api_reformat_xml($item, $key));
+               self::assertTrue(ApiResponse::reformatXML($item, $key));
                self::assertEquals('friendica:api', $key);
        }
 
        /**
-        * Test the api_create_xml() function.
+        * Test the BaseApi::createXML() function.
         *
         * @return void
         */
@@ -1087,12 +938,12 @@ class ApiTest extends FixtureTest
                        'xmlns:georss="http://www.georss.org/georss">' . "\n" .
                        '  <data>some_data</data>' . "\n" .
                        '</root_element>' . "\n",
-                       api_create_xml(['data' => ['some_data']], 'root_element')
+                       DI::apiResponse()->createXML(['data' => ['some_data']], 'root_element')
                );
        }
 
        /**
-        * Test the api_create_xml() function without any XML namespace.
+        * Test the BaseApi::createXML() function without any XML namespace.
         *
         * @return void
         */
@@ -1103,23 +954,23 @@ class ApiTest extends FixtureTest
                        '<ok>' . "\n" .
                        '  <data>some_data</data>' . "\n" .
                        '</ok>' . "\n",
-                       api_create_xml(['data' => ['some_data']], 'ok')
+                       DI::apiResponse()->createXML(['data' => ['some_data']], 'ok')
                );
        }
 
        /**
-        * Test the api_format_data() function.
+        * Test the BaseApi::formatData() function.
         *
         * @return void
         */
        public function testApiFormatData()
        {
                $data = ['some_data'];
-               self::assertEquals($data, api_format_data('root_element', 'json', $data));
+               self::assertEquals($data, DI::apiResponse()->formatData('root_element', 'json', $data));
        }
 
        /**
-        * Test the api_format_data() function with an XML result.
+        * Test the BaseApi::formatData() function with an XML result.
         *
         * @return void
         */
@@ -1132,7 +983,7 @@ class ApiTest extends FixtureTest
                        'xmlns:georss="http://www.georss.org/georss">' . "\n" .
                        '  <data>some_data</data>' . "\n" .
                        '</root_element>' . "\n",
-                       api_format_data('root_element', 'xml', ['data' => ['some_data']])
+                       DI::apiResponse()->formatData('root_element', 'xml', ['data' => ['some_data']])
                );
        }
 
@@ -1154,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');
        }
@@ -1224,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');
        }
@@ -1276,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');
        }
@@ -1329,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();
        }
@@ -1579,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');
        }
 
@@ -1635,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');
        }
 
@@ -1706,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');
        }
 
@@ -1760,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');
        }
 
@@ -1823,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');
        }
 
@@ -1864,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');
        }
 
@@ -1886,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');
        }
@@ -1926,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');
        }
@@ -1949,7 +1812,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiStatusesMentions()
        {
-               $this->app->setNickname($this->selfUser['nick']);
+               $this->app->setLoggedInUserNickname($this->selfUser['nick']);
                $_REQUEST['max_id'] = 10;
                $result             = api_statuses_mentions('json');
                self::assertEmpty($result['status']);
@@ -1978,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');
        }
 
@@ -2045,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');
        }
 
@@ -2133,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');
        }
@@ -2173,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');
        }
 
@@ -2261,28 +2128,28 @@ class ApiTest extends FixtureTest
                                'uri-id'  => 1,
                                // We need a long string to test that it is correctly cut
                                'body'    => 'perspiciatis impedit voluptatem quis molestiae ea qui ' .
-                                            'reiciendis dolorum aut ducimus sunt consequatur inventore dolor ' .
-                                            'officiis pariatur doloremque nemo culpa aut quidem qui dolore ' .
-                                            'laudantium atque commodi alias voluptatem non possimus aperiam ' .
-                                            'ipsum rerum consequuntur aut amet fugit quia aliquid praesentium ' .
-                                            'repellendus quibusdam et et inventore mollitia rerum sit autem ' .
-                                            'pariatur maiores ipsum accusantium perferendis vel sit possimus ' .
-                                            'veritatis nihil distinctio qui eum repellat officia illum quos ' .
-                                            'impedit quam iste esse unde qui suscipit aut facilis ut inventore ' .
-                                            'omnis exercitationem quo magnam consequatur maxime aut illum ' .
-                                            'soluta quaerat natus unde aspernatur et sed beatae nihil ullam ' .
-                                            'temporibus corporis ratione blanditiis perspiciatis impedit ' .
-                                            'voluptatem quis molestiae ea qui reiciendis dolorum aut ducimus ' .
-                                            'sunt consequatur inventore dolor officiis pariatur doloremque ' .
-                                            'nemo culpa aut quidem qui dolore laudantium atque commodi alias ' .
-                                            'voluptatem non possimus aperiam ipsum rerum consequuntur aut ' .
-                                            'amet fugit quia aliquid praesentium repellendus quibusdam et et ' .
-                                            'inventore mollitia rerum sit autem pariatur maiores ipsum accusantium ' .
-                                            'perferendis vel sit possimus veritatis nihil distinctio qui eum ' .
-                                            'repellat officia illum quos impedit quam iste esse unde qui ' .
-                                            'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
-                                            'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
-                                            'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
+                                                        'reiciendis dolorum aut ducimus sunt consequatur inventore dolor ' .
+                                                        'officiis pariatur doloremque nemo culpa aut quidem qui dolore ' .
+                                                        'laudantium atque commodi alias voluptatem non possimus aperiam ' .
+                                                        'ipsum rerum consequuntur aut amet fugit quia aliquid praesentium ' .
+                                                        'repellendus quibusdam et et inventore mollitia rerum sit autem ' .
+                                                        'pariatur maiores ipsum accusantium perferendis vel sit possimus ' .
+                                                        'veritatis nihil distinctio qui eum repellat officia illum quos ' .
+                                                        'impedit quam iste esse unde qui suscipit aut facilis ut inventore ' .
+                                                        'omnis exercitationem quo magnam consequatur maxime aut illum ' .
+                                                        'soluta quaerat natus unde aspernatur et sed beatae nihil ullam ' .
+                                                        'temporibus corporis ratione blanditiis perspiciatis impedit ' .
+                                                        'voluptatem quis molestiae ea qui reiciendis dolorum aut ducimus ' .
+                                                        'sunt consequatur inventore dolor officiis pariatur doloremque ' .
+                                                        'nemo culpa aut quidem qui dolore laudantium atque commodi alias ' .
+                                                        'voluptatem non possimus aperiam ipsum rerum consequuntur aut ' .
+                                                        'amet fugit quia aliquid praesentium repellendus quibusdam et et ' .
+                                                        'inventore mollitia rerum sit autem pariatur maiores ipsum accusantium ' .
+                                                        'perferendis vel sit possimus veritatis nihil distinctio qui eum ' .
+                                                        'repellat officia illum quos impedit quam iste esse unde qui ' .
+                                                        'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
+                                                        'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
+                                                        'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
                                'plink'   => 'item_plink'
                        ]
                );
@@ -2514,52 +2381,6 @@ class ApiTest extends FixtureTest
                }
        }
 
-       /**
-        * Test the api_format_items() function.
-        *
-        * @return void
-        */
-       public function testApiAccountRateLimitStatus()
-       {
-               $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()
-       {
-               $result = api_account_rate_limit_status('xml');
-               self::assertXml($result, 'hash');
-       }
-
-       /**
-        * Test the api_help_test() function.
-        *
-        * @return void
-        */
-       public function testApiHelpTest()
-       {
-               $result = api_help_test('json');
-               self::assertEquals(['ok' => 'ok'], $result);
-       }
-
-       /**
-        * Test the api_help_test() function with an XML result.
-        *
-        * @return void
-        */
-       public function testApiHelpTestWithXml()
-       {
-               $result = api_help_test('xml');
-               self::assertXml($result, 'ok');
-       }
-
        /**
         * Test the api_lists_list() function.
         *
@@ -2592,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');
        }
@@ -2644,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');
        }
 
@@ -2798,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']);
@@ -2809,17 +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()
-       {
-               $result = api_statusnet_version('json');
-               self::assertEquals('0.9.7', $result['version']);
+               */
        }
 
        /**
@@ -2841,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');
        }
@@ -2865,7 +2680,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiDirectMessagesNewWithScreenName()
        {
-               $this->app->setNickname($this->selfUser['nick']);
+               $this->app->setLoggedInUserNickname($this->selfUser['nick']);
                $_POST['text']        = 'message_text';
                $_POST['screen_name'] = $this->friendUser['nick'];
                $result               = api_direct_messages_new('json');
@@ -2881,7 +2696,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiDirectMessagesNewWithTitle()
        {
-               $this->app->setNickname($this->selfUser['nick']);
+               $this->app->setLoggedInUserNickname($this->selfUser['nick']);
                $_POST['text']        = 'message_text';
                $_POST['screen_name'] = $this->friendUser['nick'];
                $_REQUEST['title']    = 'message_title';
@@ -2899,7 +2714,7 @@ class ApiTest extends FixtureTest
         */
        public function testApiDirectMessagesNewWithRss()
        {
-               $this->app->setNickname($this->selfUser['nick']);
+               $this->app->setLoggedInUserNickname($this->selfUser['nick']);
                $_POST['text']        = 'message_text';
                $_POST['screen_name'] = $this->friendUser['nick'];
                $result               = api_direct_messages_new('rss');
@@ -2945,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');
        }
@@ -3079,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');
        }
 
@@ -3146,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.
         *
@@ -3256,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');
        }
@@ -3277,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');
        }
@@ -3313,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.
         *
@@ -3377,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');
        }
@@ -3422,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');
        }
@@ -3510,18 +3195,6 @@ class ApiTest extends FixtureTest
                $this->markTestIncomplete();
        }
 
-       /**
-        * Test the api_share_as_retweet() function.
-        *
-        * @return void
-        */
-       public function testApiShareAsRetweet()
-       {
-               $item   = ['body' => '', 'author-id' => 1, 'owner-id' => 1];
-               $result = api_share_as_retweet($item);
-               self::assertFalse($result);
-       }
-
        /**
         * Test the api_share_as_retweet() function with a valid item.
         *
@@ -3681,73 +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');
-               $dateRel = Temporal::getRelativeDate('2020-01-01 12:12:02');
-               $assertXml=<<<XML
-<?xml version="1.0"?>
-<notes>
-  <note id="1" hash="" type="8" name="Reply to" url="http://localhost/display/1" photo="http://localhost/" date="2020-01-01 12:12:02" msg="A test reply from an item" uid="42" uri-id="" link="http://localhost/notification/1" iid="4" parent="" parent-uri-id="" seen="0" verb="" otype="item" name_cache="Reply to" msg_cache="A test reply from an item" timestamp="1577880722" date_rel="{$dateRel}" msg_html="A test reply from an item" msg_plain="A test reply from an item"/>
-</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.
         *
@@ -3777,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']);
-       }
 }