]> git.mxchange.org Git - friendica.git/blob - tests/legacy/ApiTest.php
Merge pull request #11025 from MrPetovan/task/11022-improve-connector-hooks
[friendica.git] / tests / legacy / ApiTest.php
1 <?php
2 /**
3  * ApiTest class.
4  */
5
6 namespace Friendica\Test\legacy;
7
8 use Friendica\App;
9 use Friendica\Core\Config\Capability\IManageConfigValues;
10 use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
11 use Friendica\Core\Protocol;
12 use Friendica\DI;
13 use Friendica\Model\Post;
14 use Friendica\Module\Api\ApiResponse;
15 use Friendica\Module\BaseApi;
16 use Friendica\Network\HTTPException;
17 use Friendica\Security\BasicAuth;
18 use Friendica\Test\FixtureTest;
19 use Friendica\Util\Arrays;
20 use Friendica\Util\DateTimeFormat;
21 use Friendica\Util\Temporal;
22 use Monolog\Handler\TestHandler;
23
24 require_once __DIR__ . '/../../include/api.php';
25
26 /**
27  * Tests for the API functions.
28  *
29  * Functions that use header() need to be tested in a separate process.
30  * @see https://phpunit.de/manual/5.7/en/appendixes.annotations.html#appendixes.annotations.runTestsInSeparateProcesses
31  *
32  * @backupGlobals enabled
33  */
34 class ApiTest extends FixtureTest
35 {
36         /**
37          * @var TestHandler Can handle log-outputs
38          */
39         protected $logOutput;
40
41         /** @var array */
42         protected $selfUser;
43         /** @var array */
44         protected $friendUser;
45         /** @var array */
46         protected $otherUser;
47
48         protected $wrongUserId;
49
50         /** @var App */
51         protected $app;
52
53         /** @var IManageConfigValues */
54         protected $config;
55
56         /**
57          * Create variables used by tests.
58          */
59         protected function setUp() : void
60         {
61                 global $API, $called_api;
62                 $API = [];
63                 $called_api = [];
64
65                 parent::setUp();
66
67                 /** @var IManageConfigValues $config */
68                 $this->config = $this->dice->create(IManageConfigValues::class);
69
70                 $this->config->set('system', 'url', 'http://localhost');
71                 $this->config->set('system', 'hostname', 'localhost');
72                 $this->config->set('system', 'worker_dont_fork', true);
73
74                 // Default config
75                 $this->config->set('config', 'hostname', 'localhost');
76                 $this->config->set('system', 'throttle_limit_day', 100);
77                 $this->config->set('system', 'throttle_limit_week', 100);
78                 $this->config->set('system', 'throttle_limit_month', 100);
79                 $this->config->set('system', 'theme', 'system_theme');
80
81
82                 /** @var App app */
83                 $this->app = DI::app();
84
85                 DI::args()->setArgc(1);
86
87                 // User data that the test database is populated with
88                 $this->selfUser   = [
89                         'id'   => 42,
90                         'name' => 'Self contact',
91                         'nick' => 'selfcontact',
92                         'nurl' => 'http://localhost/profile/selfcontact'
93                 ];
94                 $this->friendUser = [
95                         'id'   => 44,
96                         'name' => 'Friend contact',
97                         'nick' => 'friendcontact',
98                         'nurl' => 'http://localhost/profile/friendcontact'
99                 ];
100                 $this->otherUser  = [
101                         'id'   => 43,
102                         'name' => 'othercontact',
103                         'nick' => 'othercontact',
104                         'nurl' => 'http://localhost/profile/othercontact'
105                 ];
106
107                 // User ID that we know is not in the database
108                 $this->wrongUserId = 666;
109
110                 DI::session()->start();
111
112                 // Most API require login so we force the session
113                 $_SESSION = [
114                         'authenticated' => true,
115                         'uid'           => $this->selfUser['id']
116                 ];
117                 BasicAuth::setCurrentUserID($this->selfUser['id']);
118         }
119
120         /**
121          * Assert that an user array contains expected keys.
122          *
123          * @param array $user User array
124          *
125          * @return void
126          */
127         private function assertSelfUser(array $user)
128         {
129                 self::assertEquals($this->selfUser['id'], $user['uid']);
130                 self::assertEquals($this->selfUser['id'], $user['cid']);
131                 self::assertEquals(1, $user['self']);
132                 self::assertEquals('DFRN', $user['location']);
133                 self::assertEquals($this->selfUser['name'], $user['name']);
134                 self::assertEquals($this->selfUser['nick'], $user['screen_name']);
135                 self::assertEquals('dfrn', $user['network']);
136                 self::assertTrue($user['verified']);
137         }
138
139         /**
140          * Assert that an user array contains expected keys.
141          *
142          * @param array $user User array
143          *
144          * @return void
145          */
146         private function assertOtherUser(array $user = [])
147         {
148                 self::assertEquals($this->otherUser['id'], $user['id']);
149                 self::assertEquals($this->otherUser['id'], $user['id_str']);
150                 self::assertEquals($this->otherUser['name'], $user['name']);
151                 self::assertEquals($this->otherUser['nick'], $user['screen_name']);
152                 self::assertFalse($user['verified']);
153         }
154
155         /**
156          * Assert that a status array contains expected keys.
157          *
158          * @param array $status Status array
159          *
160          * @return void
161          */
162         private function assertStatus(array $status = [])
163         {
164                 self::assertIsString($status['text'] ?? '');
165                 self::assertIsInt($status['id'] ?? '');
166                 // We could probably do more checks here.
167         }
168
169         /**
170          * Assert that a list array contains expected keys.
171          *
172          * @param array $list List array
173          *
174          * @return void
175          */
176         private function assertList(array $list = [])
177         {
178                 self::assertIsString($list['name']);
179                 self::assertIsInt($list['id']);
180                 self::assertIsString('string', $list['id_str']);
181                 self::assertContains($list['mode'], ['public', 'private']);
182                 // We could probably do more checks here.
183         }
184
185         /**
186          * Assert that the string is XML and contain the root element.
187          *
188          * @param string $result       XML string
189          * @param string $root_element Root element name
190          *
191          * @return void
192          */
193         private function assertXml($result = '', $root_element = '')
194         {
195                 self::assertStringStartsWith('<?xml version="1.0"?>', $result);
196                 self::assertStringContainsString('<' . $root_element, $result);
197                 // We could probably do more checks here.
198         }
199
200         /**
201          * Get the path to a temporary empty PNG image.
202          *
203          * @return string Path
204          */
205         private function getTempImage()
206         {
207                 $tmpFile = tempnam(sys_get_temp_dir(), 'tmp_file');
208                 file_put_contents(
209                         $tmpFile,
210                         base64_decode(
211                         // Empty 1x1 px PNG image
212                                 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=='
213                         )
214                 );
215
216                 return $tmpFile;
217         }
218
219         /**
220          * Test the api_user() function.
221          *
222          * @return void
223          */
224         public function testApiUser()
225         {
226                 self::assertEquals($this->selfUser['id'], BaseApi::getCurrentUserID());
227         }
228
229         /**
230          * Test the api_user() function with an unallowed user.
231          *
232          * @return void
233          */
234         public function testApiUserWithUnallowedUser()
235         {
236                 // self::assertEquals(false, api_user());
237         }
238
239         /**
240          * Test the api_source() function.
241          *
242          * @return void
243          */
244         public function testApiSource()
245         {
246                 self::assertEquals('api', BasicAuth::getCurrentApplicationToken()['name']);
247         }
248
249         /**
250          * Test the api_source() function with a Twidere user agent.
251          *
252          * @return void
253          */
254         public function testApiSourceWithTwidere()
255         {
256                 $_SERVER['HTTP_USER_AGENT'] = 'Twidere';
257                 self::assertEquals('Twidere', BasicAuth::getCurrentApplicationToken()['name']);
258         }
259
260         /**
261          * Test the api_source() function with a GET parameter.
262          *
263          * @return void
264          */
265         public function testApiSourceWithGet()
266         {
267                 $_REQUEST['source'] = 'source_name';
268                 self::assertEquals('source_name', BasicAuth::getCurrentApplicationToken()['name']);
269         }
270
271         /**
272          * Test the api_date() function.
273          *
274          * @return void
275          */
276         public function testApiDate()
277         {
278                 self::assertEquals('Wed Oct 10 00:00:00 +0000 1990', DateTimeFormat::utc('1990-10-10', DateTimeFormat::API));
279         }
280
281         /**
282          * Test the api_register_func() function.
283          *
284          * @return void
285          */
286         public function testApiRegisterFunc()
287         {
288                 global $API;
289                 self::assertNull(
290                         api_register_func(
291                                 'api_path',
292                                 function () {
293                                 },
294                                 true,
295                                 'method'
296                         )
297                 );
298                 self::assertTrue(is_callable($API['api_path']['func']));
299         }
300
301         /**
302          * Test the BasicAuth::getCurrentUserID() function without any login.
303          *
304          * @runInSeparateProcess
305          * @preserveGlobalState disabled
306          * @preserveGlobalState disabled
307          */
308         public function testApiLoginWithoutLogin()
309         {
310                 BasicAuth::setCurrentUserID();
311                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
312                 BasicAuth::getCurrentUserID(true);
313         }
314
315         /**
316          * Test the BasicAuth::getCurrentUserID() function with a bad login.
317          *
318          * @runInSeparateProcess
319          * @preserveGlobalState disabled
320          * @preserveGlobalState disabled
321          */
322         public function testApiLoginWithBadLogin()
323         {
324                 BasicAuth::setCurrentUserID();
325                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
326                 $_SERVER['PHP_AUTH_USER'] = 'user@server';
327                 BasicAuth::getCurrentUserID(true);
328         }
329
330         /**
331          * Test the BasicAuth::getCurrentUserID() function with oAuth.
332          *
333          * @return void
334          */
335         public function testApiLoginWithOauth()
336         {
337                 $this->markTestIncomplete('Can we test this easily?');
338         }
339
340         /**
341          * Test the BasicAuth::getCurrentUserID() function with authentication provided by an addon.
342          *
343          * @return void
344          */
345         public function testApiLoginWithAddonAuth()
346         {
347                 $this->markTestIncomplete('Can we test this easily?');
348         }
349
350         /**
351          * Test the BasicAuth::getCurrentUserID() function with a correct login.
352          *
353          * @runInSeparateProcess
354          * @preserveGlobalState disabled
355          * @doesNotPerformAssertions
356          */
357         public function testApiLoginWithCorrectLogin()
358         {
359                 BasicAuth::setCurrentUserID();
360                 $_SERVER['PHP_AUTH_USER'] = 'Test user';
361                 $_SERVER['PHP_AUTH_PW']   = 'password';
362                 BasicAuth::getCurrentUserID(true);
363         }
364
365         /**
366          * Test the BasicAuth::getCurrentUserID() function with a remote user.
367          *
368          * @runInSeparateProcess
369          * @preserveGlobalState disabled
370          */
371         public function testApiLoginWithRemoteUser()
372         {
373                 BasicAuth::setCurrentUserID();
374                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
375                 $_SERVER['REDIRECT_REMOTE_USER'] = '123456dXNlcjpwYXNzd29yZA==';
376                 BasicAuth::getCurrentUserID(true);
377         }
378
379         /**
380          * Test the api_call() function.
381          *
382          * @runInSeparateProcess
383          * @preserveGlobalState disabled
384          */
385         public function testApiCall()
386         {
387                 global $API;
388                 $API['api_path']           = [
389                         'method' => 'method',
390                         'func'   => function () {
391                                 return ['data' => ['some_data']];
392                         }
393                 ];
394                 $_SERVER['REQUEST_METHOD'] = 'method';
395                 $_SERVER['QUERY_STRING'] = 'pagename=api_path';
396                 $_GET['callback']          = 'callback_name';
397
398                 self::assertEquals(
399                         'callback_name(["some_data"])',
400                         api_call('api_path', 'json')
401                 );
402         }
403
404         /**
405          * Test the api_call() function with the profiled enabled.
406          *
407          * @runInSeparateProcess
408          * @preserveGlobalState disabled
409          */
410         public function testApiCallWithProfiler()
411         {
412                 global $API;
413                 $API['api_path']           = [
414                         'method' => 'method',
415                         'func'   => function () {
416                                 return ['data' => ['some_data']];
417                         }
418                 ];
419
420                 $_SERVER['REQUEST_METHOD'] = 'method';
421                 $_SERVER['QUERY_STRING'] = 'pagename=api_path';
422
423                 $this->config->set('system', 'profiler', true);
424                 $this->config->set('rendertime', 'callstack', true);
425                 $this->app->callstack = [
426                         'database'       => ['some_function' => 200],
427                         'database_write' => ['some_function' => 200],
428                         'cache'          => ['some_function' => 200],
429                         'cache_write'    => ['some_function' => 200],
430                         'network'        => ['some_function' => 200]
431                 ];
432
433                 self::assertEquals(
434                         '["some_data"]',
435                         api_call('api_path', 'json')
436                 );
437         }
438
439         /**
440          * Test the api_call() function with a JSON result.
441          *
442          * @runInSeparateProcess
443          * @preserveGlobalState disabled
444          */
445         public function testApiCallWithJson()
446         {
447                 global $API;
448                 $API['api_path']           = [
449                         'method' => 'method',
450                         'func'   => function () {
451                                 return ['data' => ['some_data']];
452                         }
453                 ];
454                 $_SERVER['REQUEST_METHOD'] = 'method';
455                 $_SERVER['QUERY_STRING'] = 'pagename=api_path.json';
456
457                 self::assertEquals(
458                         '["some_data"]',
459                         api_call('api_path.json', 'json')
460                 );
461         }
462
463         /**
464          * Test the api_call() function with an XML result.
465          *
466          * @runInSeparateProcess
467          * @preserveGlobalState disabled
468          */
469         public function testApiCallWithXml()
470         {
471                 global $API;
472                 $API['api_path']           = [
473                         'method' => 'method',
474                         'func'   => function () {
475                                 return 'some_data';
476                         }
477                 ];
478                 $_SERVER['REQUEST_METHOD'] = 'method';
479                 $_SERVER['QUERY_STRING'] = 'pagename=api_path.xml';
480
481                 $args = DI::args()->determine($_SERVER, $_GET);
482
483                 self::assertEquals(
484                         'some_data',
485                         api_call('api_path.xml', 'xml')
486                 );
487         }
488
489         /**
490          * Test the api_call() function with an RSS result.
491          *
492          * @runInSeparateProcess
493          * @preserveGlobalState disabled
494          */
495         public function testApiCallWithRss()
496         {
497                 global $API;
498                 $API['api_path']           = [
499                         'method' => 'method',
500                         'func'   => function () {
501                                 return 'some_data';
502                         }
503                 ];
504                 $_SERVER['REQUEST_METHOD'] = 'method';
505                 $_SERVER['QUERY_STRING'] = 'pagename=api_path.rss';
506
507                 self::assertEquals(
508                         '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
509                         'some_data',
510                         api_call('api_path.rss', 'rss')
511                 );
512         }
513
514         /**
515          * Test the api_call() function with an Atom result.
516          *
517          * @runInSeparateProcess
518          * @preserveGlobalState disabled
519          */
520         public function testApiCallWithAtom()
521         {
522                 global $API;
523                 $API['api_path']           = [
524                         'method' => 'method',
525                         'func'   => function () {
526                                 return 'some_data';
527                         }
528                 ];
529                 $_SERVER['REQUEST_METHOD'] = 'method';
530                 $_SERVER['QUERY_STRING'] = 'pagename=api_path.atom';
531
532                 self::assertEquals(
533                         '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
534                         'some_data',
535                         api_call('api_path.atom', 'atom')
536                 );
537         }
538
539         /**
540          * Test the api_rss_extra() function.
541          *
542          * @return void
543          */
544         public function testApiRssExtra()
545         {
546                 /*
547                 $user_info = ['url' => 'user_url', 'lang' => 'en'];
548                 $result    = api_rss_extra([], $user_info);
549                 self::assertEquals($user_info, $result['$user']);
550                 self::assertEquals($user_info['url'], $result['$rss']['alternate']);
551                 self::assertArrayHasKey('self', $result['$rss']);
552                 self::assertArrayHasKey('base', $result['$rss']);
553                 self::assertArrayHasKey('updated', $result['$rss']);
554                 self::assertArrayHasKey('atom_updated', $result['$rss']);
555                 self::assertArrayHasKey('language', $result['$rss']);
556                 self::assertArrayHasKey('logo', $result['$rss']);
557                 */
558         }
559
560         /**
561          * Test the api_rss_extra() function without any user info.
562          *
563          * @return void
564          */
565         public function testApiRssExtraWithoutUserInfo()
566         {
567                 /*
568                 $result = api_rss_extra([], null);
569                 self::assertIsArray($result['$user']);
570                 self::assertArrayHasKey('alternate', $result['$rss']);
571                 self::assertArrayHasKey('self', $result['$rss']);
572                 self::assertArrayHasKey('base', $result['$rss']);
573                 self::assertArrayHasKey('updated', $result['$rss']);
574                 self::assertArrayHasKey('atom_updated', $result['$rss']);
575                 self::assertArrayHasKey('language', $result['$rss']);
576                 self::assertArrayHasKey('logo', $result['$rss']);
577                 */
578         }
579
580         /**
581          * Test the api_get_user() function.
582          *
583          * @return void
584          */
585         public function testApiGetUser()
586         {
587                 // $user = api_get_user();
588                 // self::assertSelfUser($user);
589                 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
590                 // self::assertEquals('6fdbe8', $user['profile_link_color']);
591                 // self::assertEquals('ededed', $user['profile_background_color']);
592         }
593
594         /**
595          * Test the api_get_user() function with a Frio schema.
596          *
597          * @return void
598          */
599         public function testApiGetUserWithFrioSchema()
600         {
601                 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
602                 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
603                 // $user = api_get_user();
604                 // self::assertSelfUser($user);
605                 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
606                 // self::assertEquals('6fdbe8', $user['profile_link_color']);
607                 // self::assertEquals('ededed', $user['profile_background_color']);
608         }
609
610         /**
611          * Test the api_get_user() function with an empty Frio schema.
612          *
613          * @return void
614          */
615         public function testApiGetUserWithEmptyFrioSchema()
616         {
617                 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
618                 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
619                 // $user = api_get_user();
620                 // self::assertSelfUser($user);
621                 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
622                 // self::assertEquals('6fdbe8', $user['profile_link_color']);
623                 // self::assertEquals('ededed', $user['profile_background_color']);
624         }
625
626         /**
627          * Test the api_get_user() function with a custom Frio schema.
628          *
629          * @return void
630          */
631         public function testApiGetUserWithCustomFrioSchema()
632         {
633                 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
634                 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
635                 // $pConfig->set($this->selfUser['id'], 'frio', 'nav_bg', '#123456');
636                 // $pConfig->set($this->selfUser['id'], 'frio', 'link_color', '#123456');
637                 // $pConfig->set($this->selfUser['id'], 'frio', 'background_color', '#123456');
638                 // $user = api_get_user();
639                 // self::assertSelfUser($user);
640                 // self::assertEquals('123456', $user['profile_sidebar_fill_color']);
641                 // self::assertEquals('123456', $user['profile_link_color']);
642                 // self::assertEquals('123456', $user['profile_background_color']);
643         }
644
645         /**
646          * Test the api_get_user() function with an user that is not allowed to use the API.
647          *
648          * @runInSeparateProcess
649          * @preserveGlobalState disabled
650          */
651         public function testApiGetUserWithoutApiUser()
652         {
653                 // api_get_user() with empty parameters is not used anymore
654                 /*
655                 $_SERVER['PHP_AUTH_USER'] = 'Test user';
656                 $_SERVER['PHP_AUTH_PW']   = 'password';
657                 BasicAuth::setCurrentUserID();
658                 self::assertFalse(api_get_user());
659                 */
660         }
661
662         /**
663          * Test the api_get_user() function with an user ID in a GET parameter.
664          *
665          * @return void
666          */
667         public function testApiGetUserWithGetId()
668         {
669                 // self::assertOtherUser(api_get_user());
670         }
671
672         /**
673          * Test the api_get_user() function with a wrong user ID in a GET parameter.
674          *
675          * @return void
676          */
677         public function testApiGetUserWithWrongGetId()
678         {
679                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
680                 // self::assertOtherUser(api_get_user());
681         }
682
683         /**
684          * Test the api_get_user() function with an user name in a GET parameter.
685          *
686          * @return void
687          */
688         public function testApiGetUserWithGetName()
689         {
690                 // self::assertSelfUser(api_get_user());
691         }
692
693         /**
694          * Test the api_get_user() function with a profile URL in a GET parameter.
695          *
696          * @return void
697          */
698         public function testApiGetUserWithGetUrl()
699         {
700                 // self::assertSelfUser(api_get_user());
701         }
702
703         /**
704          * Test the api_get_user() function with an user ID in the API path.
705          *
706          * @return void
707          */
708         public function testApiGetUserWithNumericCalledApi()
709         {
710                 // global $called_api;
711                 // $called_api         = ['api_path'];
712                 // DI::args()->setArgv(['', $this->otherUser['id'] . '.json']);
713                 // self::assertOtherUser(api_get_user());
714         }
715
716         /**
717          * Test the api_get_user() function with the $called_api global variable.
718          *
719          * @return void
720          */
721         public function testApiGetUserWithCalledApi()
722         {
723                 // global $called_api;
724                 // $called_api = ['api', 'api_path'];
725                 // self::assertSelfUser(api_get_user());
726         }
727
728         /**
729          * Test the Arrays::walkRecursive() function.
730          *
731          * @return void
732          */
733         public function testApiWalkRecursive()
734         {
735                 $array = ['item1'];
736                 self::assertEquals(
737                         $array,
738                         Arrays::walkRecursive(
739                                 $array,
740                                 function () {
741                                         // Should we test this with a callback that actually does something?
742                                         return true;
743                                 }
744                         )
745                 );
746         }
747
748         /**
749          * Test the Arrays::walkRecursive() function with an array.
750          *
751          * @return void
752          */
753         public function testApiWalkRecursiveWithArray()
754         {
755                 $array = [['item1'], ['item2']];
756                 self::assertEquals(
757                         $array,
758                         Arrays::walkRecursive(
759                                 $array,
760                                 function () {
761                                         // Should we test this with a callback that actually does something?
762                                         return true;
763                                 }
764                         )
765                 );
766         }
767
768         /**
769          * Test the BaseApi::reformatXML() function.
770          *
771          * @return void
772          */
773         public function testApiReformatXml()
774         {
775                 $item = true;
776                 $key  = '';
777                 self::assertTrue(ApiResponse::reformatXML($item, $key));
778                 self::assertEquals('true', $item);
779         }
780
781         /**
782          * Test the BaseApi::reformatXML() function with a statusnet_api key.
783          *
784          * @return void
785          */
786         public function testApiReformatXmlWithStatusnetKey()
787         {
788                 $item = '';
789                 $key  = 'statusnet_api';
790                 self::assertTrue(ApiResponse::reformatXML($item, $key));
791                 self::assertEquals('statusnet:api', $key);
792         }
793
794         /**
795          * Test the BaseApi::reformatXML() function with a friendica_api key.
796          *
797          * @return void
798          */
799         public function testApiReformatXmlWithFriendicaKey()
800         {
801                 $item = '';
802                 $key  = 'friendica_api';
803                 self::assertTrue(ApiResponse::reformatXML($item, $key));
804                 self::assertEquals('friendica:api', $key);
805         }
806
807         /**
808          * Test the BaseApi::createXML() function.
809          *
810          * @return void
811          */
812         public function testApiCreateXml()
813         {
814                 self::assertEquals(
815                         '<?xml version="1.0"?>' . "\n" .
816                         '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
817                         'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
818                         'xmlns:georss="http://www.georss.org/georss">' . "\n" .
819                         '  <data>some_data</data>' . "\n" .
820                         '</root_element>' . "\n",
821                         DI::apiResponse()->createXML(['data' => ['some_data']], 'root_element')
822                 );
823         }
824
825         /**
826          * Test the BaseApi::createXML() function without any XML namespace.
827          *
828          * @return void
829          */
830         public function testApiCreateXmlWithoutNamespaces()
831         {
832                 self::assertEquals(
833                         '<?xml version="1.0"?>' . "\n" .
834                         '<ok>' . "\n" .
835                         '  <data>some_data</data>' . "\n" .
836                         '</ok>' . "\n",
837                         DI::apiResponse()->createXML(['data' => ['some_data']], 'ok')
838                 );
839         }
840
841         /**
842          * Test the BaseApi::formatData() function.
843          *
844          * @return void
845          */
846         public function testApiFormatData()
847         {
848                 $data = ['some_data'];
849                 self::assertEquals($data, DI::apiResponse()->formatData('root_element', 'json', $data));
850         }
851
852         /**
853          * Test the BaseApi::formatData() function with an XML result.
854          *
855          * @return void
856          */
857         public function testApiFormatDataWithXml()
858         {
859                 self::assertEquals(
860                         '<?xml version="1.0"?>' . "\n" .
861                         '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
862                         'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
863                         'xmlns:georss="http://www.georss.org/georss">' . "\n" .
864                         '  <data>some_data</data>' . "\n" .
865                         '</root_element>' . "\n",
866                         DI::apiResponse()->formatData('root_element', 'xml', ['data' => ['some_data']])
867                 );
868         }
869
870         /**
871          * Test the api_account_verify_credentials() function.
872          *
873          * @return void
874          */
875         public function testApiAccountVerifyCredentials()
876         {
877                 // self::assertArrayHasKey('user', api_account_verify_credentials('json'));
878         }
879
880         /**
881          * Test the api_account_verify_credentials() function without an authenticated user.
882          *
883          * @return void
884          */
885         public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
886         {
887                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
888                 // BasicAuth::setCurrentUserID();
889                 // $_SESSION['authenticated'] = false;
890                 // api_account_verify_credentials('json');
891         }
892
893         /**
894          * Test the api_statuses_mediap() function.
895          *
896          * @return void
897          */
898         public function testApiStatusesMediap()
899         {
900                 DI::args()->setArgc(2);
901
902                 $_FILES         = [
903                         'media' => [
904                                 'id'       => 666,
905                                 'size'     => 666,
906                                 'width'    => 666,
907                                 'height'   => 666,
908                                 'tmp_name' => $this->getTempImage(),
909                                 'name'     => 'spacer.png',
910                                 'type'     => 'image/png'
911                         ]
912                 ];
913                 $_GET['status'] = '<b>Status content</b>';
914
915                 $result = api_statuses_mediap('json');
916                 self::assertStatus($result['status']);
917         }
918
919         /**
920          * Test the api_statuses_mediap() function without an authenticated user.
921          *
922          * @return void
923          */
924         public function testApiStatusesMediapWithoutAuthenticatedUser()
925         {
926                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
927                 BasicAuth::setCurrentUserID();
928                 $_SESSION['authenticated'] = false;
929                 api_statuses_mediap('json');
930         }
931
932         /**
933          * Test the api_statuses_update() function.
934          *
935          * @return void
936          */
937         public function testApiStatusesUpdate()
938         {
939                 $_REQUEST['status']                = 'Status content #friendica';
940                 $_REQUEST['in_reply_to_status_id'] = -1;
941                 $_REQUEST['lat']                   = 48;
942                 $_REQUEST['long']                  = 7;
943                 $_FILES                            = [
944                         'media' => [
945                                 'id'       => 666,
946                                 'size'     => 666,
947                                 'width'    => 666,
948                                 'height'   => 666,
949                                 'tmp_name' => $this->getTempImage(),
950                                 'name'     => 'spacer.png',
951                                 'type'     => 'image/png'
952                         ]
953                 ];
954
955                 $result = api_statuses_update('json');
956                 self::assertStatus($result['status']);
957         }
958
959         /**
960          * Test the api_statuses_update() function with an HTML status.
961          *
962          * @return void
963          */
964         public function testApiStatusesUpdateWithHtml()
965         {
966                 $_REQUEST['htmlstatus'] = '<b>Status content</b>';
967
968                 $result = api_statuses_update('json');
969                 self::assertStatus($result['status']);
970         }
971
972         /**
973          * Test the api_statuses_update() function without an authenticated user.
974          *
975          * @return void
976          */
977         public function testApiStatusesUpdateWithoutAuthenticatedUser()
978         {
979                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
980                 BasicAuth::setCurrentUserID();
981                 $_SESSION['authenticated'] = false;
982                 api_statuses_update('json');
983         }
984
985         /**
986          * Test the api_statuses_update() function with a parent status.
987          *
988          * @return void
989          */
990         public function testApiStatusesUpdateWithParent()
991         {
992                 $this->markTestIncomplete('This triggers an exit() somewhere and kills PHPUnit.');
993         }
994
995         /**
996          * Test the api_statuses_update() function with a media_ids parameter.
997          *
998          * @return void
999          */
1000         public function testApiStatusesUpdateWithMediaIds()
1001         {
1002                 $this->markTestIncomplete();
1003         }
1004
1005         /**
1006          * Test the api_statuses_update() function with the throttle limit reached.
1007          *
1008          * @return void
1009          */
1010         public function testApiStatusesUpdateWithDayThrottleReached()
1011         {
1012                 $this->markTestIncomplete();
1013         }
1014
1015         /**
1016          * Test the api_media_upload() function.
1017          * @runInSeparateProcess
1018          * @preserveGlobalState disabled
1019          */
1020         public function testApiMediaUpload()
1021         {
1022                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1023                 api_media_upload();
1024         }
1025
1026         /**
1027          * Test the api_media_upload() function without an authenticated user.
1028          *
1029          * @return void
1030          */
1031         public function testApiMediaUploadWithoutAuthenticatedUser()
1032         {
1033                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1034                 BasicAuth::setCurrentUserID();
1035                 $_SESSION['authenticated'] = false;
1036                 api_media_upload();
1037         }
1038
1039         /**
1040          * Test the api_media_upload() function with an invalid uploaded media.
1041          *
1042          * @return void
1043          */
1044         public function testApiMediaUploadWithMedia()
1045         {
1046                 $this->expectException(\Friendica\Network\HTTPException\InternalServerErrorException::class);
1047                 $_FILES = [
1048                         'media' => [
1049                                 'id'       => 666,
1050                                 'tmp_name' => 'tmp_name'
1051                         ]
1052                 ];
1053                 api_media_upload();
1054         }
1055
1056         /**
1057          * Test the api_media_upload() function with an valid uploaded media.
1058          *
1059          * @return void
1060          */
1061         public function testApiMediaUploadWithValidMedia()
1062         {
1063                 $_FILES    = [
1064                         'media' => [
1065                                 'id'       => 666,
1066                                 'size'     => 666,
1067                                 'width'    => 666,
1068                                 'height'   => 666,
1069                                 'tmp_name' => $this->getTempImage(),
1070                                 'name'     => 'spacer.png',
1071                                 'type'     => 'image/png'
1072                         ]
1073                 ];
1074                 $app       = DI::app();
1075                 DI::args()->setArgc(2);
1076
1077                 $result = api_media_upload();
1078                 self::assertEquals('image/png', $result['media']['image']['image_type']);
1079                 self::assertEquals(1, $result['media']['image']['w']);
1080                 self::assertEquals(1, $result['media']['image']['h']);
1081                 self::assertNotEmpty($result['media']['image']['friendica_preview_url']);
1082         }
1083
1084         /**
1085          * Test the api_status_show() function.
1086          */
1087         public function testApiStatusShowWithJson()
1088         {
1089                 // $result = api_status_show('json', 1);
1090                 // self::assertStatus($result['status']);
1091         }
1092
1093         /**
1094          * Test the api_status_show() function with an XML result.
1095          */
1096         public function testApiStatusShowWithXml()
1097         {
1098                 // $result = api_status_show('xml', 1);
1099                 // self::assertXml($result, 'statuses');
1100         }
1101
1102         /**
1103          * Test the api_get_last_status() function
1104          */
1105         public function testApiGetLastStatus()
1106         {
1107                 // $item = api_get_last_status($this->selfUser['id'], $this->selfUser['id']);
1108                 // self::assertNotNull($item);
1109         }
1110
1111         /**
1112          * Test the api_users_show() function.
1113          *
1114          * @return void
1115          */
1116         public function testApiUsersShow()
1117         {
1118                 /*
1119                 $result = api_users_show('json');
1120                 // We can't use assertSelfUser() here because the user object is missing some properties.
1121                 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
1122                 self::assertEquals('DFRN', $result['user']['location']);
1123                 self::assertEquals($this->selfUser['name'], $result['user']['name']);
1124                 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
1125                 self::assertTrue($result['user']['verified']);
1126                 */
1127         }
1128
1129         /**
1130          * Test the api_users_show() function with an XML result.
1131          *
1132          * @return void
1133          */
1134         public function testApiUsersShowWithXml()
1135         {
1136                 // $result = api_users_show('xml');
1137                 // self::assertXml($result, 'statuses');
1138         }
1139
1140         /**
1141          * Test the api_users_search() function.
1142          *
1143          * @return void
1144          */
1145         public function testApiUsersSearch()
1146         {
1147                 // $_GET['q'] = 'othercontact';
1148                 // $result    = api_users_search('json');
1149                 // self::assertOtherUser($result['users'][0]);
1150         }
1151
1152         /**
1153          * Test the api_users_search() function with an XML result.
1154          *
1155          * @return void
1156          */
1157         public function testApiUsersSearchWithXml()
1158         {
1159                 // $_GET['q'] = 'othercontact';
1160                 // $result    = api_users_search('xml');
1161                 // self::assertXml($result, 'users');
1162         }
1163
1164         /**
1165          * Test the api_users_search() function without a GET q parameter.
1166          *
1167          * @return void
1168          */
1169         public function testApiUsersSearchWithoutQuery()
1170         {
1171                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1172                 // api_users_search('json');
1173         }
1174
1175         /**
1176          * Test the api_users_lookup() function.
1177          *
1178          * @return void
1179          */
1180         public function testApiUsersLookup()
1181         {
1182                 // $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
1183                 // api_users_lookup('json');
1184         }
1185
1186         /**
1187          * Test the api_users_lookup() function with an user ID.
1188          *
1189          * @return void
1190          */
1191         public function testApiUsersLookupWithUserId()
1192         {
1193                 // $_REQUEST['user_id'] = $this->otherUser['id'];
1194                 // $result              = api_users_lookup('json');
1195                 // self::assertOtherUser($result['users'][0]);
1196         }
1197
1198         /**
1199          * Test the api_search() function.
1200          *
1201          * @return void
1202          */
1203         public function testApiSearch()
1204         {
1205                 /*
1206                 $_REQUEST['q']      = 'reply';
1207                 $_REQUEST['max_id'] = 10;
1208                 $result             = api_search('json');
1209                 foreach ($result['status'] as $status) {
1210                         self::assertStatus($status);
1211                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1212                 }
1213                 */
1214         }
1215
1216         /**
1217          * Test the api_search() function a count parameter.
1218          *
1219          * @return void
1220          */
1221         public function testApiSearchWithCount()
1222         {
1223                 /*
1224                 $_REQUEST['q']     = 'reply';
1225                 $_REQUEST['count'] = 20;
1226                 $result            = api_search('json');
1227                 foreach ($result['status'] as $status) {
1228                         self::assertStatus($status);
1229                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1230                 }
1231                 */
1232         }
1233
1234         /**
1235          * Test the api_search() function with an rpp parameter.
1236          *
1237          * @return void
1238          */
1239         public function testApiSearchWithRpp()
1240         {
1241                 /*
1242                 $_REQUEST['q']   = 'reply';
1243                 $_REQUEST['rpp'] = 20;
1244                 $result          = api_search('json');
1245                 foreach ($result['status'] as $status) {
1246                         self::assertStatus($status);
1247                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1248                 }
1249                 */
1250         }
1251
1252         /**
1253          * Test the api_search() function with an q parameter contains hashtag.
1254          * @doesNotPerformAssertions
1255          */
1256         public function testApiSearchWithHashtag()
1257         {
1258                 /*
1259                 $_REQUEST['q'] = '%23friendica';
1260                 $result        = api_search('json');
1261                 foreach ($result['status'] as $status) {
1262                         self::assertStatus($status);
1263                         self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true);
1264                 }
1265                 */
1266         }
1267
1268         /**
1269          * Test the api_search() function with an exclude_replies parameter.
1270          * @doesNotPerformAssertions
1271          */
1272         public function testApiSearchWithExcludeReplies()
1273         {
1274                 /*
1275                 $_REQUEST['max_id']          = 10;
1276                 $_REQUEST['exclude_replies'] = true;
1277                 $_REQUEST['q']               = 'friendica';
1278                 $result                      = api_search('json');
1279                 foreach ($result['status'] as $status) {
1280                         self::assertStatus($status);
1281                 }
1282                 */
1283         }
1284
1285         /**
1286          * Test the api_search() function without an authenticated user.
1287          *
1288          * @return void
1289          */
1290         public function testApiSearchWithUnallowedUser()
1291         {
1292                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1293                 // BasicAuth::setCurrentUserID();
1294                 // api_search('json');
1295         }
1296
1297         /**
1298          * Test the api_search() function without any GET query parameter.
1299          *
1300          * @return void
1301          */
1302         public function testApiSearchWithoutQuery()
1303         {
1304                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1305                 // api_search('json');
1306         }
1307
1308         /**
1309          * Test the api_statuses_home_timeline() function.
1310          *
1311          * @return void
1312          */
1313         public function testApiStatusesHomeTimeline()
1314         {
1315                 /*
1316                 $_REQUEST['max_id']          = 10;
1317                 $_REQUEST['exclude_replies'] = true;
1318                 $_REQUEST['conversation_id'] = 1;
1319                 $result                      = api_statuses_home_timeline('json');
1320                 self::assertNotEmpty($result['status']);
1321                 foreach ($result['status'] as $status) {
1322                         self::assertStatus($status);
1323                 }
1324                 */
1325         }
1326
1327         /**
1328          * Test the api_statuses_home_timeline() function with a negative page parameter.
1329          *
1330          * @return void
1331          */
1332         public function testApiStatusesHomeTimelineWithNegativePage()
1333         {
1334                 /*
1335                 $_REQUEST['page'] = -2;
1336                 $result           = api_statuses_home_timeline('json');
1337                 self::assertNotEmpty($result['status']);
1338                 foreach ($result['status'] as $status) {
1339                         self::assertStatus($status);
1340                 }
1341                 */
1342         }
1343
1344         /**
1345          * Test the api_statuses_home_timeline() with an unallowed user.
1346          *
1347          * @return void
1348          */
1349         public function testApiStatusesHomeTimelineWithUnallowedUser()
1350         {
1351                 /*
1352                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1353                 BasicAuth::setCurrentUserID();
1354                 api_statuses_home_timeline('json');
1355                 */
1356         }
1357
1358         /**
1359          * Test the api_statuses_home_timeline() function with an RSS result.
1360          *
1361          * @return void
1362          */
1363         public function testApiStatusesHomeTimelineWithRss()
1364         {
1365                 // $result = api_statuses_home_timeline('rss');
1366                 // self::assertXml($result, 'statuses');
1367         }
1368
1369         /**
1370          * Test the api_statuses_public_timeline() function.
1371          *
1372          * @return void
1373          */
1374         public function testApiStatusesPublicTimeline()
1375         {
1376                 /*
1377                 $_REQUEST['max_id']          = 10;
1378                 $_REQUEST['conversation_id'] = 1;
1379                 $result                      = api_statuses_public_timeline('json');
1380                 self::assertNotEmpty($result['status']);
1381                 foreach ($result['status'] as $status) {
1382                         self::assertStatus($status);
1383                 }
1384                 */
1385         }
1386
1387         /**
1388          * Test the api_statuses_public_timeline() function with the exclude_replies parameter.
1389          *
1390          * @return void
1391          */
1392         public function testApiStatusesPublicTimelineWithExcludeReplies()
1393         {
1394                 /*
1395                 $_REQUEST['max_id']          = 10;
1396                 $_REQUEST['exclude_replies'] = true;
1397                 $result                      = api_statuses_public_timeline('json');
1398                 self::assertNotEmpty($result['status']);
1399                 foreach ($result['status'] as $status) {
1400                         self::assertStatus($status);
1401                 }
1402                 */
1403         }
1404
1405         /**
1406          * Test the api_statuses_public_timeline() function with a negative page parameter.
1407          *
1408          * @return void
1409          */
1410         public function testApiStatusesPublicTimelineWithNegativePage()
1411         {
1412                 /*
1413                 $_REQUEST['page'] = -2;
1414                 $result           = api_statuses_public_timeline('json');
1415                 self::assertNotEmpty($result['status']);
1416                 foreach ($result['status'] as $status) {
1417                         self::assertStatus($status);
1418                 }
1419                 */
1420         }
1421
1422         /**
1423          * Test the api_statuses_public_timeline() function with an unallowed user.
1424          *
1425          * @return void
1426          */
1427         public function testApiStatusesPublicTimelineWithUnallowedUser()
1428         {
1429                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1430                 // BasicAuth::setCurrentUserID();
1431                 // api_statuses_public_timeline('json');
1432         }
1433
1434         /**
1435          * Test the api_statuses_public_timeline() function with an RSS result.
1436          *
1437          * @return void
1438          */
1439         public function testApiStatusesPublicTimelineWithRss()
1440         {
1441                 // $result = api_statuses_public_timeline('rss');
1442                 // self::assertXml($result, 'statuses');
1443         }
1444
1445         /**
1446          * Test the api_statuses_networkpublic_timeline() function.
1447          *
1448          * @return void
1449          */
1450         public function testApiStatusesNetworkpublicTimeline()
1451         {
1452                 /*
1453                 $_REQUEST['max_id'] = 10;
1454                 $result             = api_statuses_networkpublic_timeline('json');
1455                 self::assertNotEmpty($result['status']);
1456                 foreach ($result['status'] as $status) {
1457                         self::assertStatus($status);
1458                 }
1459                 */
1460         }
1461
1462         /**
1463          * Test the api_statuses_networkpublic_timeline() function with a negative page parameter.
1464          *
1465          * @return void
1466          */
1467         public function testApiStatusesNetworkpublicTimelineWithNegativePage()
1468         {
1469                 /*
1470                 $_REQUEST['page'] = -2;
1471                 $result           = api_statuses_networkpublic_timeline('json');
1472                 self::assertNotEmpty($result['status']);
1473                 foreach ($result['status'] as $status) {
1474                         self::assertStatus($status);
1475                 }
1476                 */
1477         }
1478
1479         /**
1480          * Test the api_statuses_networkpublic_timeline() function with an unallowed user.
1481          *
1482          * @return void
1483          */
1484         public function testApiStatusesNetworkpublicTimelineWithUnallowedUser()
1485         {
1486                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1487                 // BasicAuth::setCurrentUserID();
1488                 // api_statuses_networkpublic_timeline('json');
1489         }
1490
1491         /**
1492          * Test the api_statuses_networkpublic_timeline() function with an RSS result.
1493          *
1494          * @return void
1495          */
1496         public function testApiStatusesNetworkpublicTimelineWithRss()
1497         {
1498                 // $result = api_statuses_networkpublic_timeline('rss');
1499                 // self::assertXml($result, 'statuses');
1500         }
1501
1502         /**
1503          * Test the api_statuses_show() function.
1504          *
1505          * @return void
1506          */
1507         public function testApiStatusesShow()
1508         {
1509                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1510                 // api_statuses_show('json');
1511         }
1512
1513         /**
1514          * Test the api_statuses_show() function with an ID.
1515          *
1516          * @return void
1517          */
1518         public function testApiStatusesShowWithId()
1519         {
1520                 // DI::args()->setArgv(['', '', '', 1]);
1521                 // $result = api_statuses_show('json');
1522                 // self::assertStatus($result['status']);
1523         }
1524
1525         /**
1526          * Test the api_statuses_show() function with the conversation parameter.
1527          *
1528          * @return void
1529          */
1530         public function testApiStatusesShowWithConversation()
1531         {
1532                 /*
1533                 DI::args()->setArgv(['', '', '', 1]);
1534                 $_REQUEST['conversation'] = 1;
1535                 $result                   = api_statuses_show('json');
1536                 self::assertNotEmpty($result['status']);
1537                 foreach ($result['status'] as $status) {
1538                         self::assertStatus($status);
1539                 }
1540                 */
1541         }
1542
1543         /**
1544          * Test the api_statuses_show() function with an unallowed user.
1545          *
1546          * @return void
1547          */
1548         public function testApiStatusesShowWithUnallowedUser()
1549         {
1550                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1551                 // BasicAuth::setCurrentUserID();
1552                 // api_statuses_show('json');
1553         }
1554
1555         /**
1556          * Test the api_conversation_show() function.
1557          *
1558          * @return void
1559          */
1560         public function testApiConversationShow()
1561         {
1562                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1563                 // api_conversation_show('json');
1564         }
1565
1566         /**
1567          * Test the api_conversation_show() function with an ID.
1568          *
1569          * @return void
1570          */
1571         public function testApiConversationShowWithId()
1572         {
1573                 /*
1574                 DI::args()->setArgv(['', '', '', 1]);
1575                 $_REQUEST['max_id'] = 10;
1576                 $_REQUEST['page']   = -2;
1577                 $result             = api_conversation_show('json');
1578                 self::assertNotEmpty($result['status']);
1579                 foreach ($result['status'] as $status) {
1580                         self::assertStatus($status);
1581                 }
1582                 */
1583         }
1584
1585         /**
1586          * Test the api_conversation_show() function with an unallowed user.
1587          *
1588          * @return void
1589          */
1590         public function testApiConversationShowWithUnallowedUser()
1591         {
1592                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1593                 // BasicAuth::setCurrentUserID();
1594                 // api_conversation_show('json');
1595         }
1596
1597         /**
1598          * Test the api_statuses_repeat() function.
1599          *
1600          * @return void
1601          */
1602         public function testApiStatusesRepeat()
1603         {
1604                 $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
1605                 api_statuses_repeat('json');
1606         }
1607
1608         /**
1609          * Test the api_statuses_repeat() function without an authenticated user.
1610          *
1611          * @return void
1612          */
1613         public function testApiStatusesRepeatWithoutAuthenticatedUser()
1614         {
1615                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1616                 BasicAuth::setCurrentUserID();
1617                 $_SESSION['authenticated'] = false;
1618                 api_statuses_repeat('json');
1619         }
1620
1621         /**
1622          * Test the api_statuses_repeat() function with an ID.
1623          *
1624          * @return void
1625          */
1626         public function testApiStatusesRepeatWithId()
1627         {
1628                 DI::args()->setArgv(['', '', '', 1]);
1629                 $result = api_statuses_repeat('json');
1630                 self::assertStatus($result['status']);
1631
1632                 // Also test with a shared status
1633                 DI::args()->setArgv(['', '', '', 5]);
1634                 $result = api_statuses_repeat('json');
1635                 self::assertStatus($result['status']);
1636         }
1637
1638         /**
1639          * Test the api_statuses_destroy() function.
1640          *
1641          * @return void
1642          */
1643         public function testApiStatusesDestroy()
1644         {
1645                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1646                 // api_statuses_destroy('json');
1647         }
1648
1649         /**
1650          * Test the api_statuses_destroy() function without an authenticated user.
1651          *
1652          * @return void
1653          */
1654         public function testApiStatusesDestroyWithoutAuthenticatedUser()
1655         {
1656                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1657                 // BasicAuth::setCurrentUserID();
1658                 // $_SESSION['authenticated'] = false;
1659                 // api_statuses_destroy('json');
1660         }
1661
1662         /**
1663          * Test the api_statuses_destroy() function with an ID.
1664          *
1665          * @return void
1666          */
1667         public function testApiStatusesDestroyWithId()
1668         {
1669                 // DI::args()->setArgv(['', '', '', 1]);
1670                 // $result = api_statuses_destroy('json');
1671                 // self::assertStatus($result['status']);
1672         }
1673
1674         /**
1675          * Test the api_statuses_mentions() function.
1676          *
1677          * @return void
1678          */
1679         public function testApiStatusesMentions()
1680         {
1681                 /*
1682                 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
1683                 $_REQUEST['max_id'] = 10;
1684                 $result             = api_statuses_mentions('json');
1685                 self::assertEmpty($result['status']);
1686                 // We should test with mentions in the database.
1687                 */
1688         }
1689
1690         /**
1691          * Test the api_statuses_mentions() function with a negative page parameter.
1692          *
1693          * @return void
1694          */
1695         public function testApiStatusesMentionsWithNegativePage()
1696         {
1697                 // $_REQUEST['page'] = -2;
1698                 // $result           = api_statuses_mentions('json');
1699                 // self::assertEmpty($result['status']);
1700         }
1701
1702         /**
1703          * Test the api_statuses_mentions() function with an unallowed user.
1704          *
1705          * @return void
1706          */
1707         public function testApiStatusesMentionsWithUnallowedUser()
1708         {
1709                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1710                 // BasicAuth::setCurrentUserID();
1711                 // api_statuses_mentions('json');
1712         }
1713
1714         /**
1715          * Test the api_statuses_mentions() function with an RSS result.
1716          *
1717          * @return void
1718          */
1719         public function testApiStatusesMentionsWithRss()
1720         {
1721                 // $result = api_statuses_mentions('rss');
1722                 // self::assertXml($result, 'statuses');
1723         }
1724
1725         /**
1726          * Test the api_statuses_user_timeline() function.
1727          *
1728          * @return void
1729          */
1730         public function testApiStatusesUserTimeline()
1731         {
1732         /*
1733                 $_REQUEST['user_id']         = 42;
1734                 $_REQUEST['max_id']          = 10;
1735                 $_REQUEST['exclude_replies'] = true;
1736                 $_REQUEST['conversation_id'] = 7;
1737
1738                 $result = api_statuses_user_timeline('json');
1739                 self::assertNotEmpty($result['status']);
1740                 foreach ($result['status'] as $status) {
1741                         self::assertStatus($status);
1742                 }
1743                 */
1744         }
1745
1746         /**
1747          * Test the api_statuses_user_timeline() function with a negative page parameter.
1748          *
1749          * @return void
1750          */
1751         public function testApiStatusesUserTimelineWithNegativePage()
1752         {
1753                 /*
1754                 $_REQUEST['user_id'] = 42;
1755                 $_REQUEST['page']    = -2;
1756
1757                 $result = api_statuses_user_timeline('json');
1758                 self::assertNotEmpty($result['status']);
1759                 foreach ($result['status'] as $status) {
1760                         self::assertStatus($status);
1761                 }
1762                 */
1763         }
1764
1765         /**
1766          * Test the api_statuses_user_timeline() function with an RSS result.
1767          *
1768          * @return void
1769          */
1770         public function testApiStatusesUserTimelineWithRss()
1771         {
1772                 // $result = api_statuses_user_timeline('rss');
1773                 // self::assertXml($result, 'statuses');
1774         }
1775
1776         /**
1777          * Test the api_statuses_user_timeline() function with an unallowed user.
1778          *
1779          * @return void
1780          */
1781         public function testApiStatusesUserTimelineWithUnallowedUser()
1782         {
1783                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1784                 // BasicAuth::setCurrentUserID();
1785                 // api_statuses_user_timeline('json');
1786         }
1787
1788         /**
1789          * Test the api_favorites_create_destroy() function.
1790          *
1791          * @return void
1792          */
1793         public function testApiFavoritesCreateDestroy()
1794         {
1795                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1796                 DI::args()->setArgv(['api', '1.1', 'favorites', 'create']);
1797                 api_favorites_create_destroy('json');
1798         }
1799
1800         /**
1801          * Test the api_favorites_create_destroy() function with an invalid ID.
1802          *
1803          * @return void
1804          */
1805         public function testApiFavoritesCreateDestroyWithInvalidId()
1806         {
1807                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1808                 DI::args()->setArgv(['api', '1.1', 'favorites', 'create', '12.json']);
1809                 api_favorites_create_destroy('json');
1810         }
1811
1812         /**
1813          * Test the api_favorites_create_destroy() function with an invalid action.
1814          *
1815          * @return void
1816          */
1817         public function testApiFavoritesCreateDestroyWithInvalidAction()
1818         {
1819                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1820                 DI::args()->setArgv(['api', '1.1', 'favorites', 'change.json']);
1821                 $_REQUEST['id'] = 1;
1822                 api_favorites_create_destroy('json');
1823         }
1824
1825         /**
1826          * Test the api_favorites_create_destroy() function with the create action.
1827          *
1828          * @return void
1829          */
1830         public function testApiFavoritesCreateDestroyWithCreateAction()
1831         {
1832                 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1833                 $_REQUEST['id'] = 3;
1834                 $result         = api_favorites_create_destroy('json');
1835                 self::assertStatus($result['status']);
1836         }
1837
1838         /**
1839          * Test the api_favorites_create_destroy() function with the create action and an RSS result.
1840          *
1841          * @return void
1842          */
1843         public function testApiFavoritesCreateDestroyWithCreateActionAndRss()
1844         {
1845                 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.rss']);
1846                 $_REQUEST['id'] = 3;
1847                 $result         = api_favorites_create_destroy('rss');
1848                 self::assertXml($result, 'status');
1849         }
1850
1851         /**
1852          * Test the api_favorites_create_destroy() function with the destroy action.
1853          *
1854          * @return void
1855          */
1856         public function testApiFavoritesCreateDestroyWithDestroyAction()
1857         {
1858                 DI::args()->setArgv(['api', '1.1', 'favorites', 'destroy.json']);
1859                 $_REQUEST['id'] = 3;
1860                 $result         = api_favorites_create_destroy('json');
1861                 self::assertStatus($result['status']);
1862         }
1863
1864         /**
1865          * Test the api_favorites_create_destroy() function without an authenticated user.
1866          *
1867          * @return void
1868          */
1869         public function testApiFavoritesCreateDestroyWithoutAuthenticatedUser()
1870         {
1871                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1872                 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1873                 BasicAuth::setCurrentUserID();
1874                 $_SESSION['authenticated'] = false;
1875                 api_favorites_create_destroy('json');
1876         }
1877
1878         /**
1879          * Test the api_favorites() function.
1880          *
1881          * @return void
1882          */
1883         public function testApiFavorites()
1884         {
1885                 /*
1886                 $_REQUEST['page']   = -1;
1887                 $_REQUEST['max_id'] = 10;
1888                 $result             = api_favorites('json');
1889                 foreach ($result['status'] as $status) {
1890                         self::assertStatus($status);
1891                 }
1892                 */
1893         }
1894
1895         /**
1896          * Test the api_favorites() function with an RSS result.
1897          *
1898          * @return void
1899          */
1900         public function testApiFavoritesWithRss()
1901         {
1902                 // $result = api_favorites('rss');
1903                 // self::assertXml($result, 'statuses');
1904         }
1905
1906         /**
1907          * Test the api_favorites() function with an unallowed user.
1908          *
1909          * @return void
1910          */
1911         public function testApiFavoritesWithUnallowedUser()
1912         {
1913                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1914                 // BasicAuth::setCurrentUserID();
1915                 // api_favorites('json');
1916         }
1917
1918         /**
1919          * Test the api_format_messages() function.
1920          *
1921          * @return void
1922          */
1923         public function testApiFormatMessages()
1924         {
1925                 $result = api_format_messages(
1926                         ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1927                         ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1928                         ['id' => 3, 'uri-id' => 2, 'screen_name' => 'sender_name']
1929                 );
1930                 self::assertEquals('item_title' . "\n" . 'item_body', $result['text']);
1931                 self::assertEquals(1, $result['id']);
1932                 self::assertEquals(2, $result['recipient_id']);
1933                 self::assertEquals(3, $result['sender_id']);
1934                 self::assertEquals('recipient_name', $result['recipient_screen_name']);
1935                 self::assertEquals('sender_name', $result['sender_screen_name']);
1936         }
1937
1938         /**
1939          * Test the api_format_messages() function with HTML.
1940          *
1941          * @return void
1942          */
1943         public function testApiFormatMessagesWithHtmlText()
1944         {
1945                 $_GET['getText'] = 'html';
1946                 $result          = api_format_messages(
1947                         ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1948                         ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1949                         ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1950                 );
1951                 self::assertEquals('item_title', $result['title']);
1952                 self::assertEquals('<strong>item_body</strong>', $result['text']);
1953         }
1954
1955         /**
1956          * Test the api_format_messages() function with plain text.
1957          *
1958          * @return void
1959          */
1960         public function testApiFormatMessagesWithPlainText()
1961         {
1962                 $_GET['getText'] = 'plain';
1963                 $result          = api_format_messages(
1964                         ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1965                         ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1966                         ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1967                 );
1968                 self::assertEquals('item_title', $result['title']);
1969                 self::assertEquals('item_body', $result['text']);
1970         }
1971
1972         /**
1973          * Test the api_format_messages() function with the getUserObjects GET parameter set to false.
1974          *
1975          * @return void
1976          */
1977         public function testApiFormatMessagesWithoutUserObjects()
1978         {
1979                 $_GET['getUserObjects'] = 'false';
1980                 $result                 = api_format_messages(
1981                         ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1982                         ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1983                         ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1984                 );
1985                 self::assertTrue(!isset($result['sender']));
1986                 self::assertTrue(!isset($result['recipient']));
1987         }
1988
1989         /**
1990          * Test the api_convert_item() function.
1991          *
1992          * @return void
1993          */
1994         public function testApiConvertItem()
1995         {
1996                 /*
1997                 $result = api_convert_item(
1998                         [
1999                                 'network' => 'feed',
2000                                 'title'   => 'item_title',
2001                                 'uri-id'  => 1,
2002                                 // We need a long string to test that it is correctly cut
2003                                 'body'    => 'perspiciatis impedit voluptatem quis molestiae ea qui ' .
2004                                                          'reiciendis dolorum aut ducimus sunt consequatur inventore dolor ' .
2005                                                          'officiis pariatur doloremque nemo culpa aut quidem qui dolore ' .
2006                                                          'laudantium atque commodi alias voluptatem non possimus aperiam ' .
2007                                                          'ipsum rerum consequuntur aut amet fugit quia aliquid praesentium ' .
2008                                                          'repellendus quibusdam et et inventore mollitia rerum sit autem ' .
2009                                                          'pariatur maiores ipsum accusantium perferendis vel sit possimus ' .
2010                                                          'veritatis nihil distinctio qui eum repellat officia illum quos ' .
2011                                                          'impedit quam iste esse unde qui suscipit aut facilis ut inventore ' .
2012                                                          'omnis exercitationem quo magnam consequatur maxime aut illum ' .
2013                                                          'soluta quaerat natus unde aspernatur et sed beatae nihil ullam ' .
2014                                                          'temporibus corporis ratione blanditiis perspiciatis impedit ' .
2015                                                          'voluptatem quis molestiae ea qui reiciendis dolorum aut ducimus ' .
2016                                                          'sunt consequatur inventore dolor officiis pariatur doloremque ' .
2017                                                          'nemo culpa aut quidem qui dolore laudantium atque commodi alias ' .
2018                                                          'voluptatem non possimus aperiam ipsum rerum consequuntur aut ' .
2019                                                          'amet fugit quia aliquid praesentium repellendus quibusdam et et ' .
2020                                                          'inventore mollitia rerum sit autem pariatur maiores ipsum accusantium ' .
2021                                                          'perferendis vel sit possimus veritatis nihil distinctio qui eum ' .
2022                                                          'repellat officia illum quos impedit quam iste esse unde qui ' .
2023                                                          'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
2024                                                          'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
2025                                                          'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
2026                                 'plink'   => 'item_plink'
2027                         ]
2028                 );
2029                 self::assertStringStartsWith('item_title', $result['text']);
2030                 self::assertStringStartsWith('<h4>item_title</h4><br>perspiciatis impedit voluptatem', $result['html']);
2031                 */
2032         }
2033
2034         /**
2035          * Test the api_convert_item() function with an empty item body.
2036          *
2037          * @return void
2038          */
2039         public function testApiConvertItemWithoutBody()
2040         {
2041                 /*
2042                 $result = api_convert_item(
2043                         [
2044                                 'network' => 'feed',
2045                                 'title'   => 'item_title',
2046                                 'uri-id'  => -1,
2047                                 'body'    => '',
2048                                 'plink'   => 'item_plink'
2049                         ]
2050                 );
2051                 self::assertEquals("item_title", $result['text']);
2052                 self::assertEquals('<h4>item_title</h4><br>item_plink', $result['html']);
2053                 */
2054         }
2055
2056         /**
2057          * Test the api_convert_item() function with the title in the body.
2058          *
2059          * @return void
2060          */
2061         public function testApiConvertItemWithTitleInBody()
2062         {
2063                 /*
2064                 $result = api_convert_item(
2065                         [
2066                                 'title'  => 'item_title',
2067                                 'body'   => 'item_title item_body',
2068                                 'uri-id' => 1,
2069                         ]
2070                 );
2071                 self::assertEquals('item_title item_body', $result['text']);
2072                 self::assertEquals('<h4>item_title</h4><br>item_title item_body', $result['html']);
2073                 */
2074         }
2075
2076         /**
2077          * Test the api_get_attachments() function.
2078          *
2079          * @return void
2080          */
2081         public function testApiGetAttachments()
2082         {
2083                 // $body = 'body';
2084                 // self::assertEmpty(api_get_attachments($body, 0));
2085         }
2086
2087         /**
2088          * Test the api_get_attachments() function with an img tag.
2089          *
2090          * @return void
2091          */
2092         public function testApiGetAttachmentsWithImage()
2093         {
2094                 // $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2095                 // self::assertIsArray(api_get_attachments($body, 0));
2096         }
2097
2098         /**
2099          * Test the api_get_attachments() function with an img tag and an AndStatus user agent.
2100          *
2101          * @return void
2102          */
2103         public function testApiGetAttachmentsWithImageAndAndStatus()
2104         {
2105                 // $_SERVER['HTTP_USER_AGENT'] = 'AndStatus';
2106                 // $body                       = '[img]http://via.placeholder.com/1x1.png[/img]';
2107                 // self::assertIsArray(api_get_attachments($body, 0));
2108         }
2109
2110         /**
2111          * Test the api_get_entitities() function.
2112          *
2113          * @return void
2114          */
2115         public function testApiGetEntitities()
2116         {
2117                 // $text = 'text';
2118                 // self::assertIsArray(api_get_entitities($text, 'bbcode', 0));
2119         }
2120
2121         /**
2122          * Test the api_get_entitities() function with the include_entities parameter.
2123          *
2124          * @return void
2125          */
2126         public function testApiGetEntititiesWithIncludeEntities()
2127         {
2128                 /*
2129                 $_REQUEST['include_entities'] = 'true';
2130                 $text                         = 'text';
2131                 $result                       = api_get_entitities($text, 'bbcode', 0);
2132                 self::assertIsArray($result['hashtags']);
2133                 self::assertIsArray($result['symbols']);
2134                 self::assertIsArray($result['urls']);
2135                 self::assertIsArray($result['user_mentions']);
2136                 */
2137         }
2138
2139         /**
2140          * Test the api_format_items_embeded_images() function.
2141          *
2142          * @return void
2143          */
2144         public function testApiFormatItemsEmbededImages()
2145         {
2146                 /*
2147                 self::assertEquals(
2148                         'text ' . DI::baseUrl() . '/display/item_guid',
2149                         api_format_items_embeded_images(['guid' => 'item_guid'], 'text data:image/foo')
2150                 );
2151                 */
2152         }
2153
2154         /**
2155          * Test the api_format_items_activities() function.
2156          *
2157          * @return void
2158          */
2159         public function testApiFormatItemsActivities()
2160         {
2161                 $item   = ['uid' => 0, 'uri-id' => 1];
2162                 $result = DI::friendicaActivities()->createFromUriId($item['uri-id'], $item['uid']);
2163                 self::assertArrayHasKey('like', $result);
2164                 self::assertArrayHasKey('dislike', $result);
2165                 self::assertArrayHasKey('attendyes', $result);
2166                 self::assertArrayHasKey('attendno', $result);
2167                 self::assertArrayHasKey('attendmaybe', $result);
2168         }
2169
2170         /**
2171          * Test the api_format_items_activities() function with an XML result.
2172          *
2173          * @return void
2174          */
2175         public function testApiFormatItemsActivitiesWithXml()
2176         {
2177                 $item   = ['uid' => 0, 'uri-id' => 1];
2178                 $result = DI::friendicaActivities()->createFromUriId($item['uri-id'], $item['uid'], 'xml');
2179                 self::assertArrayHasKey('friendica:like', $result);
2180                 self::assertArrayHasKey('friendica:dislike', $result);
2181                 self::assertArrayHasKey('friendica:attendyes', $result);
2182                 self::assertArrayHasKey('friendica:attendno', $result);
2183                 self::assertArrayHasKey('friendica:attendmaybe', $result);
2184         }
2185
2186         /**
2187          * Test the api_format_items() function.
2188          * @doesNotPerformAssertions
2189          */
2190         public function testApiFormatItems()
2191         {
2192                 /*
2193                 $items = Post::selectToArray([], ['uid' => 42]);
2194                 foreach ($items as $item) {
2195                         $status = api_format_item($item);
2196                         self::assertStatus($status);
2197                 }
2198                 */
2199         }
2200
2201         /**
2202          * Test the api_format_items() function with an XML result.
2203          * @doesNotPerformAssertions
2204          */
2205         public function testApiFormatItemsWithXml()
2206         {
2207                 /*
2208                 $items = Post::selectToArray([], ['uid' => 42]);
2209                 foreach ($items as $item) {
2210                         $status = api_format_item($item, 'xml');
2211                         self::assertStatus($status);
2212                 }
2213                 */
2214         }
2215
2216         /**
2217          * Test the api_lists_list() function.
2218          *
2219          * @return void
2220          */
2221         public function testApiListsList()
2222         {
2223                 $result = api_lists_list('json');
2224                 self::assertEquals(['lists_list' => []], $result);
2225         }
2226
2227         /**
2228          * Test the api_lists_ownerships() function.
2229          *
2230          * @return void
2231          */
2232         public function testApiListsOwnerships()
2233         {
2234                 $result = api_lists_ownerships('json');
2235                 foreach ($result['lists']['lists'] as $list) {
2236                         self::assertList($list);
2237                 }
2238         }
2239
2240         /**
2241          * Test the api_lists_ownerships() function without an authenticated user.
2242          *
2243          * @return void
2244          */
2245         public function testApiListsOwnershipsWithoutAuthenticatedUser()
2246         {
2247                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2248                 BasicAuth::setCurrentUserID();
2249                 $_SESSION['authenticated'] = false;
2250                 api_lists_ownerships('json');
2251         }
2252
2253         /**
2254          * Test the api_lists_statuses() function.
2255          *
2256          * @return void
2257          */
2258         public function testApiListsStatuses()
2259         {
2260                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2261                 // api_lists_statuses('json');
2262         }
2263
2264         /**
2265          * Test the api_lists_statuses() function with a list ID.
2266          * @doesNotPerformAssertions
2267          */
2268         public function testApiListsStatusesWithListId()
2269         {
2270                 /*
2271                 $_REQUEST['list_id'] = 1;
2272                 $_REQUEST['page']    = -1;
2273                 $_REQUEST['max_id']  = 10;
2274                 $result              = api_lists_statuses('json');
2275                 foreach ($result['status'] as $status) {
2276                         self::assertStatus($status);
2277                 }
2278                 */
2279         }
2280
2281         /**
2282          * Test the api_lists_statuses() function with a list ID and a RSS result.
2283          *
2284          * @return void
2285          */
2286         public function testApiListsStatusesWithListIdAndRss()
2287         {
2288                 // $_REQUEST['list_id'] = 1;
2289                 // $result              = api_lists_statuses('rss');
2290                 // self::assertXml($result, 'statuses');
2291         }
2292
2293         /**
2294          * Test the api_lists_statuses() function with an unallowed user.
2295          *
2296          * @return void
2297          */
2298         public function testApiListsStatusesWithUnallowedUser()
2299         {
2300                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2301                 // BasicAuth::setCurrentUserID();
2302                 // api_lists_statuses('json');
2303         }
2304
2305         /**
2306          * Test the api_statuses_f() function.
2307          *
2308          * @return void
2309          */
2310         public function testApiStatusesFWithFriends()
2311         {
2312                 // $_GET['page'] = -1;
2313                 // $result       = api_statuses_f('friends');
2314                 // self::assertArrayHasKey('user', $result);
2315         }
2316
2317         /**
2318          * Test the api_statuses_f() function.
2319          *
2320          * @return void
2321          */
2322         public function testApiStatusesFWithFollowers()
2323         {
2324                 // $result = api_statuses_f('followers');
2325                 // self::assertArrayHasKey('user', $result);
2326         }
2327
2328         /**
2329          * Test the api_statuses_f() function.
2330          *
2331          * @return void
2332          */
2333         public function testApiStatusesFWithBlocks()
2334         {
2335                 // $result = api_statuses_f('blocks');
2336                 // self::assertArrayHasKey('user', $result);
2337         }
2338
2339         /**
2340          * Test the api_statuses_f() function.
2341          *
2342          * @return void
2343          */
2344         public function testApiStatusesFWithIncoming()
2345         {
2346                 // $result = api_statuses_f('incoming');
2347                 // self::assertArrayHasKey('user', $result);
2348         }
2349
2350         /**
2351          * Test the api_statuses_f() function an undefined cursor GET variable.
2352          *
2353          * @return void
2354          */
2355         public function testApiStatusesFWithUndefinedCursor()
2356         {
2357                 // $_GET['cursor'] = 'undefined';
2358                 // self::assertFalse(api_statuses_f('friends'));
2359         }
2360
2361         /**
2362          * Test the api_statuses_friends() function.
2363          *
2364          * @return void
2365          */
2366         public function testApiStatusesFriends()
2367         {
2368                 // $result = api_statuses_friends('json');
2369                 // self::assertArrayHasKey('user', $result);
2370         }
2371
2372         /**
2373          * Test the api_statuses_friends() function an undefined cursor GET variable.
2374          *
2375          * @return void
2376          */
2377         public function testApiStatusesFriendsWithUndefinedCursor()
2378         {
2379                 // $_GET['cursor'] = 'undefined';
2380                 // self::assertFalse(api_statuses_friends('json'));
2381         }
2382
2383         /**
2384          * Test the api_statuses_followers() function.
2385          *
2386          * @return void
2387          */
2388         public function testApiStatusesFollowers()
2389         {
2390                 // $result = api_statuses_followers('json');
2391                 // self::assertArrayHasKey('user', $result);
2392         }
2393
2394         /**
2395          * Test the api_statuses_followers() function an undefined cursor GET variable.
2396          *
2397          * @return void
2398          */
2399         public function testApiStatusesFollowersWithUndefinedCursor()
2400         {
2401                 // $_GET['cursor'] = 'undefined';
2402                 // self::assertFalse(api_statuses_followers('json'));
2403         }
2404
2405         /**
2406          * Test the api_blocks_list() function.
2407          *
2408          * @return void
2409          */
2410         public function testApiBlocksList()
2411         {
2412                 // $result = api_blocks_list('json');
2413                 // self::assertArrayHasKey('user', $result);
2414         }
2415
2416         /**
2417          * Test the api_blocks_list() function an undefined cursor GET variable.
2418          *
2419          * @return void
2420          */
2421         public function testApiBlocksListWithUndefinedCursor()
2422         {
2423                 // $_GET['cursor'] = 'undefined';
2424                 // self::assertFalse(api_blocks_list('json'));
2425         }
2426
2427         /**
2428          * Test the api_friendships_incoming() function.
2429          *
2430          * @return void
2431          */
2432         public function testApiFriendshipsIncoming()
2433         {
2434                 // $result = api_friendships_incoming('json');
2435                 // self::assertArrayHasKey('id', $result);
2436         }
2437
2438         /**
2439          * Test the api_friendships_incoming() function an undefined cursor GET variable.
2440          *
2441          * @return void
2442          */
2443         public function testApiFriendshipsIncomingWithUndefinedCursor()
2444         {
2445                 // $_GET['cursor'] = 'undefined';
2446                 // self::assertFalse(api_friendships_incoming('json'));
2447         }
2448
2449         /**
2450          * Test the api_statusnet_config() function.
2451          *
2452          * @return void
2453          */
2454         public function testApiStatusnetConfig()
2455         {
2456                 /*
2457                 $result = api_statusnet_config('json');
2458                 self::assertEquals('localhost', $result['config']['site']['server']);
2459                 self::assertEquals('default', $result['config']['site']['theme']);
2460                 self::assertEquals(DI::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']);
2461                 self::assertTrue($result['config']['site']['fancy']);
2462                 self::assertEquals('en', $result['config']['site']['language']);
2463                 self::assertEquals('UTC', $result['config']['site']['timezone']);
2464                 self::assertEquals(200000, $result['config']['site']['textlimit']);
2465                 self::assertEquals('false', $result['config']['site']['private']);
2466                 self::assertEquals('false', $result['config']['site']['ssl']);
2467                 self::assertEquals(30, $result['config']['site']['shorturllength']);
2468                 */
2469         }
2470
2471         /**
2472          * Test the api_direct_messages_new() function.
2473          *
2474          * @return void
2475          */
2476         public function testApiDirectMessagesNew()
2477         {
2478                 $result = api_direct_messages_new('json');
2479                 self::assertNull($result);
2480         }
2481
2482         /**
2483          * Test the api_direct_messages_new() function without an authenticated user.
2484          *
2485          * @return void
2486          */
2487         public function testApiDirectMessagesNewWithoutAuthenticatedUser()
2488         {
2489                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2490                 BasicAuth::setCurrentUserID();
2491                 $_SESSION['authenticated'] = false;
2492                 api_direct_messages_new('json');
2493         }
2494
2495         /**
2496          * Test the api_direct_messages_new() function with an user ID.
2497          *
2498          * @return void
2499          */
2500         public function testApiDirectMessagesNewWithUserId()
2501         {
2502                 $_POST['text']       = 'message_text';
2503                 $_REQUEST['user_id'] = $this->otherUser['id'];
2504                 $result           = api_direct_messages_new('json');
2505                 self::assertEquals(['direct_message' => ['error' => -1]], $result);
2506         }
2507
2508         /**
2509          * Test the api_direct_messages_new() function with a screen name.
2510          *
2511          * @return void
2512          */
2513         public function testApiDirectMessagesNewWithScreenName()
2514         {
2515                 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2516                 $_POST['text']       = 'message_text';
2517                 $_REQUEST['user_id'] = $this->friendUser['id'];
2518                 $result              = api_direct_messages_new('json');
2519                 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2520                 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2521                 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2522         }
2523
2524         /**
2525          * Test the api_direct_messages_new() function with a title.
2526          *
2527          * @return void
2528          */
2529         public function testApiDirectMessagesNewWithTitle()
2530         {
2531                 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2532                 $_POST['text']        = 'message_text';
2533                 $_REQUEST['user_id']  = $this->friendUser['id'];
2534                 $_REQUEST['title']    = 'message_title';
2535                 $result            = api_direct_messages_new('json');
2536                 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2537                 self::assertStringContainsString('message_title', $result['direct_message']['text']);
2538                 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2539                 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2540         }
2541
2542         /**
2543          * Test the api_direct_messages_new() function with an RSS result.
2544          *
2545          * @return void
2546          */
2547         public function testApiDirectMessagesNewWithRss()
2548         {
2549                 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2550                 $_POST['text']       = 'message_text';
2551                 $_REQUEST['user_id'] = $this->friendUser['id'];
2552                 $result              = api_direct_messages_new('rss');
2553                 self::assertXml($result, 'direct-messages');
2554         }
2555
2556         /**
2557          * Test the api_direct_messages_destroy() function.
2558          *
2559          * @return void
2560          */
2561         public function testApiDirectMessagesDestroy()
2562         {
2563                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2564                 api_direct_messages_destroy('json');
2565         }
2566
2567         /**
2568          * Test the api_direct_messages_destroy() function with the friendica_verbose GET param.
2569          *
2570          * @return void
2571          */
2572         public function testApiDirectMessagesDestroyWithVerbose()
2573         {
2574                 $_GET['friendica_verbose'] = 'true';
2575                 $result                    = api_direct_messages_destroy('json');
2576                 self::assertEquals(
2577                         [
2578                                 '$result' => [
2579                                         'result'  => 'error',
2580                                         'message' => 'message id or parenturi not specified'
2581                                 ]
2582                         ],
2583                         $result
2584                 );
2585         }
2586
2587         /**
2588          * Test the api_direct_messages_destroy() function without an authenticated user.
2589          *
2590          * @return void
2591          */
2592         public function testApiDirectMessagesDestroyWithoutAuthenticatedUser()
2593         {
2594                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2595                 BasicAuth::setCurrentUserID();
2596                 $_SESSION['authenticated'] = false;
2597                 api_direct_messages_destroy('json');
2598         }
2599
2600         /**
2601          * Test the api_direct_messages_destroy() function with a non-zero ID.
2602          *
2603          * @return void
2604          */
2605         public function testApiDirectMessagesDestroyWithId()
2606         {
2607                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2608                 $_REQUEST['id'] = 1;
2609                 api_direct_messages_destroy('json');
2610         }
2611
2612         /**
2613          * Test the api_direct_messages_destroy() with a non-zero ID and the friendica_verbose GET param.
2614          *
2615          * @return void
2616          */
2617         public function testApiDirectMessagesDestroyWithIdAndVerbose()
2618         {
2619                 $_REQUEST['id']                  = 1;
2620                 $_REQUEST['friendica_parenturi'] = 'parent_uri';
2621                 $_GET['friendica_verbose']       = 'true';
2622                 $result                          = api_direct_messages_destroy('json');
2623                 self::assertEquals(
2624                         [
2625                                 '$result' => [
2626                                         'result'  => 'error',
2627                                         'message' => 'message id not in database'
2628                                 ]
2629                         ],
2630                         $result
2631                 );
2632         }
2633
2634         /**
2635          * Test the api_direct_messages_destroy() function with a non-zero ID.
2636          *
2637          * @return void
2638          */
2639         public function testApiDirectMessagesDestroyWithCorrectId()
2640         {
2641                 $this->markTestIncomplete('We need to add a dataset for this.');
2642         }
2643
2644         /**
2645          * Test the api_direct_messages_box() function.
2646          *
2647          * @return void
2648          */
2649         public function testApiDirectMessagesBoxWithSentbox()
2650         {
2651                 $_REQUEST['page']   = -1;
2652                 $_REQUEST['max_id'] = 10;
2653                 $result             = api_direct_messages_box('json', 'sentbox', 'false');
2654                 self::assertArrayHasKey('direct_message', $result);
2655         }
2656
2657         /**
2658          * Test the api_direct_messages_box() function.
2659          *
2660          * @return void
2661          */
2662         public function testApiDirectMessagesBoxWithConversation()
2663         {
2664                 $result = api_direct_messages_box('json', 'conversation', 'false');
2665                 self::assertArrayHasKey('direct_message', $result);
2666         }
2667
2668         /**
2669          * Test the api_direct_messages_box() function.
2670          *
2671          * @return void
2672          */
2673         public function testApiDirectMessagesBoxWithAll()
2674         {
2675                 $result = api_direct_messages_box('json', 'all', 'false');
2676                 self::assertArrayHasKey('direct_message', $result);
2677         }
2678
2679         /**
2680          * Test the api_direct_messages_box() function.
2681          *
2682          * @return void
2683          */
2684         public function testApiDirectMessagesBoxWithInbox()
2685         {
2686                 $result = api_direct_messages_box('json', 'inbox', 'false');
2687                 self::assertArrayHasKey('direct_message', $result);
2688         }
2689
2690         /**
2691          * Test the api_direct_messages_box() function.
2692          *
2693          * @return void
2694          */
2695         public function testApiDirectMessagesBoxWithVerbose()
2696         {
2697                 $result = api_direct_messages_box('json', 'sentbox', 'true');
2698                 self::assertEquals(
2699                         [
2700                                 '$result' => [
2701                                         'result'  => 'error',
2702                                         'message' => 'no mails available'
2703                                 ]
2704                         ],
2705                         $result
2706                 );
2707         }
2708
2709         /**
2710          * Test the api_direct_messages_box() function with a RSS result.
2711          *
2712          * @return void
2713          */
2714         public function testApiDirectMessagesBoxWithRss()
2715         {
2716                 $result = api_direct_messages_box('rss', 'sentbox', 'false');
2717                 self::assertXml($result, 'direct-messages');
2718         }
2719
2720         /**
2721          * Test the api_direct_messages_box() function without an authenticated user.
2722          *
2723          * @return void
2724          */
2725         public function testApiDirectMessagesBoxWithUnallowedUser()
2726         {
2727                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2728                 BasicAuth::setCurrentUserID();
2729                 api_direct_messages_box('json', 'sentbox', 'false');
2730         }
2731
2732         /**
2733          * Test the api_direct_messages_sentbox() function.
2734          *
2735          * @return void
2736          */
2737         public function testApiDirectMessagesSentbox()
2738         {
2739                 $result = api_direct_messages_sentbox('json');
2740                 self::assertArrayHasKey('direct_message', $result);
2741         }
2742
2743         /**
2744          * Test the api_direct_messages_inbox() function.
2745          *
2746          * @return void
2747          */
2748         public function testApiDirectMessagesInbox()
2749         {
2750                 $result = api_direct_messages_inbox('json');
2751                 self::assertArrayHasKey('direct_message', $result);
2752         }
2753
2754         /**
2755          * Test the api_direct_messages_all() function.
2756          *
2757          * @return void
2758          */
2759         public function testApiDirectMessagesAll()
2760         {
2761                 $result = api_direct_messages_all('json');
2762                 self::assertArrayHasKey('direct_message', $result);
2763         }
2764
2765         /**
2766          * Test the api_direct_messages_conversation() function.
2767          *
2768          * @return void
2769          */
2770         public function testApiDirectMessagesConversation()
2771         {
2772                 $result = api_direct_messages_conversation('json');
2773                 self::assertArrayHasKey('direct_message', $result);
2774         }
2775
2776         /**
2777          * Test the api_oauth_request_token() function.
2778          *
2779          * @return void
2780          */
2781         public function testApiOauthRequestToken()
2782         {
2783                 $this->markTestIncomplete('exit() kills phpunit as well');
2784         }
2785
2786         /**
2787          * Test the api_oauth_access_token() function.
2788          *
2789          * @return void
2790          */
2791         public function testApiOauthAccessToken()
2792         {
2793                 $this->markTestIncomplete('exit() kills phpunit as well');
2794         }
2795
2796         /**
2797          * Test the api_fr_photos_list() function.
2798          *
2799          * @return void
2800          */
2801         public function testApiFrPhotosList()
2802         {
2803                 $result = api_fr_photos_list('json');
2804                 self::assertArrayHasKey('photo', $result);
2805         }
2806
2807         /**
2808          * Test the api_fr_photos_list() function without an authenticated user.
2809          *
2810          * @return void
2811          */
2812         public function testApiFrPhotosListWithoutAuthenticatedUser()
2813         {
2814                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2815                 BasicAuth::setCurrentUserID();
2816                 $_SESSION['authenticated'] = false;
2817                 api_fr_photos_list('json');
2818         }
2819
2820         /**
2821          * Test the api_fr_photo_create_update() function.
2822          */
2823         public function testApiFrPhotoCreateUpdate()
2824         {
2825                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2826                 api_fr_photo_create_update('json');
2827         }
2828
2829         /**
2830          * Test the api_fr_photo_create_update() function without an authenticated user.
2831          *
2832          * @return void
2833          */
2834         public function testApiFrPhotoCreateUpdateWithoutAuthenticatedUser()
2835         {
2836                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2837                 BasicAuth::setCurrentUserID();
2838                 $_SESSION['authenticated'] = false;
2839                 api_fr_photo_create_update('json');
2840         }
2841
2842         /**
2843          * Test the api_fr_photo_create_update() function with an album name.
2844          *
2845          * @return void
2846          */
2847         public function testApiFrPhotoCreateUpdateWithAlbum()
2848         {
2849                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2850                 $_REQUEST['album'] = 'album_name';
2851                 api_fr_photo_create_update('json');
2852         }
2853
2854         /**
2855          * Test the api_fr_photo_create_update() function with the update mode.
2856          *
2857          * @return void
2858          */
2859         public function testApiFrPhotoCreateUpdateWithUpdate()
2860         {
2861                 $this->markTestIncomplete('We need to create a dataset for this');
2862         }
2863
2864         /**
2865          * Test the api_fr_photo_create_update() function with an uploaded file.
2866          *
2867          * @return void
2868          */
2869         public function testApiFrPhotoCreateUpdateWithFile()
2870         {
2871                 $this->markTestIncomplete();
2872         }
2873
2874         /**
2875          * Test the api_fr_photo_detail() function.
2876          *
2877          * @return void
2878          */
2879         public function testApiFrPhotoDetail()
2880         {
2881                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2882                 api_fr_photo_detail('json');
2883         }
2884
2885         /**
2886          * Test the api_fr_photo_detail() function without an authenticated user.
2887          *
2888          * @return void
2889          */
2890         public function testApiFrPhotoDetailWithoutAuthenticatedUser()
2891         {
2892                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2893                 BasicAuth::setCurrentUserID();
2894                 $_SESSION['authenticated'] = false;
2895                 api_fr_photo_detail('json');
2896         }
2897
2898         /**
2899          * Test the api_fr_photo_detail() function with a photo ID.
2900          *
2901          * @return void
2902          */
2903         public function testApiFrPhotoDetailWithPhotoId()
2904         {
2905                 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
2906                 $_REQUEST['photo_id'] = 1;
2907                 api_fr_photo_detail('json');
2908         }
2909
2910         /**
2911          * Test the api_fr_photo_detail() function with a correct photo ID.
2912          *
2913          * @return void
2914          */
2915         public function testApiFrPhotoDetailCorrectPhotoId()
2916         {
2917                 $this->markTestIncomplete('We need to create a dataset for this.');
2918         }
2919
2920         /**
2921          * Test the api_account_update_profile_image() function.
2922          *
2923          * @return void
2924          */
2925         public function testApiAccountUpdateProfileImage()
2926         {
2927                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2928                 api_account_update_profile_image('json');
2929         }
2930
2931         /**
2932          * Test the api_account_update_profile_image() function without an authenticated user.
2933          *
2934          * @return void
2935          */
2936         public function testApiAccountUpdateProfileImageWithoutAuthenticatedUser()
2937         {
2938                 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2939                 BasicAuth::setCurrentUserID();
2940                 $_SESSION['authenticated'] = false;
2941                 api_account_update_profile_image('json');
2942         }
2943
2944         /**
2945          * Test the api_account_update_profile_image() function with an uploaded file.
2946          *
2947          * @return void
2948          */
2949         public function testApiAccountUpdateProfileImageWithUpload()
2950         {
2951                 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2952                 $this->markTestIncomplete();
2953         }
2954
2955
2956         /**
2957          * Test the api_account_update_profile() function.
2958          *
2959          * @return void
2960          */
2961         public function testApiAccountUpdateProfile()
2962         {
2963                 /*
2964                 $_POST['name']        = 'new_name';
2965                 $_POST['description'] = 'new_description';
2966                 $result               = api_account_update_profile('json');
2967                 // We can't use assertSelfUser() here because the user object is missing some properties.
2968                 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
2969                 self::assertEquals('DFRN', $result['user']['location']);
2970                 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
2971                 self::assertEquals('new_name', $result['user']['name']);
2972                 self::assertEquals('new_description', $result['user']['description']);
2973                 */
2974         }
2975
2976         /**
2977          * Test the check_acl_input() function.
2978          *
2979          * @return void
2980          */
2981         public function testCheckAclInput()
2982         {
2983                 $result = check_acl_input('<aclstring>', BaseApi::getCurrentUserID());
2984                 // Where does this result come from?
2985                 self::assertEquals(1, $result);
2986         }
2987
2988         /**
2989          * Test the check_acl_input() function with an empty ACL string.
2990          *
2991          * @return void
2992          */
2993         public function testCheckAclInputWithEmptyAclString()
2994         {
2995                 $result = check_acl_input(' ', BaseApi::getCurrentUserID());
2996                 self::assertFalse($result);
2997         }
2998
2999         /**
3000          * Test the save_media_to_database() function.
3001          *
3002          * @return void
3003          */
3004         public function testSaveMediaToDatabase()
3005         {
3006                 $this->markTestIncomplete();
3007         }
3008
3009         /**
3010          * Test the post_photo_item() function.
3011          *
3012          * @return void
3013          */
3014         public function testPostPhotoItem()
3015         {
3016                 $this->markTestIncomplete();
3017         }
3018
3019         /**
3020          * Test the prepare_photo_data() function.
3021          *
3022          * @return void
3023          */
3024         public function testPreparePhotoData()
3025         {
3026                 $this->markTestIncomplete();
3027         }
3028
3029         /**
3030          * Test the api_share_as_retweet() function with a valid item.
3031          *
3032          * @return void
3033          */
3034         public function testApiShareAsRetweetWithValidItem()
3035         {
3036                 $this->markTestIncomplete();
3037         }
3038
3039         /**
3040          * Test the api_in_reply_to() function with a valid item.
3041          *
3042          * @return void
3043          */
3044         public function testApiInReplyToWithValidItem()
3045         {
3046                 $this->markTestIncomplete();
3047         }
3048
3049         /**
3050          * Test the api_clean_plain_items() function.
3051          *
3052          * @return void
3053          */
3054         public function testApiCleanPlainItems()
3055         {
3056                 $_REQUEST['include_entities'] = 'true';
3057                 $result                       = api_clean_plain_items('some_text [url="some_url"]some_text[/url]');
3058                 self::assertEquals('some_text [url="some_url"]"some_url"[/url]', $result);
3059         }
3060
3061         /**
3062          * Test the api_best_nickname() function with contacts.
3063          *
3064          * @return void
3065          */
3066         public function testApiBestNicknameWithContacts()
3067         {
3068                 $this->markTestIncomplete();
3069         }
3070
3071         /**
3072          * Test the api_friendica_group_show() function.
3073          *
3074          * @return void
3075          */
3076         public function testApiFriendicaGroupShow()
3077         {
3078                 $this->markTestIncomplete();
3079         }
3080
3081         /**
3082          * Test the api_friendica_group_delete() function.
3083          *
3084          * @return void
3085          */
3086         public function testApiFriendicaGroupDelete()
3087         {
3088                 $this->markTestIncomplete();
3089         }
3090
3091         /**
3092          * Test the api_lists_destroy() function.
3093          *
3094          * @return void
3095          */
3096         public function testApiListsDestroy()
3097         {
3098                 $this->markTestIncomplete();
3099         }
3100
3101         /**
3102          * Test the group_create() function.
3103          *
3104          * @return void
3105          */
3106         public function testGroupCreate()
3107         {
3108                 $this->markTestIncomplete();
3109         }
3110
3111         /**
3112          * Test the api_friendica_group_create() function.
3113          *
3114          * @return void
3115          */
3116         public function testApiFriendicaGroupCreate()
3117         {
3118                 $this->markTestIncomplete();
3119         }
3120
3121         /**
3122          * Test the api_lists_create() function.
3123          *
3124          * @return void
3125          */
3126         public function testApiListsCreate()
3127         {
3128                 $this->markTestIncomplete();
3129         }
3130
3131         /**
3132          * Test the api_friendica_group_update() function.
3133          *
3134          * @return void
3135          */
3136         public function testApiFriendicaGroupUpdate()
3137         {
3138                 $this->markTestIncomplete();
3139         }
3140
3141         /**
3142          * Test the api_lists_update() function.
3143          *
3144          * @return void
3145          */
3146         public function testApiListsUpdate()
3147         {
3148                 $this->markTestIncomplete();
3149         }
3150
3151         /**
3152          * Test the api_friendica_activity() function.
3153          *
3154          * @return void
3155          */
3156         public function testApiFriendicaActivity()
3157         {
3158                 $this->markTestIncomplete();
3159         }
3160
3161         /**
3162          * Test the api_friendica_notification_seen() function.
3163          *
3164          * @return void
3165          */
3166         public function testApiFriendicaNotificationSeen()
3167         {
3168                 $this->markTestIncomplete();
3169         }
3170
3171         /**
3172          * Test the api_friendica_direct_messages_setseen() function.
3173          *
3174          * @return void
3175          */
3176         public function testApiFriendicaDirectMessagesSetseen()
3177         {
3178                 $this->markTestIncomplete();
3179         }
3180
3181         /**
3182          * Test the api_friendica_direct_messages_search() function.
3183          *
3184          * @return void
3185          */
3186         public function testApiFriendicaDirectMessagesSearch()
3187         {
3188                 $this->markTestIncomplete();
3189         }
3190 }