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',
2239 foreach ($items as $item) {
2240 $status = api_format_item($item);
2241 self::assertStatus($status);
2246 * Test the api_format_items() function with an XML result.
2247 * @doesNotPerformAssertions
2249 public function testApiFormatItemsWithXml()
2257 'author-network' => Protocol::DFRN,
2258 'author-link' => 'http://localhost/profile/othercontact',
2263 foreach ($items as $item) {
2264 $status = api_format_item($item, 'xml');
2265 self::assertStatus($status);
2270 * Test the api_lists_list() function.
2274 public function testApiListsList()
2276 $result = api_lists_list('json');
2277 self::assertEquals(['lists_list' => []], $result);
2281 * Test the api_lists_ownerships() function.
2285 public function testApiListsOwnerships()
2287 $result = api_lists_ownerships('json');
2288 foreach ($result['lists']['lists'] as $list) {
2289 self::assertList($list);
2294 * Test the api_lists_ownerships() function without an authenticated user.
2298 public function testApiListsOwnershipsWithoutAuthenticatedUser()
2300 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2301 BasicAuth::setCurrentUserID();
2302 $_SESSION['authenticated'] = false;
2303 api_lists_ownerships('json');
2307 * Test the api_lists_statuses() function.
2311 public function testApiListsStatuses()
2313 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2314 api_lists_statuses('json');
2318 * Test the api_lists_statuses() function with a list ID.
2319 * @doesNotPerformAssertions
2321 public function testApiListsStatusesWithListId()
2323 $_REQUEST['list_id'] = 1;
2324 $_REQUEST['page'] = -1;
2325 $_REQUEST['max_id'] = 10;
2326 $result = api_lists_statuses('json');
2327 foreach ($result['status'] as $status) {
2328 self::assertStatus($status);
2333 * Test the api_lists_statuses() function with a list ID and a RSS result.
2337 public function testApiListsStatusesWithListIdAndRss()
2339 $_REQUEST['list_id'] = 1;
2340 $result = api_lists_statuses('rss');
2341 self::assertXml($result, 'statuses');
2345 * Test the api_lists_statuses() function with an unallowed user.
2349 public function testApiListsStatusesWithUnallowedUser()
2351 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2352 BasicAuth::setCurrentUserID();
2353 api_lists_statuses('json');
2357 * Test the api_statuses_f() function.
2361 public function testApiStatusesFWithFriends()
2364 $result = api_statuses_f('friends');
2365 self::assertArrayHasKey('user', $result);
2369 * Test the api_statuses_f() function.
2373 public function testApiStatusesFWithFollowers()
2375 $result = api_statuses_f('followers');
2376 self::assertArrayHasKey('user', $result);
2380 * Test the api_statuses_f() function.
2384 public function testApiStatusesFWithBlocks()
2386 $result = api_statuses_f('blocks');
2387 self::assertArrayHasKey('user', $result);
2391 * Test the api_statuses_f() function.
2395 public function testApiStatusesFWithIncoming()
2397 $result = api_statuses_f('incoming');
2398 self::assertArrayHasKey('user', $result);
2402 * Test the api_statuses_f() function an undefined cursor GET variable.
2406 public function testApiStatusesFWithUndefinedCursor()
2408 $_GET['cursor'] = 'undefined';
2409 self::assertFalse(api_statuses_f('friends'));
2413 * Test the api_statuses_friends() function.
2417 public function testApiStatusesFriends()
2419 $result = api_statuses_friends('json');
2420 self::assertArrayHasKey('user', $result);
2424 * Test the api_statuses_friends() function an undefined cursor GET variable.
2428 public function testApiStatusesFriendsWithUndefinedCursor()
2430 $_GET['cursor'] = 'undefined';
2431 self::assertFalse(api_statuses_friends('json'));
2435 * Test the api_statuses_followers() function.
2439 public function testApiStatusesFollowers()
2441 $result = api_statuses_followers('json');
2442 self::assertArrayHasKey('user', $result);
2446 * Test the api_statuses_followers() function an undefined cursor GET variable.
2450 public function testApiStatusesFollowersWithUndefinedCursor()
2452 $_GET['cursor'] = 'undefined';
2453 self::assertFalse(api_statuses_followers('json'));
2457 * Test the api_blocks_list() function.
2461 public function testApiBlocksList()
2463 $result = api_blocks_list('json');
2464 self::assertArrayHasKey('user', $result);
2468 * Test the api_blocks_list() function an undefined cursor GET variable.
2472 public function testApiBlocksListWithUndefinedCursor()
2474 $_GET['cursor'] = 'undefined';
2475 self::assertFalse(api_blocks_list('json'));
2479 * Test the api_friendships_incoming() function.
2483 public function testApiFriendshipsIncoming()
2485 $result = api_friendships_incoming('json');
2486 self::assertArrayHasKey('id', $result);
2490 * Test the api_friendships_incoming() function an undefined cursor GET variable.
2494 public function testApiFriendshipsIncomingWithUndefinedCursor()
2496 $_GET['cursor'] = 'undefined';
2497 self::assertFalse(api_friendships_incoming('json'));
2501 * Test the api_statusnet_config() function.
2505 public function testApiStatusnetConfig()
2508 $result = api_statusnet_config('json');
2509 self::assertEquals('localhost', $result['config']['site']['server']);
2510 self::assertEquals('default', $result['config']['site']['theme']);
2511 self::assertEquals(DI::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']);
2512 self::assertTrue($result['config']['site']['fancy']);
2513 self::assertEquals('en', $result['config']['site']['language']);
2514 self::assertEquals('UTC', $result['config']['site']['timezone']);
2515 self::assertEquals(200000, $result['config']['site']['textlimit']);
2516 self::assertEquals('false', $result['config']['site']['private']);
2517 self::assertEquals('false', $result['config']['site']['ssl']);
2518 self::assertEquals(30, $result['config']['site']['shorturllength']);
2523 * Test the api_direct_messages_new() function.
2527 public function testApiDirectMessagesNew()
2529 $result = api_direct_messages_new('json');
2530 self::assertNull($result);
2534 * Test the api_direct_messages_new() function without an authenticated user.
2538 public function testApiDirectMessagesNewWithoutAuthenticatedUser()
2540 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2541 BasicAuth::setCurrentUserID();
2542 $_SESSION['authenticated'] = false;
2543 api_direct_messages_new('json');
2547 * Test the api_direct_messages_new() function with an user ID.
2551 public function testApiDirectMessagesNewWithUserId()
2553 $_POST['text'] = 'message_text';
2554 $_POST['user_id'] = $this->otherUser['id'];
2555 $result = api_direct_messages_new('json');
2556 self::assertEquals(['direct_message' => ['error' => -1]], $result);
2560 * Test the api_direct_messages_new() function with a screen name.
2564 public function testApiDirectMessagesNewWithScreenName()
2566 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2567 $_POST['text'] = 'message_text';
2568 $_POST['screen_name'] = $this->friendUser['nick'];
2569 $result = api_direct_messages_new('json');
2570 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2571 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2572 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2576 * Test the api_direct_messages_new() function with a title.
2580 public function testApiDirectMessagesNewWithTitle()
2582 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2583 $_POST['text'] = 'message_text';
2584 $_POST['screen_name'] = $this->friendUser['nick'];
2585 $_REQUEST['title'] = 'message_title';
2586 $result = api_direct_messages_new('json');
2587 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2588 self::assertStringContainsString('message_title', $result['direct_message']['text']);
2589 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2590 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2594 * Test the api_direct_messages_new() function with an RSS result.
2598 public function testApiDirectMessagesNewWithRss()
2600 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2601 $_POST['text'] = 'message_text';
2602 $_POST['screen_name'] = $this->friendUser['nick'];
2603 $result = api_direct_messages_new('rss');
2604 self::assertXml($result, 'direct-messages');
2608 * Test the api_direct_messages_destroy() function.
2612 public function testApiDirectMessagesDestroy()
2614 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2615 api_direct_messages_destroy('json');
2619 * Test the api_direct_messages_destroy() function with the friendica_verbose GET param.
2623 public function testApiDirectMessagesDestroyWithVerbose()
2625 $_GET['friendica_verbose'] = 'true';
2626 $result = api_direct_messages_destroy('json');
2630 'result' => 'error',
2631 'message' => 'message id or parenturi not specified'
2639 * Test the api_direct_messages_destroy() function without an authenticated user.
2643 public function testApiDirectMessagesDestroyWithoutAuthenticatedUser()
2645 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2646 BasicAuth::setCurrentUserID();
2647 $_SESSION['authenticated'] = false;
2648 api_direct_messages_destroy('json');
2652 * Test the api_direct_messages_destroy() function with a non-zero ID.
2656 public function testApiDirectMessagesDestroyWithId()
2658 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2659 $_REQUEST['id'] = 1;
2660 api_direct_messages_destroy('json');
2664 * Test the api_direct_messages_destroy() with a non-zero ID and the friendica_verbose GET param.
2668 public function testApiDirectMessagesDestroyWithIdAndVerbose()
2670 $_REQUEST['id'] = 1;
2671 $_REQUEST['friendica_parenturi'] = 'parent_uri';
2672 $_GET['friendica_verbose'] = 'true';
2673 $result = api_direct_messages_destroy('json');
2677 'result' => 'error',
2678 'message' => 'message id not in database'
2686 * Test the api_direct_messages_destroy() function with a non-zero ID.
2690 public function testApiDirectMessagesDestroyWithCorrectId()
2692 $this->markTestIncomplete('We need to add a dataset for this.');
2696 * Test the api_direct_messages_box() function.
2700 public function testApiDirectMessagesBoxWithSentbox()
2702 $_REQUEST['page'] = -1;
2703 $_REQUEST['max_id'] = 10;
2704 $result = api_direct_messages_box('json', 'sentbox', 'false');
2705 self::assertArrayHasKey('direct_message', $result);
2709 * Test the api_direct_messages_box() function.
2713 public function testApiDirectMessagesBoxWithConversation()
2715 $result = api_direct_messages_box('json', 'conversation', 'false');
2716 self::assertArrayHasKey('direct_message', $result);
2720 * Test the api_direct_messages_box() function.
2724 public function testApiDirectMessagesBoxWithAll()
2726 $result = api_direct_messages_box('json', 'all', 'false');
2727 self::assertArrayHasKey('direct_message', $result);
2731 * Test the api_direct_messages_box() function.
2735 public function testApiDirectMessagesBoxWithInbox()
2737 $result = api_direct_messages_box('json', 'inbox', 'false');
2738 self::assertArrayHasKey('direct_message', $result);
2742 * Test the api_direct_messages_box() function.
2746 public function testApiDirectMessagesBoxWithVerbose()
2748 $result = api_direct_messages_box('json', 'sentbox', 'true');
2752 'result' => 'error',
2753 'message' => 'no mails available'
2761 * Test the api_direct_messages_box() function with a RSS result.
2765 public function testApiDirectMessagesBoxWithRss()
2767 $result = api_direct_messages_box('rss', 'sentbox', 'false');
2768 self::assertXml($result, 'direct-messages');
2772 * Test the api_direct_messages_box() function without an authenticated user.
2776 public function testApiDirectMessagesBoxWithUnallowedUser()
2778 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2779 BasicAuth::setCurrentUserID();
2780 api_direct_messages_box('json', 'sentbox', 'false');
2784 * Test the api_direct_messages_sentbox() function.
2788 public function testApiDirectMessagesSentbox()
2790 $result = api_direct_messages_sentbox('json');
2791 self::assertArrayHasKey('direct_message', $result);
2795 * Test the api_direct_messages_inbox() function.
2799 public function testApiDirectMessagesInbox()
2801 $result = api_direct_messages_inbox('json');
2802 self::assertArrayHasKey('direct_message', $result);
2806 * Test the api_direct_messages_all() function.
2810 public function testApiDirectMessagesAll()
2812 $result = api_direct_messages_all('json');
2813 self::assertArrayHasKey('direct_message', $result);
2817 * Test the api_direct_messages_conversation() function.
2821 public function testApiDirectMessagesConversation()
2823 $result = api_direct_messages_conversation('json');
2824 self::assertArrayHasKey('direct_message', $result);
2828 * Test the api_oauth_request_token() function.
2832 public function testApiOauthRequestToken()
2834 $this->markTestIncomplete('exit() kills phpunit as well');
2838 * Test the api_oauth_access_token() function.
2842 public function testApiOauthAccessToken()
2844 $this->markTestIncomplete('exit() kills phpunit as well');
2848 * Test the api_fr_photos_list() function.
2852 public function testApiFrPhotosList()
2854 $result = api_fr_photos_list('json');
2855 self::assertArrayHasKey('photo', $result);
2859 * Test the api_fr_photos_list() function without an authenticated user.
2863 public function testApiFrPhotosListWithoutAuthenticatedUser()
2865 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2866 BasicAuth::setCurrentUserID();
2867 $_SESSION['authenticated'] = false;
2868 api_fr_photos_list('json');
2872 * Test the api_fr_photo_create_update() function.
2874 public function testApiFrPhotoCreateUpdate()
2876 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2877 api_fr_photo_create_update('json');
2881 * Test the api_fr_photo_create_update() function without an authenticated user.
2885 public function testApiFrPhotoCreateUpdateWithoutAuthenticatedUser()
2887 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2888 BasicAuth::setCurrentUserID();
2889 $_SESSION['authenticated'] = false;
2890 api_fr_photo_create_update('json');
2894 * Test the api_fr_photo_create_update() function with an album name.
2898 public function testApiFrPhotoCreateUpdateWithAlbum()
2900 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2901 $_REQUEST['album'] = 'album_name';
2902 api_fr_photo_create_update('json');
2906 * Test the api_fr_photo_create_update() function with the update mode.
2910 public function testApiFrPhotoCreateUpdateWithUpdate()
2912 $this->markTestIncomplete('We need to create a dataset for this');
2916 * Test the api_fr_photo_create_update() function with an uploaded file.
2920 public function testApiFrPhotoCreateUpdateWithFile()
2922 $this->markTestIncomplete();
2926 * Test the api_fr_photo_detail() function.
2930 public function testApiFrPhotoDetail()
2932 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2933 api_fr_photo_detail('json');
2937 * Test the api_fr_photo_detail() function without an authenticated user.
2941 public function testApiFrPhotoDetailWithoutAuthenticatedUser()
2943 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2944 BasicAuth::setCurrentUserID();
2945 $_SESSION['authenticated'] = false;
2946 api_fr_photo_detail('json');
2950 * Test the api_fr_photo_detail() function with a photo ID.
2954 public function testApiFrPhotoDetailWithPhotoId()
2956 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
2957 $_REQUEST['photo_id'] = 1;
2958 api_fr_photo_detail('json');
2962 * Test the api_fr_photo_detail() function with a correct photo ID.
2966 public function testApiFrPhotoDetailCorrectPhotoId()
2968 $this->markTestIncomplete('We need to create a dataset for this.');
2972 * Test the api_account_update_profile_image() function.
2976 public function testApiAccountUpdateProfileImage()
2978 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2979 api_account_update_profile_image('json');
2983 * Test the api_account_update_profile_image() function without an authenticated user.
2987 public function testApiAccountUpdateProfileImageWithoutAuthenticatedUser()
2989 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2990 BasicAuth::setCurrentUserID();
2991 $_SESSION['authenticated'] = false;
2992 api_account_update_profile_image('json');
2996 * Test the api_account_update_profile_image() function with an uploaded file.
3000 public function testApiAccountUpdateProfileImageWithUpload()
3002 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
3003 $this->markTestIncomplete();
3008 * Test the api_account_update_profile() function.
3012 public function testApiAccountUpdateProfile()
3014 $_POST['name'] = 'new_name';
3015 $_POST['description'] = 'new_description';
3016 $result = api_account_update_profile('json');
3017 // We can't use assertSelfUser() here because the user object is missing some properties.
3018 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
3019 self::assertEquals('DFRN', $result['user']['location']);
3020 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
3021 self::assertEquals('dfrn', $result['user']['network']);
3022 self::assertEquals('new_name', $result['user']['name']);
3023 self::assertEquals('new_description', $result['user']['description']);
3027 * Test the check_acl_input() function.
3031 public function testCheckAclInput()
3033 $result = check_acl_input('<aclstring>', BaseApi::getCurrentUserID());
3034 // Where does this result come from?
3035 self::assertEquals(1, $result);
3039 * Test the check_acl_input() function with an empty ACL string.
3043 public function testCheckAclInputWithEmptyAclString()
3045 $result = check_acl_input(' ', BaseApi::getCurrentUserID());
3046 self::assertFalse($result);
3050 * Test the save_media_to_database() function.
3054 public function testSaveMediaToDatabase()
3056 $this->markTestIncomplete();
3060 * Test the post_photo_item() function.
3064 public function testPostPhotoItem()
3066 $this->markTestIncomplete();
3070 * Test the prepare_photo_data() function.
3074 public function testPreparePhotoData()
3076 $this->markTestIncomplete();
3080 * Test the api_share_as_retweet() function with a valid item.
3084 public function testApiShareAsRetweetWithValidItem()
3086 $this->markTestIncomplete();
3090 * Test the api_in_reply_to() function.
3094 public function testApiInReplyTo()
3096 $result = api_in_reply_to(['id' => 0, 'parent' => 0, 'uri' => '', 'thr-parent' => '']);
3097 self::assertArrayHasKey('status_id', $result);
3098 self::assertArrayHasKey('user_id', $result);
3099 self::assertArrayHasKey('status_id_str', $result);
3100 self::assertArrayHasKey('user_id_str', $result);
3101 self::assertArrayHasKey('screen_name', $result);
3105 * Test the api_in_reply_to() function with a valid item.
3109 public function testApiInReplyToWithValidItem()
3111 $this->markTestIncomplete();
3115 * Test the api_clean_plain_items() function.
3119 public function testApiCleanPlainItems()
3121 $_REQUEST['include_entities'] = 'true';
3122 $result = api_clean_plain_items('some_text [url="some_url"]some_text[/url]');
3123 self::assertEquals('some_text [url="some_url"]"some_url"[/url]', $result);
3127 * Test the api_best_nickname() function with contacts.
3131 public function testApiBestNicknameWithContacts()
3133 $this->markTestIncomplete();
3137 * Test the api_friendica_group_show() function.
3141 public function testApiFriendicaGroupShow()
3143 $this->markTestIncomplete();
3147 * Test the api_friendica_group_delete() function.
3151 public function testApiFriendicaGroupDelete()
3153 $this->markTestIncomplete();
3157 * Test the api_lists_destroy() function.
3161 public function testApiListsDestroy()
3163 $this->markTestIncomplete();
3167 * Test the group_create() function.
3171 public function testGroupCreate()
3173 $this->markTestIncomplete();
3177 * Test the api_friendica_group_create() function.
3181 public function testApiFriendicaGroupCreate()
3183 $this->markTestIncomplete();
3187 * Test the api_lists_create() function.
3191 public function testApiListsCreate()
3193 $this->markTestIncomplete();
3197 * Test the api_friendica_group_update() function.
3201 public function testApiFriendicaGroupUpdate()
3203 $this->markTestIncomplete();
3207 * Test the api_lists_update() function.
3211 public function testApiListsUpdate()
3213 $this->markTestIncomplete();
3217 * Test the api_friendica_activity() function.
3221 public function testApiFriendicaActivity()
3223 $this->markTestIncomplete();
3227 * Test the api_friendica_notification_seen() function.
3231 public function testApiFriendicaNotificationSeen()
3233 $this->markTestIncomplete();
3237 * Test the api_friendica_direct_messages_setseen() function.
3241 public function testApiFriendicaDirectMessagesSetseen()
3243 $this->markTestIncomplete();
3247 * Test the api_friendica_direct_messages_search() function.
3251 public function testApiFriendicaDirectMessagesSearch()
3253 $this->markTestIncomplete();