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