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