6 namespace Friendica\Test\legacy;
9 use Friendica\Core\Config\Capability\IManageConfigValues;
10 use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
11 use Friendica\Core\Protocol;
13 use Friendica\Module\Api\ApiResponse;
14 use Friendica\Module\BaseApi;
15 use Friendica\Network\HTTPException;
16 use Friendica\Security\BasicAuth;
17 use Friendica\Test\FixtureTest;
18 use Friendica\Util\Arrays;
19 use Friendica\Util\DateTimeFormat;
20 use Friendica\Util\Temporal;
21 use Monolog\Handler\TestHandler;
23 require_once __DIR__ . '/../../include/api.php';
26 * Tests for the API functions.
28 * Functions that use header() need to be tested in a separate process.
29 * @see https://phpunit.de/manual/5.7/en/appendixes.annotations.html#appendixes.annotations.runTestsInSeparateProcesses
31 * @backupGlobals enabled
33 class ApiTest extends FixtureTest
36 * @var TestHandler Can handle log-outputs
43 protected $friendUser;
47 protected $wrongUserId;
52 /** @var IManageConfigValues */
56 * Create variables used by tests.
58 protected function setUp() : void
60 global $API, $called_api;
66 /** @var IManageConfigValues $config */
67 $this->config = $this->dice->create(IManageConfigValues::class);
69 $this->config->set('system', 'url', 'http://localhost');
70 $this->config->set('system', 'hostname', 'localhost');
71 $this->config->set('system', 'worker_dont_fork', true);
74 $this->config->set('config', 'hostname', 'localhost');
75 $this->config->set('system', 'throttle_limit_day', 100);
76 $this->config->set('system', 'throttle_limit_week', 100);
77 $this->config->set('system', 'throttle_limit_month', 100);
78 $this->config->set('system', 'theme', 'system_theme');
82 $this->app = DI::app();
84 DI::args()->setArgc(1);
86 // User data that the test database is populated with
89 'name' => 'Self contact',
90 'nick' => 'selfcontact',
91 'nurl' => 'http://localhost/profile/selfcontact'
95 'name' => 'Friend contact',
96 'nick' => 'friendcontact',
97 'nurl' => 'http://localhost/profile/friendcontact'
101 'name' => 'othercontact',
102 'nick' => 'othercontact',
103 'nurl' => 'http://localhost/profile/othercontact'
106 // User ID that we know is not in the database
107 $this->wrongUserId = 666;
109 DI::session()->start();
111 // Most API require login so we force the session
113 'authenticated' => true,
114 'uid' => $this->selfUser['id']
116 BasicAuth::setCurrentUserID($this->selfUser['id']);
120 * Assert that an user array contains expected keys.
122 * @param array $user User array
126 private function assertSelfUser(array $user)
128 self::assertEquals($this->selfUser['id'], $user['uid']);
129 self::assertEquals($this->selfUser['id'], $user['cid']);
130 self::assertEquals(1, $user['self']);
131 self::assertEquals('DFRN', $user['location']);
132 self::assertEquals($this->selfUser['name'], $user['name']);
133 self::assertEquals($this->selfUser['nick'], $user['screen_name']);
134 self::assertEquals('dfrn', $user['network']);
135 self::assertTrue($user['verified']);
139 * Assert that an user array contains expected keys.
141 * @param array $user User array
145 private function assertOtherUser(array $user = [])
147 self::assertEquals($this->otherUser['id'], $user['id']);
148 self::assertEquals($this->otherUser['id'], $user['id_str']);
149 self::assertEquals(0, $user['self']);
150 self::assertEquals($this->otherUser['name'], $user['name']);
151 self::assertEquals($this->otherUser['nick'], $user['screen_name']);
152 self::assertFalse($user['verified']);
156 * Assert that a status array contains expected keys.
158 * @param array $status Status array
162 private function assertStatus(array $status = [])
164 self::assertIsString($status['text'] ?? '');
165 self::assertIsInt($status['id'] ?? '');
166 // We could probably do more checks here.
170 * Assert that a list array contains expected keys.
172 * @param array $list List array
176 private function assertList(array $list = [])
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.
186 * Assert that the string is XML and contain the root element.
188 * @param string $result XML string
189 * @param string $root_element Root element name
193 private function assertXml($result = '', $root_element = '')
195 self::assertStringStartsWith('<?xml version="1.0"?>', $result);
196 self::assertStringContainsString('<' . $root_element, $result);
197 // We could probably do more checks here.
201 * Get the path to a temporary empty PNG image.
203 * @return string Path
205 private function getTempImage()
207 $tmpFile = tempnam(sys_get_temp_dir(), 'tmp_file');
211 // Empty 1x1 px PNG image
212 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=='
220 * Test the api_user() function.
224 public function testApiUser()
226 self::assertEquals($this->selfUser['id'], BaseApi::getCurrentUserID());
230 * Test the api_user() function with an unallowed user.
234 public function testApiUserWithUnallowedUser()
236 // self::assertEquals(false, api_user());
240 * Test the api_source() function.
244 public function testApiSource()
246 self::assertEquals('api', api_source());
250 * Test the api_source() function with a Twidere user agent.
254 public function testApiSourceWithTwidere()
256 $_SERVER['HTTP_USER_AGENT'] = 'Twidere';
257 self::assertEquals('Twidere', api_source());
261 * Test the api_source() function with a GET parameter.
265 public function testApiSourceWithGet()
267 $_GET['source'] = 'source_name';
268 self::assertEquals('source_name', api_source());
272 * Test the api_date() function.
276 public function testApiDate()
278 self::assertEquals('Wed Oct 10 00:00:00 +0000 1990', DateTimeFormat::utc('1990-10-10', DateTimeFormat::API));
282 * Test the api_register_func() function.
286 public function testApiRegisterFunc()
298 self::assertTrue($API['api_path']['auth']);
299 self::assertEquals('method', $API['api_path']['method']);
300 self::assertTrue(is_callable($API['api_path']['func']));
304 * Test the BasicAuth::getCurrentUserID() function without any login.
306 * @runInSeparateProcess
307 * @preserveGlobalState disabled
308 * @preserveGlobalState disabled
310 public function testApiLoginWithoutLogin()
312 BasicAuth::setCurrentUserID();
313 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
314 BasicAuth::getCurrentUserID(true);
318 * Test the BasicAuth::getCurrentUserID() function with a bad login.
320 * @runInSeparateProcess
321 * @preserveGlobalState disabled
322 * @preserveGlobalState disabled
324 public function testApiLoginWithBadLogin()
326 BasicAuth::setCurrentUserID();
327 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
328 $_SERVER['PHP_AUTH_USER'] = 'user@server';
329 BasicAuth::getCurrentUserID(true);
333 * Test the BasicAuth::getCurrentUserID() function with oAuth.
337 public function testApiLoginWithOauth()
339 $this->markTestIncomplete('Can we test this easily?');
343 * Test the BasicAuth::getCurrentUserID() function with authentication provided by an addon.
347 public function testApiLoginWithAddonAuth()
349 $this->markTestIncomplete('Can we test this easily?');
353 * Test the BasicAuth::getCurrentUserID() function with a correct login.
355 * @runInSeparateProcess
356 * @preserveGlobalState disabled
357 * @doesNotPerformAssertions
359 public function testApiLoginWithCorrectLogin()
361 BasicAuth::setCurrentUserID();
362 $_SERVER['PHP_AUTH_USER'] = 'Test user';
363 $_SERVER['PHP_AUTH_PW'] = 'password';
364 BasicAuth::getCurrentUserID(true);
368 * Test the BasicAuth::getCurrentUserID() function with a remote user.
370 * @runInSeparateProcess
371 * @preserveGlobalState disabled
373 public function testApiLoginWithRemoteUser()
375 BasicAuth::setCurrentUserID();
376 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
377 $_SERVER['REDIRECT_REMOTE_USER'] = '123456dXNlcjpwYXNzd29yZA==';
378 BasicAuth::getCurrentUserID(true);
382 * Test the api_call() function.
384 * @runInSeparateProcess
385 * @preserveGlobalState disabled
387 public function testApiCall()
391 'method' => 'method',
392 'func' => function () {
393 return ['data' => ['some_data']];
396 $_SERVER['REQUEST_METHOD'] = 'method';
397 $_SERVER['QUERY_STRING'] = 'pagename=api_path';
398 $_GET['callback'] = 'callback_name';
400 $args = DI::args()->determine($_SERVER, $_GET);
403 'callback_name(["some_data"])',
404 api_call($this->app, $args)
409 * Test the api_call() function with the profiled enabled.
411 * @runInSeparateProcess
412 * @preserveGlobalState disabled
414 public function testApiCallWithProfiler()
418 'method' => 'method',
419 'func' => function () {
420 return ['data' => ['some_data']];
424 $_SERVER['REQUEST_METHOD'] = 'method';
425 $_SERVER['QUERY_STRING'] = 'pagename=api_path';
427 $args = DI::args()->determine($_SERVER, $_GET);
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]
441 api_call($this->app, $args)
446 * Test the api_call() function with a JSON result.
448 * @runInSeparateProcess
449 * @preserveGlobalState disabled
451 public function testApiCallWithJson()
455 'method' => 'method',
456 'func' => function () {
457 return ['data' => ['some_data']];
460 $_SERVER['REQUEST_METHOD'] = 'method';
461 $_SERVER['QUERY_STRING'] = 'pagename=api_path.json';
463 $args = DI::args()->determine($_SERVER, $_GET);
467 api_call($this->app, $args)
472 * Test the api_call() function with an XML result.
474 * @runInSeparateProcess
475 * @preserveGlobalState disabled
477 public function testApiCallWithXml()
481 'method' => 'method',
482 'func' => function () {
486 $_SERVER['REQUEST_METHOD'] = 'method';
487 $_SERVER['QUERY_STRING'] = 'pagename=api_path.xml';
489 $args = DI::args()->determine($_SERVER, $_GET);
493 api_call($this->app, $args)
498 * Test the api_call() function with an RSS result.
500 * @runInSeparateProcess
501 * @preserveGlobalState disabled
503 public function testApiCallWithRss()
507 'method' => 'method',
508 'func' => function () {
512 $_SERVER['REQUEST_METHOD'] = 'method';
513 $_SERVER['QUERY_STRING'] = 'pagename=api_path.rss';
515 $args = DI::args()->determine($_SERVER, $_GET);
518 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
520 api_call($this->app, $args)
525 * Test the api_call() function with an Atom result.
527 * @runInSeparateProcess
528 * @preserveGlobalState disabled
530 public function testApiCallWithAtom()
534 'method' => 'method',
535 'func' => function () {
539 $_SERVER['REQUEST_METHOD'] = 'method';
540 $_SERVER['QUERY_STRING'] = 'pagename=api_path.atom';
542 $args = DI::args()->determine($_SERVER, $_GET);
545 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
547 api_call($this->app, $args)
552 * Test the api_rss_extra() function.
556 public function testApiRssExtra()
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']);
573 * Test the api_rss_extra() function without any user info.
577 public function testApiRssExtraWithoutUserInfo()
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']);
593 * Test the api_get_user() function.
597 public function testApiGetUser()
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']);
607 * Test the api_get_user() function with a Frio schema.
611 public function testApiGetUserWithFrioSchema()
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']);
623 * Test the api_get_user() function with an empty Frio schema.
627 public function testApiGetUserWithEmptyFrioSchema()
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']);
639 * Test the api_get_user() function with a custom Frio schema.
643 public function testApiGetUserWithCustomFrioSchema()
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']);
658 * Test the api_get_user() function with an user that is not allowed to use the API.
660 * @runInSeparateProcess
661 * @preserveGlobalState disabled
663 public function testApiGetUserWithoutApiUser()
665 // api_get_user() with empty parameters is not used anymore
667 $_SERVER['PHP_AUTH_USER'] = 'Test user';
668 $_SERVER['PHP_AUTH_PW'] = 'password';
669 BasicAuth::setCurrentUserID();
670 self::assertFalse(api_get_user());
675 * Test the api_get_user() function with an user ID in a GET parameter.
679 public function testApiGetUserWithGetId()
681 // self::assertOtherUser(api_get_user());
685 * Test the api_get_user() function with a wrong user ID in a GET parameter.
689 public function testApiGetUserWithWrongGetId()
691 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
692 // self::assertOtherUser(api_get_user());
696 * Test the api_get_user() function with an user name in a GET parameter.
700 public function testApiGetUserWithGetName()
702 // self::assertSelfUser(api_get_user());
706 * Test the api_get_user() function with a profile URL in a GET parameter.
710 public function testApiGetUserWithGetUrl()
712 // self::assertSelfUser(api_get_user());
716 * Test the api_get_user() function with an user ID in the API path.
720 public function testApiGetUserWithNumericCalledApi()
722 // global $called_api;
723 // $called_api = ['api_path'];
724 // DI::args()->setArgv(['', $this->otherUser['id'] . '.json']);
725 // self::assertOtherUser(api_get_user());
729 * Test the api_get_user() function with the $called_api global variable.
733 public function testApiGetUserWithCalledApi()
735 // global $called_api;
736 // $called_api = ['api', 'api_path'];
737 // self::assertSelfUser(api_get_user());
741 * Test the api_get_user() function with a 0 user ID.
745 public function testApiGetUserWithZeroUser()
747 self::assertSelfUser(DI::twitterUser()->createFromUserId(BaseApi::getCurrentUserID())->toArray());
751 * Test the Arrays::walkRecursive() function.
755 public function testApiWalkRecursive()
760 Arrays::walkRecursive(
763 // Should we test this with a callback that actually does something?
771 * Test the Arrays::walkRecursive() function with an array.
775 public function testApiWalkRecursiveWithArray()
777 $array = [['item1'], ['item2']];
780 Arrays::walkRecursive(
783 // Should we test this with a callback that actually does something?
791 * Test the BaseApi::reformatXML() function.
795 public function testApiReformatXml()
799 self::assertTrue(ApiResponse::reformatXML($item, $key));
800 self::assertEquals('true', $item);
804 * Test the BaseApi::reformatXML() function with a statusnet_api key.
808 public function testApiReformatXmlWithStatusnetKey()
811 $key = 'statusnet_api';
812 self::assertTrue(ApiResponse::reformatXML($item, $key));
813 self::assertEquals('statusnet:api', $key);
817 * Test the BaseApi::reformatXML() function with a friendica_api key.
821 public function testApiReformatXmlWithFriendicaKey()
824 $key = 'friendica_api';
825 self::assertTrue(ApiResponse::reformatXML($item, $key));
826 self::assertEquals('friendica:api', $key);
830 * Test the BaseApi::createXML() function.
834 public function testApiCreateXml()
837 '<?xml version="1.0"?>' . "\n" .
838 '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
839 'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
840 'xmlns:georss="http://www.georss.org/georss">' . "\n" .
841 ' <data>some_data</data>' . "\n" .
842 '</root_element>' . "\n",
843 DI::apiResponse()->createXML(['data' => ['some_data']], 'root_element')
848 * Test the BaseApi::createXML() function without any XML namespace.
852 public function testApiCreateXmlWithoutNamespaces()
855 '<?xml version="1.0"?>' . "\n" .
857 ' <data>some_data</data>' . "\n" .
859 DI::apiResponse()->createXML(['data' => ['some_data']], 'ok')
864 * Test the BaseApi::formatData() function.
868 public function testApiFormatData()
870 $data = ['some_data'];
871 self::assertEquals($data, DI::apiResponse()->formatData('root_element', 'json', $data));
875 * Test the BaseApi::formatData() function with an XML result.
879 public function testApiFormatDataWithXml()
882 '<?xml version="1.0"?>' . "\n" .
883 '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
884 'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
885 'xmlns:georss="http://www.georss.org/georss">' . "\n" .
886 ' <data>some_data</data>' . "\n" .
887 '</root_element>' . "\n",
888 DI::apiResponse()->formatData('root_element', 'xml', ['data' => ['some_data']])
893 * Test the api_account_verify_credentials() function.
897 public function testApiAccountVerifyCredentials()
899 self::assertArrayHasKey('user', api_account_verify_credentials('json'));
903 * Test the api_account_verify_credentials() function without an authenticated user.
907 public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
909 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
910 BasicAuth::setCurrentUserID();
911 $_SESSION['authenticated'] = false;
912 api_account_verify_credentials('json');
916 * Test the requestdata() function.
920 public function testRequestdata()
922 self::assertNull(requestdata('variable_name'));
926 * Test the requestdata() function with a POST parameter.
930 public function testRequestdataWithPost()
932 $_POST['variable_name'] = 'variable_value';
933 self::assertEquals('variable_value', requestdata('variable_name'));
937 * Test the requestdata() function with a GET parameter.
941 public function testRequestdataWithGet()
943 $_GET['variable_name'] = 'variable_value';
944 self::assertEquals('variable_value', requestdata('variable_name'));
948 * Test the api_statuses_mediap() function.
952 public function testApiStatusesMediap()
954 DI::args()->setArgc(2);
962 'tmp_name' => $this->getTempImage(),
963 'name' => 'spacer.png',
964 'type' => 'image/png'
967 $_GET['status'] = '<b>Status content</b>';
969 $result = api_statuses_mediap('json');
970 self::assertStatus($result['status']);
974 * Test the api_statuses_mediap() function without an authenticated user.
978 public function testApiStatusesMediapWithoutAuthenticatedUser()
980 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
981 BasicAuth::setCurrentUserID();
982 $_SESSION['authenticated'] = false;
983 api_statuses_mediap('json');
987 * Test the api_statuses_update() function.
991 public function testApiStatusesUpdate()
993 $_GET['status'] = 'Status content #friendica';
994 $_GET['in_reply_to_status_id'] = -1;
1003 'tmp_name' => $this->getTempImage(),
1004 'name' => 'spacer.png',
1005 'type' => 'image/png'
1009 $result = api_statuses_update('json');
1010 self::assertStatus($result['status']);
1014 * Test the api_statuses_update() function with an HTML status.
1018 public function testApiStatusesUpdateWithHtml()
1020 $_GET['htmlstatus'] = '<b>Status content</b>';
1022 $result = api_statuses_update('json');
1023 self::assertStatus($result['status']);
1027 * Test the api_statuses_update() function without an authenticated user.
1031 public function testApiStatusesUpdateWithoutAuthenticatedUser()
1033 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1034 BasicAuth::setCurrentUserID();
1035 $_SESSION['authenticated'] = false;
1036 api_statuses_update('json');
1040 * Test the api_statuses_update() function with a parent status.
1044 public function testApiStatusesUpdateWithParent()
1046 $this->markTestIncomplete('This triggers an exit() somewhere and kills PHPUnit.');
1050 * Test the api_statuses_update() function with a media_ids parameter.
1054 public function testApiStatusesUpdateWithMediaIds()
1056 $this->markTestIncomplete();
1060 * Test the api_statuses_update() function with the throttle limit reached.
1064 public function testApiStatusesUpdateWithDayThrottleReached()
1066 $this->markTestIncomplete();
1070 * Test the api_media_upload() function.
1071 * @runInSeparateProcess
1072 * @preserveGlobalState disabled
1074 public function testApiMediaUpload()
1076 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1081 * Test the api_media_upload() function without an authenticated user.
1085 public function testApiMediaUploadWithoutAuthenticatedUser()
1087 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1088 BasicAuth::setCurrentUserID();
1089 $_SESSION['authenticated'] = false;
1094 * Test the api_media_upload() function with an invalid uploaded media.
1098 public function testApiMediaUploadWithMedia()
1100 $this->expectException(\Friendica\Network\HTTPException\InternalServerErrorException::class);
1104 'tmp_name' => 'tmp_name'
1111 * Test the api_media_upload() function with an valid uploaded media.
1115 public function testApiMediaUploadWithValidMedia()
1123 'tmp_name' => $this->getTempImage(),
1124 'name' => 'spacer.png',
1125 'type' => 'image/png'
1129 DI::args()->setArgc(2);
1131 $result = api_media_upload();
1132 self::assertEquals('image/png', $result['media']['image']['image_type']);
1133 self::assertEquals(1, $result['media']['image']['w']);
1134 self::assertEquals(1, $result['media']['image']['h']);
1135 self::assertNotEmpty($result['media']['image']['friendica_preview_url']);
1139 * Test the api_status_show() function.
1141 public function testApiStatusShowWithJson()
1143 $result = api_status_show('json', 1);
1144 self::assertStatus($result['status']);
1148 * Test the api_status_show() function with an XML result.
1150 public function testApiStatusShowWithXml()
1152 $result = api_status_show('xml', 1);
1153 self::assertXml($result, 'statuses');
1157 * Test the api_get_last_status() function
1159 public function testApiGetLastStatus()
1161 $item = api_get_last_status($this->selfUser['id'], $this->selfUser['id']);
1163 self::assertNotNull($item);
1167 * Test the api_users_show() function.
1171 public function testApiUsersShow()
1173 $result = api_users_show('json');
1174 // We can't use assertSelfUser() here because the user object is missing some properties.
1175 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
1176 self::assertEquals('DFRN', $result['user']['location']);
1177 self::assertEquals($this->selfUser['name'], $result['user']['name']);
1178 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
1179 self::assertEquals('dfrn', $result['user']['network']);
1180 self::assertTrue($result['user']['verified']);
1184 * Test the api_users_show() function with an XML result.
1188 public function testApiUsersShowWithXml()
1190 $result = api_users_show('xml');
1191 self::assertXml($result, 'statuses');
1195 * Test the api_users_search() function.
1199 public function testApiUsersSearch()
1201 $_GET['q'] = 'othercontact';
1202 $result = api_users_search('json');
1203 self::assertOtherUser($result['users'][0]);
1207 * Test the api_users_search() function with an XML result.
1211 public function testApiUsersSearchWithXml()
1213 $_GET['q'] = 'othercontact';
1214 $result = api_users_search('xml');
1215 self::assertXml($result, 'users');
1219 * Test the api_users_search() function without a GET q parameter.
1223 public function testApiUsersSearchWithoutQuery()
1225 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1226 api_users_search('json');
1230 * Test the api_users_lookup() function.
1234 public function testApiUsersLookup()
1236 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
1237 api_users_lookup('json');
1241 * Test the api_users_lookup() function with an user ID.
1245 public function testApiUsersLookupWithUserId()
1247 $_REQUEST['user_id'] = $this->otherUser['id'];
1248 $result = api_users_lookup('json');
1249 self::assertOtherUser($result['users'][0]);
1253 * Test the api_search() function.
1257 public function testApiSearch()
1259 $_REQUEST['q'] = 'reply';
1260 $_REQUEST['max_id'] = 10;
1261 $result = api_search('json');
1262 foreach ($result['status'] as $status) {
1263 self::assertStatus($status);
1264 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1269 * Test the api_search() function a count parameter.
1273 public function testApiSearchWithCount()
1275 $_REQUEST['q'] = 'reply';
1276 $_REQUEST['count'] = 20;
1277 $result = api_search('json');
1278 foreach ($result['status'] as $status) {
1279 self::assertStatus($status);
1280 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1285 * Test the api_search() function with an rpp parameter.
1289 public function testApiSearchWithRpp()
1291 $_REQUEST['q'] = 'reply';
1292 $_REQUEST['rpp'] = 20;
1293 $result = api_search('json');
1294 foreach ($result['status'] as $status) {
1295 self::assertStatus($status);
1296 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1301 * Test the api_search() function with an q parameter contains hashtag.
1302 * @doesNotPerformAssertions
1304 public function testApiSearchWithHashtag()
1306 $_REQUEST['q'] = '%23friendica';
1307 $result = api_search('json');
1308 foreach ($result['status'] as $status) {
1309 self::assertStatus($status);
1310 self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true);
1315 * Test the api_search() function with an exclude_replies parameter.
1316 * @doesNotPerformAssertions
1318 public function testApiSearchWithExcludeReplies()
1320 $_REQUEST['max_id'] = 10;
1321 $_REQUEST['exclude_replies'] = true;
1322 $_REQUEST['q'] = 'friendica';
1323 $result = api_search('json');
1324 foreach ($result['status'] as $status) {
1325 self::assertStatus($status);
1330 * Test the api_search() function without an authenticated user.
1334 public function testApiSearchWithUnallowedUser()
1336 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1337 BasicAuth::setCurrentUserID();
1342 * Test the api_search() function without any GET query parameter.
1346 public function testApiSearchWithoutQuery()
1348 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1353 * Test the api_statuses_home_timeline() function.
1357 public function testApiStatusesHomeTimeline()
1359 $_REQUEST['max_id'] = 10;
1360 $_REQUEST['exclude_replies'] = true;
1361 $_REQUEST['conversation_id'] = 1;
1362 $result = api_statuses_home_timeline('json');
1363 self::assertNotEmpty($result['status']);
1364 foreach ($result['status'] as $status) {
1365 self::assertStatus($status);
1370 * Test the api_statuses_home_timeline() function with a negative page parameter.
1374 public function testApiStatusesHomeTimelineWithNegativePage()
1376 $_REQUEST['page'] = -2;
1377 $result = api_statuses_home_timeline('json');
1378 self::assertNotEmpty($result['status']);
1379 foreach ($result['status'] as $status) {
1380 self::assertStatus($status);
1385 * Test the api_statuses_home_timeline() with an unallowed user.
1389 public function testApiStatusesHomeTimelineWithUnallowedUser()
1391 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1392 BasicAuth::setCurrentUserID();
1393 api_statuses_home_timeline('json');
1397 * Test the api_statuses_home_timeline() function with an RSS result.
1401 public function testApiStatusesHomeTimelineWithRss()
1403 $result = api_statuses_home_timeline('rss');
1404 self::assertXml($result, 'statuses');
1408 * Test the api_statuses_public_timeline() function.
1412 public function testApiStatusesPublicTimeline()
1414 $_REQUEST['max_id'] = 10;
1415 $_REQUEST['conversation_id'] = 1;
1416 $result = api_statuses_public_timeline('json');
1417 self::assertNotEmpty($result['status']);
1418 foreach ($result['status'] as $status) {
1419 self::assertStatus($status);
1424 * Test the api_statuses_public_timeline() function with the exclude_replies parameter.
1428 public function testApiStatusesPublicTimelineWithExcludeReplies()
1430 $_REQUEST['max_id'] = 10;
1431 $_REQUEST['exclude_replies'] = true;
1432 $result = api_statuses_public_timeline('json');
1433 self::assertNotEmpty($result['status']);
1434 foreach ($result['status'] as $status) {
1435 self::assertStatus($status);
1440 * Test the api_statuses_public_timeline() function with a negative page parameter.
1444 public function testApiStatusesPublicTimelineWithNegativePage()
1446 $_REQUEST['page'] = -2;
1447 $result = api_statuses_public_timeline('json');
1448 self::assertNotEmpty($result['status']);
1449 foreach ($result['status'] as $status) {
1450 self::assertStatus($status);
1455 * Test the api_statuses_public_timeline() function with an unallowed user.
1459 public function testApiStatusesPublicTimelineWithUnallowedUser()
1461 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1462 BasicAuth::setCurrentUserID();
1463 api_statuses_public_timeline('json');
1467 * Test the api_statuses_public_timeline() function with an RSS result.
1471 public function testApiStatusesPublicTimelineWithRss()
1473 $result = api_statuses_public_timeline('rss');
1474 self::assertXml($result, 'statuses');
1478 * Test the api_statuses_networkpublic_timeline() function.
1482 public function testApiStatusesNetworkpublicTimeline()
1484 $_REQUEST['max_id'] = 10;
1485 $result = api_statuses_networkpublic_timeline('json');
1486 self::assertNotEmpty($result['status']);
1487 foreach ($result['status'] as $status) {
1488 self::assertStatus($status);
1493 * Test the api_statuses_networkpublic_timeline() function with a negative page parameter.
1497 public function testApiStatusesNetworkpublicTimelineWithNegativePage()
1499 $_REQUEST['page'] = -2;
1500 $result = api_statuses_networkpublic_timeline('json');
1501 self::assertNotEmpty($result['status']);
1502 foreach ($result['status'] as $status) {
1503 self::assertStatus($status);
1508 * Test the api_statuses_networkpublic_timeline() function with an unallowed user.
1512 public function testApiStatusesNetworkpublicTimelineWithUnallowedUser()
1514 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1515 BasicAuth::setCurrentUserID();
1516 api_statuses_networkpublic_timeline('json');
1520 * Test the api_statuses_networkpublic_timeline() function with an RSS result.
1524 public function testApiStatusesNetworkpublicTimelineWithRss()
1526 $result = api_statuses_networkpublic_timeline('rss');
1527 self::assertXml($result, 'statuses');
1531 * Test the api_statuses_show() function.
1535 public function testApiStatusesShow()
1537 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1538 api_statuses_show('json');
1542 * Test the api_statuses_show() function with an ID.
1546 public function testApiStatusesShowWithId()
1548 DI::args()->setArgv(['', '', '', 1]);
1549 $result = api_statuses_show('json');
1550 self::assertStatus($result['status']);
1554 * Test the api_statuses_show() function with the conversation parameter.
1558 public function testApiStatusesShowWithConversation()
1560 DI::args()->setArgv(['', '', '', 1]);
1561 $_REQUEST['conversation'] = 1;
1562 $result = api_statuses_show('json');
1563 self::assertNotEmpty($result['status']);
1564 foreach ($result['status'] as $status) {
1565 self::assertStatus($status);
1570 * Test the api_statuses_show() function with an unallowed user.
1574 public function testApiStatusesShowWithUnallowedUser()
1576 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1577 BasicAuth::setCurrentUserID();
1578 api_statuses_show('json');
1582 * Test the api_conversation_show() function.
1586 public function testApiConversationShow()
1588 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1589 api_conversation_show('json');
1593 * Test the api_conversation_show() function with an ID.
1597 public function testApiConversationShowWithId()
1599 DI::args()->setArgv(['', '', '', 1]);
1600 $_REQUEST['max_id'] = 10;
1601 $_REQUEST['page'] = -2;
1602 $result = api_conversation_show('json');
1603 self::assertNotEmpty($result['status']);
1604 foreach ($result['status'] as $status) {
1605 self::assertStatus($status);
1610 * Test the api_conversation_show() function with an unallowed user.
1614 public function testApiConversationShowWithUnallowedUser()
1616 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1617 BasicAuth::setCurrentUserID();
1618 api_conversation_show('json');
1622 * Test the api_statuses_repeat() function.
1626 public function testApiStatusesRepeat()
1628 $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
1629 api_statuses_repeat('json');
1633 * Test the api_statuses_repeat() function without an authenticated user.
1637 public function testApiStatusesRepeatWithoutAuthenticatedUser()
1639 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1640 BasicAuth::setCurrentUserID();
1641 $_SESSION['authenticated'] = false;
1642 api_statuses_repeat('json');
1646 * Test the api_statuses_repeat() function with an ID.
1650 public function testApiStatusesRepeatWithId()
1652 DI::args()->setArgv(['', '', '', 1]);
1653 $result = api_statuses_repeat('json');
1654 self::assertStatus($result['status']);
1656 // Also test with a shared status
1657 DI::args()->setArgv(['', '', '', 5]);
1658 $result = api_statuses_repeat('json');
1659 self::assertStatus($result['status']);
1663 * Test the api_statuses_destroy() function.
1667 public function testApiStatusesDestroy()
1669 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1670 api_statuses_destroy('json');
1674 * Test the api_statuses_destroy() function without an authenticated user.
1678 public function testApiStatusesDestroyWithoutAuthenticatedUser()
1680 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1681 BasicAuth::setCurrentUserID();
1682 $_SESSION['authenticated'] = false;
1683 api_statuses_destroy('json');
1687 * Test the api_statuses_destroy() function with an ID.
1691 public function testApiStatusesDestroyWithId()
1693 DI::args()->setArgv(['', '', '', 1]);
1694 $result = api_statuses_destroy('json');
1695 self::assertStatus($result['status']);
1699 * Test the api_statuses_mentions() function.
1703 public function testApiStatusesMentions()
1705 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
1706 $_REQUEST['max_id'] = 10;
1707 $result = api_statuses_mentions('json');
1708 self::assertEmpty($result['status']);
1709 // We should test with mentions in the database.
1713 * Test the api_statuses_mentions() function with a negative page parameter.
1717 public function testApiStatusesMentionsWithNegativePage()
1719 $_REQUEST['page'] = -2;
1720 $result = api_statuses_mentions('json');
1721 self::assertEmpty($result['status']);
1725 * Test the api_statuses_mentions() function with an unallowed user.
1729 public function testApiStatusesMentionsWithUnallowedUser()
1731 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1732 BasicAuth::setCurrentUserID();
1733 api_statuses_mentions('json');
1737 * Test the api_statuses_mentions() function with an RSS result.
1741 public function testApiStatusesMentionsWithRss()
1743 $result = api_statuses_mentions('rss');
1744 self::assertXml($result, 'statuses');
1748 * Test the api_statuses_user_timeline() function.
1752 public function testApiStatusesUserTimeline()
1754 $_REQUEST['max_id'] = 10;
1755 $_REQUEST['exclude_replies'] = true;
1756 $_REQUEST['conversation_id'] = 1;
1757 $result = api_statuses_user_timeline('json');
1758 self::assertNotEmpty($result['status']);
1759 foreach ($result['status'] as $status) {
1760 self::assertStatus($status);
1765 * Test the api_statuses_user_timeline() function with a negative page parameter.
1769 public function testApiStatusesUserTimelineWithNegativePage()
1771 $_REQUEST['page'] = -2;
1772 $result = api_statuses_user_timeline('json');
1773 self::assertNotEmpty($result['status']);
1774 foreach ($result['status'] as $status) {
1775 self::assertStatus($status);
1780 * Test the api_statuses_user_timeline() function with an RSS result.
1784 public function testApiStatusesUserTimelineWithRss()
1786 $result = api_statuses_user_timeline('rss');
1787 self::assertXml($result, 'statuses');
1791 * Test the api_statuses_user_timeline() function with an unallowed user.
1795 public function testApiStatusesUserTimelineWithUnallowedUser()
1797 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1798 BasicAuth::setCurrentUserID();
1799 api_statuses_user_timeline('json');
1803 * Test the api_favorites_create_destroy() function.
1807 public function testApiFavoritesCreateDestroy()
1809 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1810 DI::args()->setArgv(['api', '1.1', 'favorites', 'create']);
1811 api_favorites_create_destroy('json');
1815 * Test the api_favorites_create_destroy() function with an invalid ID.
1819 public function testApiFavoritesCreateDestroyWithInvalidId()
1821 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1822 DI::args()->setArgv(['api', '1.1', 'favorites', 'create', '12.json']);
1823 api_favorites_create_destroy('json');
1827 * Test the api_favorites_create_destroy() function with an invalid action.
1831 public function testApiFavoritesCreateDestroyWithInvalidAction()
1833 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1834 DI::args()->setArgv(['api', '1.1', 'favorites', 'change.json']);
1835 $_REQUEST['id'] = 1;
1836 api_favorites_create_destroy('json');
1840 * Test the api_favorites_create_destroy() function with the create action.
1844 public function testApiFavoritesCreateDestroyWithCreateAction()
1846 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1847 $_REQUEST['id'] = 3;
1848 $result = api_favorites_create_destroy('json');
1849 self::assertStatus($result['status']);
1853 * Test the api_favorites_create_destroy() function with the create action and an RSS result.
1857 public function testApiFavoritesCreateDestroyWithCreateActionAndRss()
1859 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.rss']);
1860 $_REQUEST['id'] = 3;
1861 $result = api_favorites_create_destroy('rss');
1862 self::assertXml($result, 'status');
1866 * Test the api_favorites_create_destroy() function with the destroy action.
1870 public function testApiFavoritesCreateDestroyWithDestroyAction()
1872 DI::args()->setArgv(['api', '1.1', 'favorites', 'destroy.json']);
1873 $_REQUEST['id'] = 3;
1874 $result = api_favorites_create_destroy('json');
1875 self::assertStatus($result['status']);
1879 * Test the api_favorites_create_destroy() function without an authenticated user.
1883 public function testApiFavoritesCreateDestroyWithoutAuthenticatedUser()
1885 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1886 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1887 BasicAuth::setCurrentUserID();
1888 $_SESSION['authenticated'] = false;
1889 api_favorites_create_destroy('json');
1893 * Test the api_favorites() function.
1897 public function testApiFavorites()
1899 $_REQUEST['page'] = -1;
1900 $_REQUEST['max_id'] = 10;
1901 $result = api_favorites('json');
1902 foreach ($result['status'] as $status) {
1903 self::assertStatus($status);
1908 * Test the api_favorites() function with an RSS result.
1912 public function testApiFavoritesWithRss()
1914 $result = api_favorites('rss');
1915 self::assertXml($result, 'statuses');
1919 * Test the api_favorites() function with an unallowed user.
1923 public function testApiFavoritesWithUnallowedUser()
1925 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1926 BasicAuth::setCurrentUserID();
1927 api_favorites('json');
1931 * Test the api_format_messages() function.
1935 public function testApiFormatMessages()
1937 $result = api_format_messages(
1938 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1939 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1940 ['id' => 3, 'uri-id' => 2, 'screen_name' => 'sender_name']
1942 self::assertEquals('item_title' . "\n" . 'item_body', $result['text']);
1943 self::assertEquals(1, $result['id']);
1944 self::assertEquals(2, $result['recipient_id']);
1945 self::assertEquals(3, $result['sender_id']);
1946 self::assertEquals('recipient_name', $result['recipient_screen_name']);
1947 self::assertEquals('sender_name', $result['sender_screen_name']);
1951 * Test the api_format_messages() function with HTML.
1955 public function testApiFormatMessagesWithHtmlText()
1957 $_GET['getText'] = 'html';
1958 $result = api_format_messages(
1959 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1960 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1961 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1963 self::assertEquals('item_title', $result['title']);
1964 self::assertEquals('<strong>item_body</strong>', $result['text']);
1968 * Test the api_format_messages() function with plain text.
1972 public function testApiFormatMessagesWithPlainText()
1974 $_GET['getText'] = 'plain';
1975 $result = api_format_messages(
1976 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1977 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1978 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1980 self::assertEquals('item_title', $result['title']);
1981 self::assertEquals('item_body', $result['text']);
1985 * Test the api_format_messages() function with the getUserObjects GET parameter set to false.
1989 public function testApiFormatMessagesWithoutUserObjects()
1991 $_GET['getUserObjects'] = 'false';
1992 $result = api_format_messages(
1993 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1994 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1995 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1997 self::assertTrue(!isset($result['sender']));
1998 self::assertTrue(!isset($result['recipient']));
2002 * Test the api_convert_item() function.
2006 public function testApiConvertItem()
2008 $result = api_convert_item(
2010 'network' => 'feed',
2011 'title' => 'item_title',
2013 // We need a long string to test that it is correctly cut
2014 'body' => 'perspiciatis impedit voluptatem quis molestiae ea qui ' .
2015 'reiciendis dolorum aut ducimus sunt consequatur inventore dolor ' .
2016 'officiis pariatur doloremque nemo culpa aut quidem qui dolore ' .
2017 'laudantium atque commodi alias voluptatem non possimus aperiam ' .
2018 'ipsum rerum consequuntur aut amet fugit quia aliquid praesentium ' .
2019 'repellendus quibusdam et et inventore mollitia rerum sit autem ' .
2020 'pariatur maiores ipsum accusantium perferendis vel sit possimus ' .
2021 'veritatis nihil distinctio qui eum repellat officia illum quos ' .
2022 'impedit quam iste esse unde qui suscipit aut facilis ut inventore ' .
2023 'omnis exercitationem quo magnam consequatur maxime aut illum ' .
2024 'soluta quaerat natus unde aspernatur et sed beatae nihil ullam ' .
2025 'temporibus corporis ratione blanditiis perspiciatis impedit ' .
2026 'voluptatem quis molestiae ea qui reiciendis dolorum aut ducimus ' .
2027 'sunt consequatur inventore dolor officiis pariatur doloremque ' .
2028 'nemo culpa aut quidem qui dolore laudantium atque commodi alias ' .
2029 'voluptatem non possimus aperiam ipsum rerum consequuntur aut ' .
2030 'amet fugit quia aliquid praesentium repellendus quibusdam et et ' .
2031 'inventore mollitia rerum sit autem pariatur maiores ipsum accusantium ' .
2032 'perferendis vel sit possimus veritatis nihil distinctio qui eum ' .
2033 'repellat officia illum quos impedit quam iste esse unde qui ' .
2034 'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
2035 'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
2036 'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
2037 'plink' => 'item_plink'
2040 self::assertStringStartsWith('item_title', $result['text']);
2041 self::assertStringStartsWith('<h4>item_title</h4><br>perspiciatis impedit voluptatem', $result['html']);
2045 * Test the api_convert_item() function with an empty item body.
2049 public function testApiConvertItemWithoutBody()
2051 $result = api_convert_item(
2053 'network' => 'feed',
2054 'title' => 'item_title',
2057 'plink' => 'item_plink'
2060 self::assertEquals("item_title", $result['text']);
2061 self::assertEquals('<h4>item_title</h4><br>item_plink', $result['html']);
2065 * Test the api_convert_item() function with the title in the body.
2069 public function testApiConvertItemWithTitleInBody()
2071 $result = api_convert_item(
2073 'title' => 'item_title',
2074 'body' => 'item_title item_body',
2078 self::assertEquals('item_title item_body', $result['text']);
2079 self::assertEquals('<h4>item_title</h4><br>item_title item_body', $result['html']);
2083 * Test the api_get_attachments() function.
2087 public function testApiGetAttachments()
2090 self::assertEmpty(api_get_attachments($body, 0));
2094 * Test the api_get_attachments() function with an img tag.
2098 public function testApiGetAttachmentsWithImage()
2100 $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2101 self::assertIsArray(api_get_attachments($body, 0));
2105 * Test the api_get_attachments() function with an img tag and an AndStatus user agent.
2109 public function testApiGetAttachmentsWithImageAndAndStatus()
2111 $_SERVER['HTTP_USER_AGENT'] = 'AndStatus';
2112 $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2113 self::assertIsArray(api_get_attachments($body, 0));
2117 * Test the api_get_entitities() function.
2121 public function testApiGetEntitities()
2124 self::assertIsArray(api_get_entitities($text, 'bbcode', 0));
2128 * Test the api_get_entitities() function with the include_entities parameter.
2132 public function testApiGetEntititiesWithIncludeEntities()
2134 $_REQUEST['include_entities'] = 'true';
2136 $result = api_get_entitities($text, 'bbcode', 0);
2137 self::assertIsArray($result['hashtags']);
2138 self::assertIsArray($result['symbols']);
2139 self::assertIsArray($result['urls']);
2140 self::assertIsArray($result['user_mentions']);
2144 * Test the api_format_items_embeded_images() function.
2148 public function testApiFormatItemsEmbededImages()
2151 'text ' . DI::baseUrl() . '/display/item_guid',
2152 api_format_items_embeded_images(['guid' => 'item_guid'], 'text data:image/foo')
2157 * Test the api_contactlink_to_array() function.
2161 public function testApiContactlinkToArray()
2168 api_contactlink_to_array('text')
2173 * Test the api_contactlink_to_array() function with an URL.
2177 public function testApiContactlinkToArrayWithUrl()
2181 'name' => ['link_text'],
2184 api_contactlink_to_array('text <a href="url">link_text</a>')
2189 * Test the api_format_items_activities() function.
2193 public function testApiFormatItemsActivities()
2195 $item = ['uid' => 0, 'uri' => ''];
2196 $result = api_format_items_activities($item);
2197 self::assertArrayHasKey('like', $result);
2198 self::assertArrayHasKey('dislike', $result);
2199 self::assertArrayHasKey('attendyes', $result);
2200 self::assertArrayHasKey('attendno', $result);
2201 self::assertArrayHasKey('attendmaybe', $result);
2205 * Test the api_format_items_activities() function with an XML result.
2209 public function testApiFormatItemsActivitiesWithXml()
2211 $item = ['uid' => 0, 'uri' => ''];
2212 $result = api_format_items_activities($item, 'xml');
2213 self::assertArrayHasKey('friendica:like', $result);
2214 self::assertArrayHasKey('friendica:dislike', $result);
2215 self::assertArrayHasKey('friendica:attendyes', $result);
2216 self::assertArrayHasKey('friendica:attendno', $result);
2217 self::assertArrayHasKey('friendica:attendmaybe', $result);
2221 * Test the api_format_items() function.
2222 * @doesNotPerformAssertions
2224 public function testApiFormatItems()
2228 'item_network' => 'item_network',
2234 'author-network' => Protocol::DFRN,
2235 'author-link' => 'http://localhost/profile/othercontact',
2237 'uid' => $this->selfUser['id'],
2240 foreach ($items as $item) {
2241 $status = api_format_item($item);
2242 self::assertStatus($status);
2247 * Test the api_format_items() function with an XML result.
2248 * @doesNotPerformAssertions
2250 public function testApiFormatItemsWithXml()
2258 'author-network' => Protocol::DFRN,
2259 'author-link' => 'http://localhost/profile/othercontact',
2261 'uid' => $this->selfUser['id'],
2265 foreach ($items as $item) {
2266 $status = api_format_item($item, 'xml');
2267 self::assertStatus($status);
2272 * Test the api_lists_list() function.
2276 public function testApiListsList()
2278 $result = api_lists_list('json');
2279 self::assertEquals(['lists_list' => []], $result);
2283 * Test the api_lists_ownerships() function.
2287 public function testApiListsOwnerships()
2289 $result = api_lists_ownerships('json');
2290 foreach ($result['lists']['lists'] as $list) {
2291 self::assertList($list);
2296 * Test the api_lists_ownerships() function without an authenticated user.
2300 public function testApiListsOwnershipsWithoutAuthenticatedUser()
2302 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2303 BasicAuth::setCurrentUserID();
2304 $_SESSION['authenticated'] = false;
2305 api_lists_ownerships('json');
2309 * Test the api_lists_statuses() function.
2313 public function testApiListsStatuses()
2315 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2316 api_lists_statuses('json');
2320 * Test the api_lists_statuses() function with a list ID.
2321 * @doesNotPerformAssertions
2323 public function testApiListsStatusesWithListId()
2325 $_REQUEST['list_id'] = 1;
2326 $_REQUEST['page'] = -1;
2327 $_REQUEST['max_id'] = 10;
2328 $result = api_lists_statuses('json');
2329 foreach ($result['status'] as $status) {
2330 self::assertStatus($status);
2335 * Test the api_lists_statuses() function with a list ID and a RSS result.
2339 public function testApiListsStatusesWithListIdAndRss()
2341 $_REQUEST['list_id'] = 1;
2342 $result = api_lists_statuses('rss');
2343 self::assertXml($result, 'statuses');
2347 * Test the api_lists_statuses() function with an unallowed user.
2351 public function testApiListsStatusesWithUnallowedUser()
2353 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2354 BasicAuth::setCurrentUserID();
2355 api_lists_statuses('json');
2359 * Test the api_statuses_f() function.
2363 public function testApiStatusesFWithFriends()
2366 $result = api_statuses_f('friends');
2367 self::assertArrayHasKey('user', $result);
2371 * Test the api_statuses_f() function.
2375 public function testApiStatusesFWithFollowers()
2377 $result = api_statuses_f('followers');
2378 self::assertArrayHasKey('user', $result);
2382 * Test the api_statuses_f() function.
2386 public function testApiStatusesFWithBlocks()
2388 $result = api_statuses_f('blocks');
2389 self::assertArrayHasKey('user', $result);
2393 * Test the api_statuses_f() function.
2397 public function testApiStatusesFWithIncoming()
2399 $result = api_statuses_f('incoming');
2400 self::assertArrayHasKey('user', $result);
2404 * Test the api_statuses_f() function an undefined cursor GET variable.
2408 public function testApiStatusesFWithUndefinedCursor()
2410 $_GET['cursor'] = 'undefined';
2411 self::assertFalse(api_statuses_f('friends'));
2415 * Test the api_statuses_friends() function.
2419 public function testApiStatusesFriends()
2421 $result = api_statuses_friends('json');
2422 self::assertArrayHasKey('user', $result);
2426 * Test the api_statuses_friends() function an undefined cursor GET variable.
2430 public function testApiStatusesFriendsWithUndefinedCursor()
2432 $_GET['cursor'] = 'undefined';
2433 self::assertFalse(api_statuses_friends('json'));
2437 * Test the api_statuses_followers() function.
2441 public function testApiStatusesFollowers()
2443 $result = api_statuses_followers('json');
2444 self::assertArrayHasKey('user', $result);
2448 * Test the api_statuses_followers() function an undefined cursor GET variable.
2452 public function testApiStatusesFollowersWithUndefinedCursor()
2454 $_GET['cursor'] = 'undefined';
2455 self::assertFalse(api_statuses_followers('json'));
2459 * Test the api_blocks_list() function.
2463 public function testApiBlocksList()
2465 $result = api_blocks_list('json');
2466 self::assertArrayHasKey('user', $result);
2470 * Test the api_blocks_list() function an undefined cursor GET variable.
2474 public function testApiBlocksListWithUndefinedCursor()
2476 $_GET['cursor'] = 'undefined';
2477 self::assertFalse(api_blocks_list('json'));
2481 * Test the api_friendships_incoming() function.
2485 public function testApiFriendshipsIncoming()
2487 $result = api_friendships_incoming('json');
2488 self::assertArrayHasKey('id', $result);
2492 * Test the api_friendships_incoming() function an undefined cursor GET variable.
2496 public function testApiFriendshipsIncomingWithUndefinedCursor()
2498 $_GET['cursor'] = 'undefined';
2499 self::assertFalse(api_friendships_incoming('json'));
2503 * Test the api_statusnet_config() function.
2507 public function testApiStatusnetConfig()
2510 $result = api_statusnet_config('json');
2511 self::assertEquals('localhost', $result['config']['site']['server']);
2512 self::assertEquals('default', $result['config']['site']['theme']);
2513 self::assertEquals(DI::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']);
2514 self::assertTrue($result['config']['site']['fancy']);
2515 self::assertEquals('en', $result['config']['site']['language']);
2516 self::assertEquals('UTC', $result['config']['site']['timezone']);
2517 self::assertEquals(200000, $result['config']['site']['textlimit']);
2518 self::assertEquals('false', $result['config']['site']['private']);
2519 self::assertEquals('false', $result['config']['site']['ssl']);
2520 self::assertEquals(30, $result['config']['site']['shorturllength']);
2525 * Test the api_direct_messages_new() function.
2529 public function testApiDirectMessagesNew()
2531 $result = api_direct_messages_new('json');
2532 self::assertNull($result);
2536 * Test the api_direct_messages_new() function without an authenticated user.
2540 public function testApiDirectMessagesNewWithoutAuthenticatedUser()
2542 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2543 BasicAuth::setCurrentUserID();
2544 $_SESSION['authenticated'] = false;
2545 api_direct_messages_new('json');
2549 * Test the api_direct_messages_new() function with an user ID.
2553 public function testApiDirectMessagesNewWithUserId()
2555 $_POST['text'] = 'message_text';
2556 $_POST['user_id'] = $this->otherUser['id'];
2557 $result = api_direct_messages_new('json');
2558 self::assertEquals(['direct_message' => ['error' => -1]], $result);
2562 * Test the api_direct_messages_new() function with a screen name.
2566 public function testApiDirectMessagesNewWithScreenName()
2568 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2569 $_POST['text'] = 'message_text';
2570 $_POST['screen_name'] = $this->friendUser['nick'];
2571 $result = api_direct_messages_new('json');
2572 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2573 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2574 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2578 * Test the api_direct_messages_new() function with a title.
2582 public function testApiDirectMessagesNewWithTitle()
2584 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2585 $_POST['text'] = 'message_text';
2586 $_POST['screen_name'] = $this->friendUser['nick'];
2587 $_REQUEST['title'] = 'message_title';
2588 $result = api_direct_messages_new('json');
2589 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2590 self::assertStringContainsString('message_title', $result['direct_message']['text']);
2591 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2592 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2596 * Test the api_direct_messages_new() function with an RSS result.
2600 public function testApiDirectMessagesNewWithRss()
2602 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2603 $_POST['text'] = 'message_text';
2604 $_POST['screen_name'] = $this->friendUser['nick'];
2605 $result = api_direct_messages_new('rss');
2606 self::assertXml($result, 'direct-messages');
2610 * Test the api_direct_messages_destroy() function.
2614 public function testApiDirectMessagesDestroy()
2616 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2617 api_direct_messages_destroy('json');
2621 * Test the api_direct_messages_destroy() function with the friendica_verbose GET param.
2625 public function testApiDirectMessagesDestroyWithVerbose()
2627 $_GET['friendica_verbose'] = 'true';
2628 $result = api_direct_messages_destroy('json');
2632 'result' => 'error',
2633 'message' => 'message id or parenturi not specified'
2641 * Test the api_direct_messages_destroy() function without an authenticated user.
2645 public function testApiDirectMessagesDestroyWithoutAuthenticatedUser()
2647 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2648 BasicAuth::setCurrentUserID();
2649 $_SESSION['authenticated'] = false;
2650 api_direct_messages_destroy('json');
2654 * Test the api_direct_messages_destroy() function with a non-zero ID.
2658 public function testApiDirectMessagesDestroyWithId()
2660 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2661 $_REQUEST['id'] = 1;
2662 api_direct_messages_destroy('json');
2666 * Test the api_direct_messages_destroy() with a non-zero ID and the friendica_verbose GET param.
2670 public function testApiDirectMessagesDestroyWithIdAndVerbose()
2672 $_REQUEST['id'] = 1;
2673 $_REQUEST['friendica_parenturi'] = 'parent_uri';
2674 $_GET['friendica_verbose'] = 'true';
2675 $result = api_direct_messages_destroy('json');
2679 'result' => 'error',
2680 'message' => 'message id not in database'
2688 * Test the api_direct_messages_destroy() function with a non-zero ID.
2692 public function testApiDirectMessagesDestroyWithCorrectId()
2694 $this->markTestIncomplete('We need to add a dataset for this.');
2698 * Test the api_direct_messages_box() function.
2702 public function testApiDirectMessagesBoxWithSentbox()
2704 $_REQUEST['page'] = -1;
2705 $_REQUEST['max_id'] = 10;
2706 $result = api_direct_messages_box('json', 'sentbox', 'false');
2707 self::assertArrayHasKey('direct_message', $result);
2711 * Test the api_direct_messages_box() function.
2715 public function testApiDirectMessagesBoxWithConversation()
2717 $result = api_direct_messages_box('json', 'conversation', 'false');
2718 self::assertArrayHasKey('direct_message', $result);
2722 * Test the api_direct_messages_box() function.
2726 public function testApiDirectMessagesBoxWithAll()
2728 $result = api_direct_messages_box('json', 'all', 'false');
2729 self::assertArrayHasKey('direct_message', $result);
2733 * Test the api_direct_messages_box() function.
2737 public function testApiDirectMessagesBoxWithInbox()
2739 $result = api_direct_messages_box('json', 'inbox', 'false');
2740 self::assertArrayHasKey('direct_message', $result);
2744 * Test the api_direct_messages_box() function.
2748 public function testApiDirectMessagesBoxWithVerbose()
2750 $result = api_direct_messages_box('json', 'sentbox', 'true');
2754 'result' => 'error',
2755 'message' => 'no mails available'
2763 * Test the api_direct_messages_box() function with a RSS result.
2767 public function testApiDirectMessagesBoxWithRss()
2769 $result = api_direct_messages_box('rss', 'sentbox', 'false');
2770 self::assertXml($result, 'direct-messages');
2774 * Test the api_direct_messages_box() function without an authenticated user.
2778 public function testApiDirectMessagesBoxWithUnallowedUser()
2780 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2781 BasicAuth::setCurrentUserID();
2782 api_direct_messages_box('json', 'sentbox', 'false');
2786 * Test the api_direct_messages_sentbox() function.
2790 public function testApiDirectMessagesSentbox()
2792 $result = api_direct_messages_sentbox('json');
2793 self::assertArrayHasKey('direct_message', $result);
2797 * Test the api_direct_messages_inbox() function.
2801 public function testApiDirectMessagesInbox()
2803 $result = api_direct_messages_inbox('json');
2804 self::assertArrayHasKey('direct_message', $result);
2808 * Test the api_direct_messages_all() function.
2812 public function testApiDirectMessagesAll()
2814 $result = api_direct_messages_all('json');
2815 self::assertArrayHasKey('direct_message', $result);
2819 * Test the api_direct_messages_conversation() function.
2823 public function testApiDirectMessagesConversation()
2825 $result = api_direct_messages_conversation('json');
2826 self::assertArrayHasKey('direct_message', $result);
2830 * Test the api_oauth_request_token() function.
2834 public function testApiOauthRequestToken()
2836 $this->markTestIncomplete('exit() kills phpunit as well');
2840 * Test the api_oauth_access_token() function.
2844 public function testApiOauthAccessToken()
2846 $this->markTestIncomplete('exit() kills phpunit as well');
2850 * Test the api_fr_photos_list() function.
2854 public function testApiFrPhotosList()
2856 $result = api_fr_photos_list('json');
2857 self::assertArrayHasKey('photo', $result);
2861 * Test the api_fr_photos_list() function without an authenticated user.
2865 public function testApiFrPhotosListWithoutAuthenticatedUser()
2867 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2868 BasicAuth::setCurrentUserID();
2869 $_SESSION['authenticated'] = false;
2870 api_fr_photos_list('json');
2874 * Test the api_fr_photo_create_update() function.
2876 public function testApiFrPhotoCreateUpdate()
2878 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2879 api_fr_photo_create_update('json');
2883 * Test the api_fr_photo_create_update() function without an authenticated user.
2887 public function testApiFrPhotoCreateUpdateWithoutAuthenticatedUser()
2889 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2890 BasicAuth::setCurrentUserID();
2891 $_SESSION['authenticated'] = false;
2892 api_fr_photo_create_update('json');
2896 * Test the api_fr_photo_create_update() function with an album name.
2900 public function testApiFrPhotoCreateUpdateWithAlbum()
2902 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2903 $_REQUEST['album'] = 'album_name';
2904 api_fr_photo_create_update('json');
2908 * Test the api_fr_photo_create_update() function with the update mode.
2912 public function testApiFrPhotoCreateUpdateWithUpdate()
2914 $this->markTestIncomplete('We need to create a dataset for this');
2918 * Test the api_fr_photo_create_update() function with an uploaded file.
2922 public function testApiFrPhotoCreateUpdateWithFile()
2924 $this->markTestIncomplete();
2928 * Test the api_fr_photo_detail() function.
2932 public function testApiFrPhotoDetail()
2934 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2935 api_fr_photo_detail('json');
2939 * Test the api_fr_photo_detail() function without an authenticated user.
2943 public function testApiFrPhotoDetailWithoutAuthenticatedUser()
2945 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2946 BasicAuth::setCurrentUserID();
2947 $_SESSION['authenticated'] = false;
2948 api_fr_photo_detail('json');
2952 * Test the api_fr_photo_detail() function with a photo ID.
2956 public function testApiFrPhotoDetailWithPhotoId()
2958 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
2959 $_REQUEST['photo_id'] = 1;
2960 api_fr_photo_detail('json');
2964 * Test the api_fr_photo_detail() function with a correct photo ID.
2968 public function testApiFrPhotoDetailCorrectPhotoId()
2970 $this->markTestIncomplete('We need to create a dataset for this.');
2974 * Test the api_account_update_profile_image() function.
2978 public function testApiAccountUpdateProfileImage()
2980 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2981 api_account_update_profile_image('json');
2985 * Test the api_account_update_profile_image() function without an authenticated user.
2989 public function testApiAccountUpdateProfileImageWithoutAuthenticatedUser()
2991 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2992 BasicAuth::setCurrentUserID();
2993 $_SESSION['authenticated'] = false;
2994 api_account_update_profile_image('json');
2998 * Test the api_account_update_profile_image() function with an uploaded file.
3002 public function testApiAccountUpdateProfileImageWithUpload()
3004 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
3005 $this->markTestIncomplete();
3010 * Test the api_account_update_profile() function.
3014 public function testApiAccountUpdateProfile()
3016 $_POST['name'] = 'new_name';
3017 $_POST['description'] = 'new_description';
3018 $result = api_account_update_profile('json');
3019 // We can't use assertSelfUser() here because the user object is missing some properties.
3020 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
3021 self::assertEquals('DFRN', $result['user']['location']);
3022 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
3023 self::assertEquals('dfrn', $result['user']['network']);
3024 self::assertEquals('new_name', $result['user']['name']);
3025 self::assertEquals('new_description', $result['user']['description']);
3029 * Test the check_acl_input() function.
3033 public function testCheckAclInput()
3035 $result = check_acl_input('<aclstring>', BaseApi::getCurrentUserID());
3036 // Where does this result come from?
3037 self::assertEquals(1, $result);
3041 * Test the check_acl_input() function with an empty ACL string.
3045 public function testCheckAclInputWithEmptyAclString()
3047 $result = check_acl_input(' ', BaseApi::getCurrentUserID());
3048 self::assertFalse($result);
3052 * Test the save_media_to_database() function.
3056 public function testSaveMediaToDatabase()
3058 $this->markTestIncomplete();
3062 * Test the post_photo_item() function.
3066 public function testPostPhotoItem()
3068 $this->markTestIncomplete();
3072 * Test the prepare_photo_data() function.
3076 public function testPreparePhotoData()
3078 $this->markTestIncomplete();
3082 * Test the api_share_as_retweet() function with a valid item.
3086 public function testApiShareAsRetweetWithValidItem()
3088 $this->markTestIncomplete();
3092 * Test the api_in_reply_to() function.
3096 public function testApiInReplyTo()
3098 $result = api_in_reply_to(['id' => 0, 'parent' => 0, 'uri' => '', 'thr-parent' => '']);
3099 self::assertArrayHasKey('status_id', $result);
3100 self::assertArrayHasKey('user_id', $result);
3101 self::assertArrayHasKey('status_id_str', $result);
3102 self::assertArrayHasKey('user_id_str', $result);
3103 self::assertArrayHasKey('screen_name', $result);
3107 * Test the api_in_reply_to() function with a valid item.
3111 public function testApiInReplyToWithValidItem()
3113 $this->markTestIncomplete();
3117 * Test the api_clean_plain_items() function.
3121 public function testApiCleanPlainItems()
3123 $_REQUEST['include_entities'] = 'true';
3124 $result = api_clean_plain_items('some_text [url="some_url"]some_text[/url]');
3125 self::assertEquals('some_text [url="some_url"]"some_url"[/url]', $result);
3129 * Test the api_best_nickname() function with contacts.
3133 public function testApiBestNicknameWithContacts()
3135 $this->markTestIncomplete();
3139 * Test the api_friendica_group_show() function.
3143 public function testApiFriendicaGroupShow()
3145 $this->markTestIncomplete();
3149 * Test the api_friendica_group_delete() function.
3153 public function testApiFriendicaGroupDelete()
3155 $this->markTestIncomplete();
3159 * Test the api_lists_destroy() function.
3163 public function testApiListsDestroy()
3165 $this->markTestIncomplete();
3169 * Test the group_create() function.
3173 public function testGroupCreate()
3175 $this->markTestIncomplete();
3179 * Test the api_friendica_group_create() function.
3183 public function testApiFriendicaGroupCreate()
3185 $this->markTestIncomplete();
3189 * Test the api_lists_create() function.
3193 public function testApiListsCreate()
3195 $this->markTestIncomplete();
3199 * Test the api_friendica_group_update() function.
3203 public function testApiFriendicaGroupUpdate()
3205 $this->markTestIncomplete();
3209 * Test the api_lists_update() function.
3213 public function testApiListsUpdate()
3215 $this->markTestIncomplete();
3219 * Test the api_friendica_activity() function.
3223 public function testApiFriendicaActivity()
3225 $this->markTestIncomplete();
3229 * Test the api_friendica_notification_seen() function.
3233 public function testApiFriendicaNotificationSeen()
3235 $this->markTestIncomplete();
3239 * Test the api_friendica_direct_messages_setseen() function.
3243 public function testApiFriendicaDirectMessagesSetseen()
3245 $this->markTestIncomplete();
3249 * Test the api_friendica_direct_messages_search() function.
3253 public function testApiFriendicaDirectMessagesSearch()
3255 $this->markTestIncomplete();