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