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\Model\Post;
14 use Friendica\Module\Api\ApiResponse;
15 use Friendica\Module\BaseApi;
16 use Friendica\Network\HTTPException;
17 use Friendica\Security\BasicAuth;
18 use Friendica\Test\FixtureTest;
19 use Friendica\Util\Arrays;
20 use Friendica\Util\DateTimeFormat;
21 use Friendica\Util\Temporal;
22 use Monolog\Handler\TestHandler;
24 require_once __DIR__ . '/../../include/api.php';
27 * Tests for the API functions.
29 * Functions that use header() need to be tested in a separate process.
30 * @see https://phpunit.de/manual/5.7/en/appendixes.annotations.html#appendixes.annotations.runTestsInSeparateProcesses
32 * @backupGlobals enabled
34 class ApiTest extends FixtureTest
37 * @var TestHandler Can handle log-outputs
44 protected $friendUser;
48 protected $wrongUserId;
53 /** @var IManageConfigValues */
57 * Create variables used by tests.
59 protected function setUp() : void
61 global $API, $called_api;
67 /** @var IManageConfigValues $config */
68 $this->config = $this->dice->create(IManageConfigValues::class);
70 $this->config->set('system', 'url', 'http://localhost');
71 $this->config->set('system', 'hostname', 'localhost');
72 $this->config->set('system', 'worker_dont_fork', true);
75 $this->config->set('config', 'hostname', 'localhost');
76 $this->config->set('system', 'throttle_limit_day', 100);
77 $this->config->set('system', 'throttle_limit_week', 100);
78 $this->config->set('system', 'throttle_limit_month', 100);
79 $this->config->set('system', 'theme', 'system_theme');
83 $this->app = DI::app();
85 DI::args()->setArgc(1);
87 // User data that the test database is populated with
90 'name' => 'Self contact',
91 'nick' => 'selfcontact',
92 'nurl' => 'http://localhost/profile/selfcontact'
96 'name' => 'Friend contact',
97 'nick' => 'friendcontact',
98 'nurl' => 'http://localhost/profile/friendcontact'
102 'name' => 'othercontact',
103 'nick' => 'othercontact',
104 'nurl' => 'http://localhost/profile/othercontact'
107 // User ID that we know is not in the database
108 $this->wrongUserId = 666;
110 DI::session()->start();
112 // Most API require login so we force the session
114 'authenticated' => true,
115 'uid' => $this->selfUser['id']
117 BasicAuth::setCurrentUserID($this->selfUser['id']);
121 * Assert that an user array contains expected keys.
123 * @param array $user User array
127 private function assertSelfUser(array $user)
129 self::assertEquals($this->selfUser['id'], $user['uid']);
130 self::assertEquals($this->selfUser['id'], $user['cid']);
131 self::assertEquals(1, $user['self']);
132 self::assertEquals('DFRN', $user['location']);
133 self::assertEquals($this->selfUser['name'], $user['name']);
134 self::assertEquals($this->selfUser['nick'], $user['screen_name']);
135 self::assertEquals('dfrn', $user['network']);
136 self::assertTrue($user['verified']);
140 * Assert that an user array contains expected keys.
142 * @param array $user User array
146 private function assertOtherUser(array $user = [])
148 self::assertEquals($this->otherUser['id'], $user['id']);
149 self::assertEquals($this->otherUser['id'], $user['id_str']);
150 self::assertEquals(0, $user['self']);
151 self::assertEquals($this->otherUser['name'], $user['name']);
152 self::assertEquals($this->otherUser['nick'], $user['screen_name']);
153 self::assertFalse($user['verified']);
157 * Assert that a status array contains expected keys.
159 * @param array $status Status array
163 private function assertStatus(array $status = [])
165 self::assertIsString($status['text'] ?? '');
166 self::assertIsInt($status['id'] ?? '');
167 // We could probably do more checks here.
171 * Assert that a list array contains expected keys.
173 * @param array $list List array
177 private function assertList(array $list = [])
179 self::assertIsString($list['name']);
180 self::assertIsInt($list['id']);
181 self::assertIsString('string', $list['id_str']);
182 self::assertContains($list['mode'], ['public', 'private']);
183 // We could probably do more checks here.
187 * Assert that the string is XML and contain the root element.
189 * @param string $result XML string
190 * @param string $root_element Root element name
194 private function assertXml($result = '', $root_element = '')
196 self::assertStringStartsWith('<?xml version="1.0"?>', $result);
197 self::assertStringContainsString('<' . $root_element, $result);
198 // We could probably do more checks here.
202 * Get the path to a temporary empty PNG image.
204 * @return string Path
206 private function getTempImage()
208 $tmpFile = tempnam(sys_get_temp_dir(), 'tmp_file');
212 // Empty 1x1 px PNG image
213 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=='
221 * Test the api_user() function.
225 public function testApiUser()
227 self::assertEquals($this->selfUser['id'], BaseApi::getCurrentUserID());
231 * Test the api_user() function with an unallowed user.
235 public function testApiUserWithUnallowedUser()
237 // self::assertEquals(false, api_user());
241 * Test the api_source() function.
245 public function testApiSource()
247 self::assertEquals('api', api_source());
251 * Test the api_source() function with a Twidere user agent.
255 public function testApiSourceWithTwidere()
257 $_SERVER['HTTP_USER_AGENT'] = 'Twidere';
258 self::assertEquals('Twidere', api_source());
262 * Test the api_source() function with a GET parameter.
266 public function testApiSourceWithGet()
268 $_GET['source'] = 'source_name';
269 self::assertEquals('source_name', api_source());
273 * Test the api_date() function.
277 public function testApiDate()
279 self::assertEquals('Wed Oct 10 00:00:00 +0000 1990', DateTimeFormat::utc('1990-10-10', DateTimeFormat::API));
283 * Test the api_register_func() function.
287 public function testApiRegisterFunc()
299 self::assertTrue($API['api_path']['auth']);
300 self::assertEquals('method', $API['api_path']['method']);
301 self::assertTrue(is_callable($API['api_path']['func']));
305 * Test the BasicAuth::getCurrentUserID() function without any login.
307 * @runInSeparateProcess
308 * @preserveGlobalState disabled
309 * @preserveGlobalState disabled
311 public function testApiLoginWithoutLogin()
313 BasicAuth::setCurrentUserID();
314 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
315 BasicAuth::getCurrentUserID(true);
319 * Test the BasicAuth::getCurrentUserID() function with a bad login.
321 * @runInSeparateProcess
322 * @preserveGlobalState disabled
323 * @preserveGlobalState disabled
325 public function testApiLoginWithBadLogin()
327 BasicAuth::setCurrentUserID();
328 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
329 $_SERVER['PHP_AUTH_USER'] = 'user@server';
330 BasicAuth::getCurrentUserID(true);
334 * Test the BasicAuth::getCurrentUserID() function with oAuth.
338 public function testApiLoginWithOauth()
340 $this->markTestIncomplete('Can we test this easily?');
344 * Test the BasicAuth::getCurrentUserID() function with authentication provided by an addon.
348 public function testApiLoginWithAddonAuth()
350 $this->markTestIncomplete('Can we test this easily?');
354 * Test the BasicAuth::getCurrentUserID() function with a correct login.
356 * @runInSeparateProcess
357 * @preserveGlobalState disabled
358 * @doesNotPerformAssertions
360 public function testApiLoginWithCorrectLogin()
362 BasicAuth::setCurrentUserID();
363 $_SERVER['PHP_AUTH_USER'] = 'Test user';
364 $_SERVER['PHP_AUTH_PW'] = 'password';
365 BasicAuth::getCurrentUserID(true);
369 * Test the BasicAuth::getCurrentUserID() function with a remote user.
371 * @runInSeparateProcess
372 * @preserveGlobalState disabled
374 public function testApiLoginWithRemoteUser()
376 BasicAuth::setCurrentUserID();
377 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
378 $_SERVER['REDIRECT_REMOTE_USER'] = '123456dXNlcjpwYXNzd29yZA==';
379 BasicAuth::getCurrentUserID(true);
383 * Test the api_call() function.
385 * @runInSeparateProcess
386 * @preserveGlobalState disabled
388 public function testApiCall()
392 'method' => 'method',
393 'func' => function () {
394 return ['data' => ['some_data']];
397 $_SERVER['REQUEST_METHOD'] = 'method';
398 $_SERVER['QUERY_STRING'] = 'pagename=api_path';
399 $_GET['callback'] = 'callback_name';
401 $args = DI::args()->determine($_SERVER, $_GET);
404 'callback_name(["some_data"])',
405 api_call($this->app, $args)
410 * Test the api_call() function with the profiled enabled.
412 * @runInSeparateProcess
413 * @preserveGlobalState disabled
415 public function testApiCallWithProfiler()
419 'method' => 'method',
420 'func' => function () {
421 return ['data' => ['some_data']];
425 $_SERVER['REQUEST_METHOD'] = 'method';
426 $_SERVER['QUERY_STRING'] = 'pagename=api_path';
428 $args = DI::args()->determine($_SERVER, $_GET);
430 $this->config->set('system', 'profiler', true);
431 $this->config->set('rendertime', 'callstack', true);
432 $this->app->callstack = [
433 'database' => ['some_function' => 200],
434 'database_write' => ['some_function' => 200],
435 'cache' => ['some_function' => 200],
436 'cache_write' => ['some_function' => 200],
437 'network' => ['some_function' => 200]
442 api_call($this->app, $args)
447 * Test the api_call() function with a JSON result.
449 * @runInSeparateProcess
450 * @preserveGlobalState disabled
452 public function testApiCallWithJson()
456 'method' => 'method',
457 'func' => function () {
458 return ['data' => ['some_data']];
461 $_SERVER['REQUEST_METHOD'] = 'method';
462 $_SERVER['QUERY_STRING'] = 'pagename=api_path.json';
464 $args = DI::args()->determine($_SERVER, $_GET);
468 api_call($this->app, $args)
473 * Test the api_call() function with an XML result.
475 * @runInSeparateProcess
476 * @preserveGlobalState disabled
478 public function testApiCallWithXml()
482 'method' => 'method',
483 'func' => function () {
487 $_SERVER['REQUEST_METHOD'] = 'method';
488 $_SERVER['QUERY_STRING'] = 'pagename=api_path.xml';
490 $args = DI::args()->determine($_SERVER, $_GET);
494 api_call($this->app, $args)
499 * Test the api_call() function with an RSS result.
501 * @runInSeparateProcess
502 * @preserveGlobalState disabled
504 public function testApiCallWithRss()
508 'method' => 'method',
509 'func' => function () {
513 $_SERVER['REQUEST_METHOD'] = 'method';
514 $_SERVER['QUERY_STRING'] = 'pagename=api_path.rss';
516 $args = DI::args()->determine($_SERVER, $_GET);
519 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
521 api_call($this->app, $args)
526 * Test the api_call() function with an Atom result.
528 * @runInSeparateProcess
529 * @preserveGlobalState disabled
531 public function testApiCallWithAtom()
535 'method' => 'method',
536 'func' => function () {
540 $_SERVER['REQUEST_METHOD'] = 'method';
541 $_SERVER['QUERY_STRING'] = 'pagename=api_path.atom';
543 $args = DI::args()->determine($_SERVER, $_GET);
546 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
548 api_call($this->app, $args)
553 * Test the api_rss_extra() function.
557 public function testApiRssExtra()
560 $user_info = ['url' => 'user_url', 'lang' => 'en'];
561 $result = api_rss_extra([], $user_info);
562 self::assertEquals($user_info, $result['$user']);
563 self::assertEquals($user_info['url'], $result['$rss']['alternate']);
564 self::assertArrayHasKey('self', $result['$rss']);
565 self::assertArrayHasKey('base', $result['$rss']);
566 self::assertArrayHasKey('updated', $result['$rss']);
567 self::assertArrayHasKey('atom_updated', $result['$rss']);
568 self::assertArrayHasKey('language', $result['$rss']);
569 self::assertArrayHasKey('logo', $result['$rss']);
574 * Test the api_rss_extra() function without any user info.
578 public function testApiRssExtraWithoutUserInfo()
581 $result = api_rss_extra([], null);
582 self::assertIsArray($result['$user']);
583 self::assertArrayHasKey('alternate', $result['$rss']);
584 self::assertArrayHasKey('self', $result['$rss']);
585 self::assertArrayHasKey('base', $result['$rss']);
586 self::assertArrayHasKey('updated', $result['$rss']);
587 self::assertArrayHasKey('atom_updated', $result['$rss']);
588 self::assertArrayHasKey('language', $result['$rss']);
589 self::assertArrayHasKey('logo', $result['$rss']);
594 * Test the api_get_user() function.
598 public function testApiGetUser()
600 // $user = api_get_user();
601 // self::assertSelfUser($user);
602 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
603 // self::assertEquals('6fdbe8', $user['profile_link_color']);
604 // self::assertEquals('ededed', $user['profile_background_color']);
608 * Test the api_get_user() function with a Frio schema.
612 public function testApiGetUserWithFrioSchema()
614 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
615 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
616 // $user = api_get_user();
617 // self::assertSelfUser($user);
618 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
619 // self::assertEquals('6fdbe8', $user['profile_link_color']);
620 // self::assertEquals('ededed', $user['profile_background_color']);
624 * Test the api_get_user() function with an empty Frio schema.
628 public function testApiGetUserWithEmptyFrioSchema()
630 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
631 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
632 // $user = api_get_user();
633 // self::assertSelfUser($user);
634 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
635 // self::assertEquals('6fdbe8', $user['profile_link_color']);
636 // self::assertEquals('ededed', $user['profile_background_color']);
640 * Test the api_get_user() function with a custom Frio schema.
644 public function testApiGetUserWithCustomFrioSchema()
646 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
647 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
648 // $pConfig->set($this->selfUser['id'], 'frio', 'nav_bg', '#123456');
649 // $pConfig->set($this->selfUser['id'], 'frio', 'link_color', '#123456');
650 // $pConfig->set($this->selfUser['id'], 'frio', 'background_color', '#123456');
651 // $user = api_get_user();
652 // self::assertSelfUser($user);
653 // self::assertEquals('123456', $user['profile_sidebar_fill_color']);
654 // self::assertEquals('123456', $user['profile_link_color']);
655 // self::assertEquals('123456', $user['profile_background_color']);
659 * Test the api_get_user() function with an user that is not allowed to use the API.
661 * @runInSeparateProcess
662 * @preserveGlobalState disabled
664 public function testApiGetUserWithoutApiUser()
666 // api_get_user() with empty parameters is not used anymore
668 $_SERVER['PHP_AUTH_USER'] = 'Test user';
669 $_SERVER['PHP_AUTH_PW'] = 'password';
670 BasicAuth::setCurrentUserID();
671 self::assertFalse(api_get_user());
676 * Test the api_get_user() function with an user ID in a GET parameter.
680 public function testApiGetUserWithGetId()
682 // self::assertOtherUser(api_get_user());
686 * Test the api_get_user() function with a wrong user ID in a GET parameter.
690 public function testApiGetUserWithWrongGetId()
692 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
693 // self::assertOtherUser(api_get_user());
697 * Test the api_get_user() function with an user name in a GET parameter.
701 public function testApiGetUserWithGetName()
703 // self::assertSelfUser(api_get_user());
707 * Test the api_get_user() function with a profile URL in a GET parameter.
711 public function testApiGetUserWithGetUrl()
713 // self::assertSelfUser(api_get_user());
717 * Test the api_get_user() function with an user ID in the API path.
721 public function testApiGetUserWithNumericCalledApi()
723 // global $called_api;
724 // $called_api = ['api_path'];
725 // DI::args()->setArgv(['', $this->otherUser['id'] . '.json']);
726 // self::assertOtherUser(api_get_user());
730 * Test the api_get_user() function with the $called_api global variable.
734 public function testApiGetUserWithCalledApi()
736 // global $called_api;
737 // $called_api = ['api', 'api_path'];
738 // self::assertSelfUser(api_get_user());
742 * Test the api_get_user() function with a 0 user ID.
746 public function testApiGetUserWithZeroUser()
748 self::assertSelfUser(DI::twitterUser()->createFromUserId(BaseApi::getCurrentUserID())->toArray());
752 * Test the Arrays::walkRecursive() function.
756 public function testApiWalkRecursive()
761 Arrays::walkRecursive(
764 // Should we test this with a callback that actually does something?
772 * Test the Arrays::walkRecursive() function with an array.
776 public function testApiWalkRecursiveWithArray()
778 $array = [['item1'], ['item2']];
781 Arrays::walkRecursive(
784 // Should we test this with a callback that actually does something?
792 * Test the BaseApi::reformatXML() function.
796 public function testApiReformatXml()
800 self::assertTrue(ApiResponse::reformatXML($item, $key));
801 self::assertEquals('true', $item);
805 * Test the BaseApi::reformatXML() function with a statusnet_api key.
809 public function testApiReformatXmlWithStatusnetKey()
812 $key = 'statusnet_api';
813 self::assertTrue(ApiResponse::reformatXML($item, $key));
814 self::assertEquals('statusnet:api', $key);
818 * Test the BaseApi::reformatXML() function with a friendica_api key.
822 public function testApiReformatXmlWithFriendicaKey()
825 $key = 'friendica_api';
826 self::assertTrue(ApiResponse::reformatXML($item, $key));
827 self::assertEquals('friendica:api', $key);
831 * Test the BaseApi::createXML() function.
835 public function testApiCreateXml()
838 '<?xml version="1.0"?>' . "\n" .
839 '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
840 'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
841 'xmlns:georss="http://www.georss.org/georss">' . "\n" .
842 ' <data>some_data</data>' . "\n" .
843 '</root_element>' . "\n",
844 DI::apiResponse()->createXML(['data' => ['some_data']], 'root_element')
849 * Test the BaseApi::createXML() function without any XML namespace.
853 public function testApiCreateXmlWithoutNamespaces()
856 '<?xml version="1.0"?>' . "\n" .
858 ' <data>some_data</data>' . "\n" .
860 DI::apiResponse()->createXML(['data' => ['some_data']], 'ok')
865 * Test the BaseApi::formatData() function.
869 public function testApiFormatData()
871 $data = ['some_data'];
872 self::assertEquals($data, DI::apiResponse()->formatData('root_element', 'json', $data));
876 * Test the BaseApi::formatData() function with an XML result.
880 public function testApiFormatDataWithXml()
883 '<?xml version="1.0"?>' . "\n" .
884 '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
885 'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
886 'xmlns:georss="http://www.georss.org/georss">' . "\n" .
887 ' <data>some_data</data>' . "\n" .
888 '</root_element>' . "\n",
889 DI::apiResponse()->formatData('root_element', 'xml', ['data' => ['some_data']])
894 * Test the api_account_verify_credentials() function.
898 public function testApiAccountVerifyCredentials()
900 self::assertArrayHasKey('user', api_account_verify_credentials('json'));
904 * Test the api_account_verify_credentials() function without an authenticated user.
908 public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
910 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
911 BasicAuth::setCurrentUserID();
912 $_SESSION['authenticated'] = false;
913 api_account_verify_credentials('json');
917 * Test the requestdata() function.
921 public function testRequestdata()
923 self::assertNull(requestdata('variable_name'));
927 * Test the requestdata() function with a POST parameter.
931 public function testRequestdataWithPost()
933 $_POST['variable_name'] = 'variable_value';
934 self::assertEquals('variable_value', requestdata('variable_name'));
938 * Test the requestdata() function with a GET parameter.
942 public function testRequestdataWithGet()
944 $_GET['variable_name'] = 'variable_value';
945 self::assertEquals('variable_value', requestdata('variable_name'));
949 * Test the api_statuses_mediap() function.
953 public function testApiStatusesMediap()
955 DI::args()->setArgc(2);
963 'tmp_name' => $this->getTempImage(),
964 'name' => 'spacer.png',
965 'type' => 'image/png'
968 $_GET['status'] = '<b>Status content</b>';
970 $result = api_statuses_mediap('json');
971 self::assertStatus($result['status']);
975 * Test the api_statuses_mediap() function without an authenticated user.
979 public function testApiStatusesMediapWithoutAuthenticatedUser()
981 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
982 BasicAuth::setCurrentUserID();
983 $_SESSION['authenticated'] = false;
984 api_statuses_mediap('json');
988 * Test the api_statuses_update() function.
992 public function testApiStatusesUpdate()
994 $_GET['status'] = 'Status content #friendica';
995 $_GET['in_reply_to_status_id'] = -1;
1004 'tmp_name' => $this->getTempImage(),
1005 'name' => 'spacer.png',
1006 'type' => 'image/png'
1010 $result = api_statuses_update('json');
1011 self::assertStatus($result['status']);
1015 * Test the api_statuses_update() function with an HTML status.
1019 public function testApiStatusesUpdateWithHtml()
1021 $_GET['htmlstatus'] = '<b>Status content</b>';
1023 $result = api_statuses_update('json');
1024 self::assertStatus($result['status']);
1028 * Test the api_statuses_update() function without an authenticated user.
1032 public function testApiStatusesUpdateWithoutAuthenticatedUser()
1034 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1035 BasicAuth::setCurrentUserID();
1036 $_SESSION['authenticated'] = false;
1037 api_statuses_update('json');
1041 * Test the api_statuses_update() function with a parent status.
1045 public function testApiStatusesUpdateWithParent()
1047 $this->markTestIncomplete('This triggers an exit() somewhere and kills PHPUnit.');
1051 * Test the api_statuses_update() function with a media_ids parameter.
1055 public function testApiStatusesUpdateWithMediaIds()
1057 $this->markTestIncomplete();
1061 * Test the api_statuses_update() function with the throttle limit reached.
1065 public function testApiStatusesUpdateWithDayThrottleReached()
1067 $this->markTestIncomplete();
1071 * Test the api_media_upload() function.
1072 * @runInSeparateProcess
1073 * @preserveGlobalState disabled
1075 public function testApiMediaUpload()
1077 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1082 * Test the api_media_upload() function without an authenticated user.
1086 public function testApiMediaUploadWithoutAuthenticatedUser()
1088 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1089 BasicAuth::setCurrentUserID();
1090 $_SESSION['authenticated'] = false;
1095 * Test the api_media_upload() function with an invalid uploaded media.
1099 public function testApiMediaUploadWithMedia()
1101 $this->expectException(\Friendica\Network\HTTPException\InternalServerErrorException::class);
1105 'tmp_name' => 'tmp_name'
1112 * Test the api_media_upload() function with an valid uploaded media.
1116 public function testApiMediaUploadWithValidMedia()
1124 'tmp_name' => $this->getTempImage(),
1125 'name' => 'spacer.png',
1126 'type' => 'image/png'
1130 DI::args()->setArgc(2);
1132 $result = api_media_upload();
1133 self::assertEquals('image/png', $result['media']['image']['image_type']);
1134 self::assertEquals(1, $result['media']['image']['w']);
1135 self::assertEquals(1, $result['media']['image']['h']);
1136 self::assertNotEmpty($result['media']['image']['friendica_preview_url']);
1140 * Test the api_status_show() function.
1142 public function testApiStatusShowWithJson()
1144 $result = api_status_show('json', 1);
1145 self::assertStatus($result['status']);
1149 * Test the api_status_show() function with an XML result.
1151 public function testApiStatusShowWithXml()
1153 $result = api_status_show('xml', 1);
1154 self::assertXml($result, 'statuses');
1158 * Test the api_get_last_status() function
1160 public function testApiGetLastStatus()
1162 $item = api_get_last_status($this->selfUser['id'], $this->selfUser['id']);
1164 self::assertNotNull($item);
1168 * Test the api_users_show() function.
1172 public function testApiUsersShow()
1174 $result = api_users_show('json');
1175 // We can't use assertSelfUser() here because the user object is missing some properties.
1176 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
1177 self::assertEquals('DFRN', $result['user']['location']);
1178 self::assertEquals($this->selfUser['name'], $result['user']['name']);
1179 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
1180 self::assertEquals('dfrn', $result['user']['network']);
1181 self::assertTrue($result['user']['verified']);
1185 * Test the api_users_show() function with an XML result.
1189 public function testApiUsersShowWithXml()
1191 $result = api_users_show('xml');
1192 self::assertXml($result, 'statuses');
1196 * Test the api_users_search() function.
1200 public function testApiUsersSearch()
1202 $_GET['q'] = 'othercontact';
1203 $result = api_users_search('json');
1204 self::assertOtherUser($result['users'][0]);
1208 * Test the api_users_search() function with an XML result.
1212 public function testApiUsersSearchWithXml()
1214 $_GET['q'] = 'othercontact';
1215 $result = api_users_search('xml');
1216 self::assertXml($result, 'users');
1220 * Test the api_users_search() function without a GET q parameter.
1224 public function testApiUsersSearchWithoutQuery()
1226 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1227 api_users_search('json');
1231 * Test the api_users_lookup() function.
1235 public function testApiUsersLookup()
1237 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
1238 api_users_lookup('json');
1242 * Test the api_users_lookup() function with an user ID.
1246 public function testApiUsersLookupWithUserId()
1248 $_REQUEST['user_id'] = $this->otherUser['id'];
1249 $result = api_users_lookup('json');
1250 self::assertOtherUser($result['users'][0]);
1254 * Test the api_search() function.
1258 public function testApiSearch()
1260 $_REQUEST['q'] = 'reply';
1261 $_REQUEST['max_id'] = 10;
1262 $result = api_search('json');
1263 foreach ($result['status'] as $status) {
1264 self::assertStatus($status);
1265 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1270 * Test the api_search() function a count parameter.
1274 public function testApiSearchWithCount()
1276 $_REQUEST['q'] = 'reply';
1277 $_REQUEST['count'] = 20;
1278 $result = api_search('json');
1279 foreach ($result['status'] as $status) {
1280 self::assertStatus($status);
1281 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1286 * Test the api_search() function with an rpp parameter.
1290 public function testApiSearchWithRpp()
1292 $_REQUEST['q'] = 'reply';
1293 $_REQUEST['rpp'] = 20;
1294 $result = api_search('json');
1295 foreach ($result['status'] as $status) {
1296 self::assertStatus($status);
1297 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1302 * Test the api_search() function with an q parameter contains hashtag.
1303 * @doesNotPerformAssertions
1305 public function testApiSearchWithHashtag()
1307 $_REQUEST['q'] = '%23friendica';
1308 $result = api_search('json');
1309 foreach ($result['status'] as $status) {
1310 self::assertStatus($status);
1311 self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true);
1316 * Test the api_search() function with an exclude_replies parameter.
1317 * @doesNotPerformAssertions
1319 public function testApiSearchWithExcludeReplies()
1321 $_REQUEST['max_id'] = 10;
1322 $_REQUEST['exclude_replies'] = true;
1323 $_REQUEST['q'] = 'friendica';
1324 $result = api_search('json');
1325 foreach ($result['status'] as $status) {
1326 self::assertStatus($status);
1331 * Test the api_search() function without an authenticated user.
1335 public function testApiSearchWithUnallowedUser()
1337 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1338 BasicAuth::setCurrentUserID();
1343 * Test the api_search() function without any GET query parameter.
1347 public function testApiSearchWithoutQuery()
1349 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1354 * Test the api_statuses_home_timeline() function.
1358 public function testApiStatusesHomeTimeline()
1360 $_REQUEST['max_id'] = 10;
1361 $_REQUEST['exclude_replies'] = true;
1362 $_REQUEST['conversation_id'] = 1;
1363 $result = api_statuses_home_timeline('json');
1364 self::assertNotEmpty($result['status']);
1365 foreach ($result['status'] as $status) {
1366 self::assertStatus($status);
1371 * Test the api_statuses_home_timeline() function with a negative page parameter.
1375 public function testApiStatusesHomeTimelineWithNegativePage()
1377 $_REQUEST['page'] = -2;
1378 $result = api_statuses_home_timeline('json');
1379 self::assertNotEmpty($result['status']);
1380 foreach ($result['status'] as $status) {
1381 self::assertStatus($status);
1386 * Test the api_statuses_home_timeline() with an unallowed user.
1390 public function testApiStatusesHomeTimelineWithUnallowedUser()
1392 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1393 BasicAuth::setCurrentUserID();
1394 api_statuses_home_timeline('json');
1398 * Test the api_statuses_home_timeline() function with an RSS result.
1402 public function testApiStatusesHomeTimelineWithRss()
1404 $result = api_statuses_home_timeline('rss');
1405 self::assertXml($result, 'statuses');
1409 * Test the api_statuses_public_timeline() function.
1413 public function testApiStatusesPublicTimeline()
1415 $_REQUEST['max_id'] = 10;
1416 $_REQUEST['conversation_id'] = 1;
1417 $result = api_statuses_public_timeline('json');
1418 self::assertNotEmpty($result['status']);
1419 foreach ($result['status'] as $status) {
1420 self::assertStatus($status);
1425 * Test the api_statuses_public_timeline() function with the exclude_replies parameter.
1429 public function testApiStatusesPublicTimelineWithExcludeReplies()
1431 $_REQUEST['max_id'] = 10;
1432 $_REQUEST['exclude_replies'] = true;
1433 $result = api_statuses_public_timeline('json');
1434 self::assertNotEmpty($result['status']);
1435 foreach ($result['status'] as $status) {
1436 self::assertStatus($status);
1441 * Test the api_statuses_public_timeline() function with a negative page parameter.
1445 public function testApiStatusesPublicTimelineWithNegativePage()
1447 $_REQUEST['page'] = -2;
1448 $result = api_statuses_public_timeline('json');
1449 self::assertNotEmpty($result['status']);
1450 foreach ($result['status'] as $status) {
1451 self::assertStatus($status);
1456 * Test the api_statuses_public_timeline() function with an unallowed user.
1460 public function testApiStatusesPublicTimelineWithUnallowedUser()
1462 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1463 BasicAuth::setCurrentUserID();
1464 api_statuses_public_timeline('json');
1468 * Test the api_statuses_public_timeline() function with an RSS result.
1472 public function testApiStatusesPublicTimelineWithRss()
1474 $result = api_statuses_public_timeline('rss');
1475 self::assertXml($result, 'statuses');
1479 * Test the api_statuses_networkpublic_timeline() function.
1483 public function testApiStatusesNetworkpublicTimeline()
1485 $_REQUEST['max_id'] = 10;
1486 $result = api_statuses_networkpublic_timeline('json');
1487 self::assertNotEmpty($result['status']);
1488 foreach ($result['status'] as $status) {
1489 self::assertStatus($status);
1494 * Test the api_statuses_networkpublic_timeline() function with a negative page parameter.
1498 public function testApiStatusesNetworkpublicTimelineWithNegativePage()
1500 $_REQUEST['page'] = -2;
1501 $result = api_statuses_networkpublic_timeline('json');
1502 self::assertNotEmpty($result['status']);
1503 foreach ($result['status'] as $status) {
1504 self::assertStatus($status);
1509 * Test the api_statuses_networkpublic_timeline() function with an unallowed user.
1513 public function testApiStatusesNetworkpublicTimelineWithUnallowedUser()
1515 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1516 BasicAuth::setCurrentUserID();
1517 api_statuses_networkpublic_timeline('json');
1521 * Test the api_statuses_networkpublic_timeline() function with an RSS result.
1525 public function testApiStatusesNetworkpublicTimelineWithRss()
1527 $result = api_statuses_networkpublic_timeline('rss');
1528 self::assertXml($result, 'statuses');
1532 * Test the api_statuses_show() function.
1536 public function testApiStatusesShow()
1538 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1539 api_statuses_show('json');
1543 * Test the api_statuses_show() function with an ID.
1547 public function testApiStatusesShowWithId()
1549 DI::args()->setArgv(['', '', '', 1]);
1550 $result = api_statuses_show('json');
1551 self::assertStatus($result['status']);
1555 * Test the api_statuses_show() function with the conversation parameter.
1559 public function testApiStatusesShowWithConversation()
1561 DI::args()->setArgv(['', '', '', 1]);
1562 $_REQUEST['conversation'] = 1;
1563 $result = api_statuses_show('json');
1564 self::assertNotEmpty($result['status']);
1565 foreach ($result['status'] as $status) {
1566 self::assertStatus($status);
1571 * Test the api_statuses_show() function with an unallowed user.
1575 public function testApiStatusesShowWithUnallowedUser()
1577 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1578 BasicAuth::setCurrentUserID();
1579 api_statuses_show('json');
1583 * Test the api_conversation_show() function.
1587 public function testApiConversationShow()
1589 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1590 api_conversation_show('json');
1594 * Test the api_conversation_show() function with an ID.
1598 public function testApiConversationShowWithId()
1600 DI::args()->setArgv(['', '', '', 1]);
1601 $_REQUEST['max_id'] = 10;
1602 $_REQUEST['page'] = -2;
1603 $result = api_conversation_show('json');
1604 self::assertNotEmpty($result['status']);
1605 foreach ($result['status'] as $status) {
1606 self::assertStatus($status);
1611 * Test the api_conversation_show() function with an unallowed user.
1615 public function testApiConversationShowWithUnallowedUser()
1617 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1618 BasicAuth::setCurrentUserID();
1619 api_conversation_show('json');
1623 * Test the api_statuses_repeat() function.
1627 public function testApiStatusesRepeat()
1629 $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
1630 api_statuses_repeat('json');
1634 * Test the api_statuses_repeat() function without an authenticated user.
1638 public function testApiStatusesRepeatWithoutAuthenticatedUser()
1640 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1641 BasicAuth::setCurrentUserID();
1642 $_SESSION['authenticated'] = false;
1643 api_statuses_repeat('json');
1647 * Test the api_statuses_repeat() function with an ID.
1651 public function testApiStatusesRepeatWithId()
1653 DI::args()->setArgv(['', '', '', 1]);
1654 $result = api_statuses_repeat('json');
1655 self::assertStatus($result['status']);
1657 // Also test with a shared status
1658 DI::args()->setArgv(['', '', '', 5]);
1659 $result = api_statuses_repeat('json');
1660 self::assertStatus($result['status']);
1664 * Test the api_statuses_destroy() function.
1668 public function testApiStatusesDestroy()
1670 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1671 api_statuses_destroy('json');
1675 * Test the api_statuses_destroy() function without an authenticated user.
1679 public function testApiStatusesDestroyWithoutAuthenticatedUser()
1681 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1682 BasicAuth::setCurrentUserID();
1683 $_SESSION['authenticated'] = false;
1684 api_statuses_destroy('json');
1688 * Test the api_statuses_destroy() function with an ID.
1692 public function testApiStatusesDestroyWithId()
1694 DI::args()->setArgv(['', '', '', 1]);
1695 $result = api_statuses_destroy('json');
1696 self::assertStatus($result['status']);
1700 * Test the api_statuses_mentions() function.
1704 public function testApiStatusesMentions()
1706 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
1707 $_REQUEST['max_id'] = 10;
1708 $result = api_statuses_mentions('json');
1709 self::assertEmpty($result['status']);
1710 // We should test with mentions in the database.
1714 * Test the api_statuses_mentions() function with a negative page parameter.
1718 public function testApiStatusesMentionsWithNegativePage()
1720 $_REQUEST['page'] = -2;
1721 $result = api_statuses_mentions('json');
1722 self::assertEmpty($result['status']);
1726 * Test the api_statuses_mentions() function with an unallowed user.
1730 public function testApiStatusesMentionsWithUnallowedUser()
1732 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1733 BasicAuth::setCurrentUserID();
1734 api_statuses_mentions('json');
1738 * Test the api_statuses_mentions() function with an RSS result.
1742 public function testApiStatusesMentionsWithRss()
1744 $result = api_statuses_mentions('rss');
1745 self::assertXml($result, 'statuses');
1749 * Test the api_statuses_user_timeline() function.
1753 public function testApiStatusesUserTimeline()
1755 $_REQUEST['user_id'] = 42;
1756 $_REQUEST['max_id'] = 10;
1757 $_REQUEST['exclude_replies'] = true;
1758 $_REQUEST['conversation_id'] = 7;
1760 $result = api_statuses_user_timeline('json');
1761 self::assertNotEmpty($result['status']);
1762 foreach ($result['status'] as $status) {
1763 self::assertStatus($status);
1768 * Test the api_statuses_user_timeline() function with a negative page parameter.
1772 public function testApiStatusesUserTimelineWithNegativePage()
1774 $_REQUEST['user_id'] = 42;
1775 $_REQUEST['page'] = -2;
1777 $result = api_statuses_user_timeline('json');
1778 self::assertNotEmpty($result['status']);
1779 foreach ($result['status'] as $status) {
1780 self::assertStatus($status);
1785 * Test the api_statuses_user_timeline() function with an RSS result.
1789 public function testApiStatusesUserTimelineWithRss()
1791 $result = api_statuses_user_timeline('rss');
1792 self::assertXml($result, 'statuses');
1796 * Test the api_statuses_user_timeline() function with an unallowed user.
1800 public function testApiStatusesUserTimelineWithUnallowedUser()
1802 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1803 BasicAuth::setCurrentUserID();
1804 api_statuses_user_timeline('json');
1808 * Test the api_favorites_create_destroy() function.
1812 public function testApiFavoritesCreateDestroy()
1814 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1815 DI::args()->setArgv(['api', '1.1', 'favorites', 'create']);
1816 api_favorites_create_destroy('json');
1820 * Test the api_favorites_create_destroy() function with an invalid ID.
1824 public function testApiFavoritesCreateDestroyWithInvalidId()
1826 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1827 DI::args()->setArgv(['api', '1.1', 'favorites', 'create', '12.json']);
1828 api_favorites_create_destroy('json');
1832 * Test the api_favorites_create_destroy() function with an invalid action.
1836 public function testApiFavoritesCreateDestroyWithInvalidAction()
1838 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1839 DI::args()->setArgv(['api', '1.1', 'favorites', 'change.json']);
1840 $_REQUEST['id'] = 1;
1841 api_favorites_create_destroy('json');
1845 * Test the api_favorites_create_destroy() function with the create action.
1849 public function testApiFavoritesCreateDestroyWithCreateAction()
1851 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1852 $_REQUEST['id'] = 3;
1853 $result = api_favorites_create_destroy('json');
1854 self::assertStatus($result['status']);
1858 * Test the api_favorites_create_destroy() function with the create action and an RSS result.
1862 public function testApiFavoritesCreateDestroyWithCreateActionAndRss()
1864 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.rss']);
1865 $_REQUEST['id'] = 3;
1866 $result = api_favorites_create_destroy('rss');
1867 self::assertXml($result, 'status');
1871 * Test the api_favorites_create_destroy() function with the destroy action.
1875 public function testApiFavoritesCreateDestroyWithDestroyAction()
1877 DI::args()->setArgv(['api', '1.1', 'favorites', 'destroy.json']);
1878 $_REQUEST['id'] = 3;
1879 $result = api_favorites_create_destroy('json');
1880 self::assertStatus($result['status']);
1884 * Test the api_favorites_create_destroy() function without an authenticated user.
1888 public function testApiFavoritesCreateDestroyWithoutAuthenticatedUser()
1890 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1891 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1892 BasicAuth::setCurrentUserID();
1893 $_SESSION['authenticated'] = false;
1894 api_favorites_create_destroy('json');
1898 * Test the api_favorites() function.
1902 public function testApiFavorites()
1904 $_REQUEST['page'] = -1;
1905 $_REQUEST['max_id'] = 10;
1906 $result = api_favorites('json');
1907 foreach ($result['status'] as $status) {
1908 self::assertStatus($status);
1913 * Test the api_favorites() function with an RSS result.
1917 public function testApiFavoritesWithRss()
1919 $result = api_favorites('rss');
1920 self::assertXml($result, 'statuses');
1924 * Test the api_favorites() function with an unallowed user.
1928 public function testApiFavoritesWithUnallowedUser()
1930 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1931 BasicAuth::setCurrentUserID();
1932 api_favorites('json');
1936 * Test the api_format_messages() function.
1940 public function testApiFormatMessages()
1942 $result = api_format_messages(
1943 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1944 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1945 ['id' => 3, 'uri-id' => 2, 'screen_name' => 'sender_name']
1947 self::assertEquals('item_title' . "\n" . 'item_body', $result['text']);
1948 self::assertEquals(1, $result['id']);
1949 self::assertEquals(2, $result['recipient_id']);
1950 self::assertEquals(3, $result['sender_id']);
1951 self::assertEquals('recipient_name', $result['recipient_screen_name']);
1952 self::assertEquals('sender_name', $result['sender_screen_name']);
1956 * Test the api_format_messages() function with HTML.
1960 public function testApiFormatMessagesWithHtmlText()
1962 $_GET['getText'] = 'html';
1963 $result = api_format_messages(
1964 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1965 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1966 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1968 self::assertEquals('item_title', $result['title']);
1969 self::assertEquals('<strong>item_body</strong>', $result['text']);
1973 * Test the api_format_messages() function with plain text.
1977 public function testApiFormatMessagesWithPlainText()
1979 $_GET['getText'] = 'plain';
1980 $result = api_format_messages(
1981 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1982 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1983 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1985 self::assertEquals('item_title', $result['title']);
1986 self::assertEquals('item_body', $result['text']);
1990 * Test the api_format_messages() function with the getUserObjects GET parameter set to false.
1994 public function testApiFormatMessagesWithoutUserObjects()
1996 $_GET['getUserObjects'] = 'false';
1997 $result = api_format_messages(
1998 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1999 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
2000 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
2002 self::assertTrue(!isset($result['sender']));
2003 self::assertTrue(!isset($result['recipient']));
2007 * Test the api_convert_item() function.
2011 public function testApiConvertItem()
2013 $result = api_convert_item(
2015 'network' => 'feed',
2016 'title' => 'item_title',
2018 // We need a long string to test that it is correctly cut
2019 'body' => 'perspiciatis impedit voluptatem quis molestiae ea qui ' .
2020 'reiciendis dolorum aut ducimus sunt consequatur inventore dolor ' .
2021 'officiis pariatur doloremque nemo culpa aut quidem qui dolore ' .
2022 'laudantium atque commodi alias voluptatem non possimus aperiam ' .
2023 'ipsum rerum consequuntur aut amet fugit quia aliquid praesentium ' .
2024 'repellendus quibusdam et et inventore mollitia rerum sit autem ' .
2025 'pariatur maiores ipsum accusantium perferendis vel sit possimus ' .
2026 'veritatis nihil distinctio qui eum repellat officia illum quos ' .
2027 'impedit quam iste esse unde qui suscipit aut facilis ut inventore ' .
2028 'omnis exercitationem quo magnam consequatur maxime aut illum ' .
2029 'soluta quaerat natus unde aspernatur et sed beatae nihil ullam ' .
2030 'temporibus corporis ratione blanditiis perspiciatis impedit ' .
2031 'voluptatem quis molestiae ea qui reiciendis dolorum aut ducimus ' .
2032 'sunt consequatur inventore dolor officiis pariatur doloremque ' .
2033 'nemo culpa aut quidem qui dolore laudantium atque commodi alias ' .
2034 'voluptatem non possimus aperiam ipsum rerum consequuntur aut ' .
2035 'amet fugit quia aliquid praesentium repellendus quibusdam et et ' .
2036 'inventore mollitia rerum sit autem pariatur maiores ipsum accusantium ' .
2037 'perferendis vel sit possimus veritatis nihil distinctio qui eum ' .
2038 'repellat officia illum quos impedit quam iste esse unde qui ' .
2039 'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
2040 'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
2041 'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
2042 'plink' => 'item_plink'
2045 self::assertStringStartsWith('item_title', $result['text']);
2046 self::assertStringStartsWith('<h4>item_title</h4><br>perspiciatis impedit voluptatem', $result['html']);
2050 * Test the api_convert_item() function with an empty item body.
2054 public function testApiConvertItemWithoutBody()
2056 $result = api_convert_item(
2058 'network' => 'feed',
2059 'title' => 'item_title',
2062 'plink' => 'item_plink'
2065 self::assertEquals("item_title", $result['text']);
2066 self::assertEquals('<h4>item_title</h4><br>item_plink', $result['html']);
2070 * Test the api_convert_item() function with the title in the body.
2074 public function testApiConvertItemWithTitleInBody()
2076 $result = api_convert_item(
2078 'title' => 'item_title',
2079 'body' => 'item_title item_body',
2083 self::assertEquals('item_title item_body', $result['text']);
2084 self::assertEquals('<h4>item_title</h4><br>item_title item_body', $result['html']);
2088 * Test the api_get_attachments() function.
2092 public function testApiGetAttachments()
2095 self::assertEmpty(api_get_attachments($body, 0));
2099 * Test the api_get_attachments() function with an img tag.
2103 public function testApiGetAttachmentsWithImage()
2105 $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2106 self::assertIsArray(api_get_attachments($body, 0));
2110 * Test the api_get_attachments() function with an img tag and an AndStatus user agent.
2114 public function testApiGetAttachmentsWithImageAndAndStatus()
2116 $_SERVER['HTTP_USER_AGENT'] = 'AndStatus';
2117 $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2118 self::assertIsArray(api_get_attachments($body, 0));
2122 * Test the api_get_entitities() function.
2126 public function testApiGetEntitities()
2129 self::assertIsArray(api_get_entitities($text, 'bbcode', 0));
2133 * Test the api_get_entitities() function with the include_entities parameter.
2137 public function testApiGetEntititiesWithIncludeEntities()
2139 $_REQUEST['include_entities'] = 'true';
2141 $result = api_get_entitities($text, 'bbcode', 0);
2142 self::assertIsArray($result['hashtags']);
2143 self::assertIsArray($result['symbols']);
2144 self::assertIsArray($result['urls']);
2145 self::assertIsArray($result['user_mentions']);
2149 * Test the api_format_items_embeded_images() function.
2153 public function testApiFormatItemsEmbededImages()
2156 'text ' . DI::baseUrl() . '/display/item_guid',
2157 api_format_items_embeded_images(['guid' => 'item_guid'], 'text data:image/foo')
2162 * Test the api_contactlink_to_array() function.
2166 public function testApiContactlinkToArray()
2173 api_contactlink_to_array('text')
2178 * Test the api_contactlink_to_array() function with an URL.
2182 public function testApiContactlinkToArrayWithUrl()
2186 'name' => ['link_text'],
2189 api_contactlink_to_array('text <a href="url">link_text</a>')
2194 * Test the api_format_items_activities() function.
2198 public function testApiFormatItemsActivities()
2200 $item = ['uid' => 0, 'uri' => ''];
2201 $result = api_format_items_activities($item);
2202 self::assertArrayHasKey('like', $result);
2203 self::assertArrayHasKey('dislike', $result);
2204 self::assertArrayHasKey('attendyes', $result);
2205 self::assertArrayHasKey('attendno', $result);
2206 self::assertArrayHasKey('attendmaybe', $result);
2210 * Test the api_format_items_activities() function with an XML result.
2214 public function testApiFormatItemsActivitiesWithXml()
2216 $item = ['uid' => 0, 'uri' => ''];
2217 $result = api_format_items_activities($item, 'xml');
2218 self::assertArrayHasKey('friendica:like', $result);
2219 self::assertArrayHasKey('friendica:dislike', $result);
2220 self::assertArrayHasKey('friendica:attendyes', $result);
2221 self::assertArrayHasKey('friendica:attendno', $result);
2222 self::assertArrayHasKey('friendica:attendmaybe', $result);
2226 * Test the api_format_items() function.
2227 * @doesNotPerformAssertions
2229 public function testApiFormatItems()
2231 $items = Post::selectToArray([], ['uid' => 42]);
2232 foreach ($items as $item) {
2233 $status = api_format_item($item);
2234 self::assertStatus($status);
2239 * Test the api_format_items() function with an XML result.
2240 * @doesNotPerformAssertions
2242 public function testApiFormatItemsWithXml()
2244 $items = Post::selectToArray([], ['uid' => 42]);
2245 foreach ($items as $item) {
2246 $status = api_format_item($item, 'xml');
2247 self::assertStatus($status);
2252 * Test the api_lists_list() function.
2256 public function testApiListsList()
2258 $result = api_lists_list('json');
2259 self::assertEquals(['lists_list' => []], $result);
2263 * Test the api_lists_ownerships() function.
2267 public function testApiListsOwnerships()
2269 $result = api_lists_ownerships('json');
2270 foreach ($result['lists']['lists'] as $list) {
2271 self::assertList($list);
2276 * Test the api_lists_ownerships() function without an authenticated user.
2280 public function testApiListsOwnershipsWithoutAuthenticatedUser()
2282 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2283 BasicAuth::setCurrentUserID();
2284 $_SESSION['authenticated'] = false;
2285 api_lists_ownerships('json');
2289 * Test the api_lists_statuses() function.
2293 public function testApiListsStatuses()
2295 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2296 api_lists_statuses('json');
2300 * Test the api_lists_statuses() function with a list ID.
2301 * @doesNotPerformAssertions
2303 public function testApiListsStatusesWithListId()
2305 $_REQUEST['list_id'] = 1;
2306 $_REQUEST['page'] = -1;
2307 $_REQUEST['max_id'] = 10;
2308 $result = api_lists_statuses('json');
2309 foreach ($result['status'] as $status) {
2310 self::assertStatus($status);
2315 * Test the api_lists_statuses() function with a list ID and a RSS result.
2319 public function testApiListsStatusesWithListIdAndRss()
2321 $_REQUEST['list_id'] = 1;
2322 $result = api_lists_statuses('rss');
2323 self::assertXml($result, 'statuses');
2327 * Test the api_lists_statuses() function with an unallowed user.
2331 public function testApiListsStatusesWithUnallowedUser()
2333 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2334 BasicAuth::setCurrentUserID();
2335 api_lists_statuses('json');
2339 * Test the api_statuses_f() function.
2343 public function testApiStatusesFWithFriends()
2346 $result = api_statuses_f('friends');
2347 self::assertArrayHasKey('user', $result);
2351 * Test the api_statuses_f() function.
2355 public function testApiStatusesFWithFollowers()
2357 $result = api_statuses_f('followers');
2358 self::assertArrayHasKey('user', $result);
2362 * Test the api_statuses_f() function.
2366 public function testApiStatusesFWithBlocks()
2368 $result = api_statuses_f('blocks');
2369 self::assertArrayHasKey('user', $result);
2373 * Test the api_statuses_f() function.
2377 public function testApiStatusesFWithIncoming()
2379 $result = api_statuses_f('incoming');
2380 self::assertArrayHasKey('user', $result);
2384 * Test the api_statuses_f() function an undefined cursor GET variable.
2388 public function testApiStatusesFWithUndefinedCursor()
2390 $_GET['cursor'] = 'undefined';
2391 self::assertFalse(api_statuses_f('friends'));
2395 * Test the api_statuses_friends() function.
2399 public function testApiStatusesFriends()
2401 $result = api_statuses_friends('json');
2402 self::assertArrayHasKey('user', $result);
2406 * Test the api_statuses_friends() function an undefined cursor GET variable.
2410 public function testApiStatusesFriendsWithUndefinedCursor()
2412 $_GET['cursor'] = 'undefined';
2413 self::assertFalse(api_statuses_friends('json'));
2417 * Test the api_statuses_followers() function.
2421 public function testApiStatusesFollowers()
2423 $result = api_statuses_followers('json');
2424 self::assertArrayHasKey('user', $result);
2428 * Test the api_statuses_followers() function an undefined cursor GET variable.
2432 public function testApiStatusesFollowersWithUndefinedCursor()
2434 $_GET['cursor'] = 'undefined';
2435 self::assertFalse(api_statuses_followers('json'));
2439 * Test the api_blocks_list() function.
2443 public function testApiBlocksList()
2445 $result = api_blocks_list('json');
2446 self::assertArrayHasKey('user', $result);
2450 * Test the api_blocks_list() function an undefined cursor GET variable.
2454 public function testApiBlocksListWithUndefinedCursor()
2456 $_GET['cursor'] = 'undefined';
2457 self::assertFalse(api_blocks_list('json'));
2461 * Test the api_friendships_incoming() function.
2465 public function testApiFriendshipsIncoming()
2467 $result = api_friendships_incoming('json');
2468 self::assertArrayHasKey('id', $result);
2472 * Test the api_friendships_incoming() function an undefined cursor GET variable.
2476 public function testApiFriendshipsIncomingWithUndefinedCursor()
2478 $_GET['cursor'] = 'undefined';
2479 self::assertFalse(api_friendships_incoming('json'));
2483 * Test the api_statusnet_config() function.
2487 public function testApiStatusnetConfig()
2490 $result = api_statusnet_config('json');
2491 self::assertEquals('localhost', $result['config']['site']['server']);
2492 self::assertEquals('default', $result['config']['site']['theme']);
2493 self::assertEquals(DI::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']);
2494 self::assertTrue($result['config']['site']['fancy']);
2495 self::assertEquals('en', $result['config']['site']['language']);
2496 self::assertEquals('UTC', $result['config']['site']['timezone']);
2497 self::assertEquals(200000, $result['config']['site']['textlimit']);
2498 self::assertEquals('false', $result['config']['site']['private']);
2499 self::assertEquals('false', $result['config']['site']['ssl']);
2500 self::assertEquals(30, $result['config']['site']['shorturllength']);
2505 * Test the api_direct_messages_new() function.
2509 public function testApiDirectMessagesNew()
2511 $result = api_direct_messages_new('json');
2512 self::assertNull($result);
2516 * Test the api_direct_messages_new() function without an authenticated user.
2520 public function testApiDirectMessagesNewWithoutAuthenticatedUser()
2522 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2523 BasicAuth::setCurrentUserID();
2524 $_SESSION['authenticated'] = false;
2525 api_direct_messages_new('json');
2529 * Test the api_direct_messages_new() function with an user ID.
2533 public function testApiDirectMessagesNewWithUserId()
2535 $_POST['text'] = 'message_text';
2536 $_POST['user_id'] = $this->otherUser['id'];
2537 $result = api_direct_messages_new('json');
2538 self::assertEquals(['direct_message' => ['error' => -1]], $result);
2542 * Test the api_direct_messages_new() function with a screen name.
2546 public function testApiDirectMessagesNewWithScreenName()
2548 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2549 $_POST['text'] = 'message_text';
2550 $_POST['user_id'] = $this->friendUser['id'];
2551 $result = api_direct_messages_new('json');
2552 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2553 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2554 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2558 * Test the api_direct_messages_new() function with a title.
2562 public function testApiDirectMessagesNewWithTitle()
2564 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2565 $_POST['text'] = 'message_text';
2566 $_POST['user_id'] = $this->friendUser['id'];
2567 $_REQUEST['title'] = 'message_title';
2568 $result = api_direct_messages_new('json');
2569 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2570 self::assertStringContainsString('message_title', $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 an RSS result.
2580 public function testApiDirectMessagesNewWithRss()
2582 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2583 $_POST['text'] = 'message_text';
2584 $_POST['user_id'] = $this->friendUser['id'];
2585 $result = api_direct_messages_new('rss');
2586 self::assertXml($result, 'direct-messages');
2590 * Test the api_direct_messages_destroy() function.
2594 public function testApiDirectMessagesDestroy()
2596 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2597 api_direct_messages_destroy('json');
2601 * Test the api_direct_messages_destroy() function with the friendica_verbose GET param.
2605 public function testApiDirectMessagesDestroyWithVerbose()
2607 $_GET['friendica_verbose'] = 'true';
2608 $result = api_direct_messages_destroy('json');
2612 'result' => 'error',
2613 'message' => 'message id or parenturi not specified'
2621 * Test the api_direct_messages_destroy() function without an authenticated user.
2625 public function testApiDirectMessagesDestroyWithoutAuthenticatedUser()
2627 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2628 BasicAuth::setCurrentUserID();
2629 $_SESSION['authenticated'] = false;
2630 api_direct_messages_destroy('json');
2634 * Test the api_direct_messages_destroy() function with a non-zero ID.
2638 public function testApiDirectMessagesDestroyWithId()
2640 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2641 $_REQUEST['id'] = 1;
2642 api_direct_messages_destroy('json');
2646 * Test the api_direct_messages_destroy() with a non-zero ID and the friendica_verbose GET param.
2650 public function testApiDirectMessagesDestroyWithIdAndVerbose()
2652 $_REQUEST['id'] = 1;
2653 $_REQUEST['friendica_parenturi'] = 'parent_uri';
2654 $_GET['friendica_verbose'] = 'true';
2655 $result = api_direct_messages_destroy('json');
2659 'result' => 'error',
2660 'message' => 'message id not in database'
2668 * Test the api_direct_messages_destroy() function with a non-zero ID.
2672 public function testApiDirectMessagesDestroyWithCorrectId()
2674 $this->markTestIncomplete('We need to add a dataset for this.');
2678 * Test the api_direct_messages_box() function.
2682 public function testApiDirectMessagesBoxWithSentbox()
2684 $_REQUEST['page'] = -1;
2685 $_REQUEST['max_id'] = 10;
2686 $result = api_direct_messages_box('json', 'sentbox', 'false');
2687 self::assertArrayHasKey('direct_message', $result);
2691 * Test the api_direct_messages_box() function.
2695 public function testApiDirectMessagesBoxWithConversation()
2697 $result = api_direct_messages_box('json', 'conversation', 'false');
2698 self::assertArrayHasKey('direct_message', $result);
2702 * Test the api_direct_messages_box() function.
2706 public function testApiDirectMessagesBoxWithAll()
2708 $result = api_direct_messages_box('json', 'all', 'false');
2709 self::assertArrayHasKey('direct_message', $result);
2713 * Test the api_direct_messages_box() function.
2717 public function testApiDirectMessagesBoxWithInbox()
2719 $result = api_direct_messages_box('json', 'inbox', 'false');
2720 self::assertArrayHasKey('direct_message', $result);
2724 * Test the api_direct_messages_box() function.
2728 public function testApiDirectMessagesBoxWithVerbose()
2730 $result = api_direct_messages_box('json', 'sentbox', 'true');
2734 'result' => 'error',
2735 'message' => 'no mails available'
2743 * Test the api_direct_messages_box() function with a RSS result.
2747 public function testApiDirectMessagesBoxWithRss()
2749 $result = api_direct_messages_box('rss', 'sentbox', 'false');
2750 self::assertXml($result, 'direct-messages');
2754 * Test the api_direct_messages_box() function without an authenticated user.
2758 public function testApiDirectMessagesBoxWithUnallowedUser()
2760 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2761 BasicAuth::setCurrentUserID();
2762 api_direct_messages_box('json', 'sentbox', 'false');
2766 * Test the api_direct_messages_sentbox() function.
2770 public function testApiDirectMessagesSentbox()
2772 $result = api_direct_messages_sentbox('json');
2773 self::assertArrayHasKey('direct_message', $result);
2777 * Test the api_direct_messages_inbox() function.
2781 public function testApiDirectMessagesInbox()
2783 $result = api_direct_messages_inbox('json');
2784 self::assertArrayHasKey('direct_message', $result);
2788 * Test the api_direct_messages_all() function.
2792 public function testApiDirectMessagesAll()
2794 $result = api_direct_messages_all('json');
2795 self::assertArrayHasKey('direct_message', $result);
2799 * Test the api_direct_messages_conversation() function.
2803 public function testApiDirectMessagesConversation()
2805 $result = api_direct_messages_conversation('json');
2806 self::assertArrayHasKey('direct_message', $result);
2810 * Test the api_oauth_request_token() function.
2814 public function testApiOauthRequestToken()
2816 $this->markTestIncomplete('exit() kills phpunit as well');
2820 * Test the api_oauth_access_token() function.
2824 public function testApiOauthAccessToken()
2826 $this->markTestIncomplete('exit() kills phpunit as well');
2830 * Test the api_fr_photos_list() function.
2834 public function testApiFrPhotosList()
2836 $result = api_fr_photos_list('json');
2837 self::assertArrayHasKey('photo', $result);
2841 * Test the api_fr_photos_list() function without an authenticated user.
2845 public function testApiFrPhotosListWithoutAuthenticatedUser()
2847 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2848 BasicAuth::setCurrentUserID();
2849 $_SESSION['authenticated'] = false;
2850 api_fr_photos_list('json');
2854 * Test the api_fr_photo_create_update() function.
2856 public function testApiFrPhotoCreateUpdate()
2858 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2859 api_fr_photo_create_update('json');
2863 * Test the api_fr_photo_create_update() function without an authenticated user.
2867 public function testApiFrPhotoCreateUpdateWithoutAuthenticatedUser()
2869 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2870 BasicAuth::setCurrentUserID();
2871 $_SESSION['authenticated'] = false;
2872 api_fr_photo_create_update('json');
2876 * Test the api_fr_photo_create_update() function with an album name.
2880 public function testApiFrPhotoCreateUpdateWithAlbum()
2882 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2883 $_REQUEST['album'] = 'album_name';
2884 api_fr_photo_create_update('json');
2888 * Test the api_fr_photo_create_update() function with the update mode.
2892 public function testApiFrPhotoCreateUpdateWithUpdate()
2894 $this->markTestIncomplete('We need to create a dataset for this');
2898 * Test the api_fr_photo_create_update() function with an uploaded file.
2902 public function testApiFrPhotoCreateUpdateWithFile()
2904 $this->markTestIncomplete();
2908 * Test the api_fr_photo_detail() function.
2912 public function testApiFrPhotoDetail()
2914 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2915 api_fr_photo_detail('json');
2919 * Test the api_fr_photo_detail() function without an authenticated user.
2923 public function testApiFrPhotoDetailWithoutAuthenticatedUser()
2925 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2926 BasicAuth::setCurrentUserID();
2927 $_SESSION['authenticated'] = false;
2928 api_fr_photo_detail('json');
2932 * Test the api_fr_photo_detail() function with a photo ID.
2936 public function testApiFrPhotoDetailWithPhotoId()
2938 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
2939 $_REQUEST['photo_id'] = 1;
2940 api_fr_photo_detail('json');
2944 * Test the api_fr_photo_detail() function with a correct photo ID.
2948 public function testApiFrPhotoDetailCorrectPhotoId()
2950 $this->markTestIncomplete('We need to create a dataset for this.');
2954 * Test the api_account_update_profile_image() function.
2958 public function testApiAccountUpdateProfileImage()
2960 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2961 api_account_update_profile_image('json');
2965 * Test the api_account_update_profile_image() function without an authenticated user.
2969 public function testApiAccountUpdateProfileImageWithoutAuthenticatedUser()
2971 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2972 BasicAuth::setCurrentUserID();
2973 $_SESSION['authenticated'] = false;
2974 api_account_update_profile_image('json');
2978 * Test the api_account_update_profile_image() function with an uploaded file.
2982 public function testApiAccountUpdateProfileImageWithUpload()
2984 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2985 $this->markTestIncomplete();
2990 * Test the api_account_update_profile() function.
2994 public function testApiAccountUpdateProfile()
2996 $_POST['name'] = 'new_name';
2997 $_POST['description'] = 'new_description';
2998 $result = api_account_update_profile('json');
2999 // We can't use assertSelfUser() here because the user object is missing some properties.
3000 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
3001 self::assertEquals('DFRN', $result['user']['location']);
3002 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
3003 self::assertEquals('dfrn', $result['user']['network']);
3004 self::assertEquals('new_name', $result['user']['name']);
3005 self::assertEquals('new_description', $result['user']['description']);
3009 * Test the check_acl_input() function.
3013 public function testCheckAclInput()
3015 $result = check_acl_input('<aclstring>', BaseApi::getCurrentUserID());
3016 // Where does this result come from?
3017 self::assertEquals(1, $result);
3021 * Test the check_acl_input() function with an empty ACL string.
3025 public function testCheckAclInputWithEmptyAclString()
3027 $result = check_acl_input(' ', BaseApi::getCurrentUserID());
3028 self::assertFalse($result);
3032 * Test the save_media_to_database() function.
3036 public function testSaveMediaToDatabase()
3038 $this->markTestIncomplete();
3042 * Test the post_photo_item() function.
3046 public function testPostPhotoItem()
3048 $this->markTestIncomplete();
3052 * Test the prepare_photo_data() function.
3056 public function testPreparePhotoData()
3058 $this->markTestIncomplete();
3062 * Test the api_share_as_retweet() function with a valid item.
3066 public function testApiShareAsRetweetWithValidItem()
3068 $this->markTestIncomplete();
3072 * Test the api_in_reply_to() function.
3076 public function testApiInReplyTo()
3078 $result = api_in_reply_to(['id' => 0, 'parent' => 0, 'uri' => '', 'thr-parent' => '']);
3079 self::assertArrayHasKey('status_id', $result);
3080 self::assertArrayHasKey('user_id', $result);
3081 self::assertArrayHasKey('status_id_str', $result);
3082 self::assertArrayHasKey('user_id_str', $result);
3083 self::assertArrayHasKey('screen_name', $result);
3087 * Test the api_in_reply_to() function with a valid item.
3091 public function testApiInReplyToWithValidItem()
3093 $this->markTestIncomplete();
3097 * Test the api_clean_plain_items() function.
3101 public function testApiCleanPlainItems()
3103 $_REQUEST['include_entities'] = 'true';
3104 $result = api_clean_plain_items('some_text [url="some_url"]some_text[/url]');
3105 self::assertEquals('some_text [url="some_url"]"some_url"[/url]', $result);
3109 * Test the api_best_nickname() function with contacts.
3113 public function testApiBestNicknameWithContacts()
3115 $this->markTestIncomplete();
3119 * Test the api_friendica_group_show() function.
3123 public function testApiFriendicaGroupShow()
3125 $this->markTestIncomplete();
3129 * Test the api_friendica_group_delete() function.
3133 public function testApiFriendicaGroupDelete()
3135 $this->markTestIncomplete();
3139 * Test the api_lists_destroy() function.
3143 public function testApiListsDestroy()
3145 $this->markTestIncomplete();
3149 * Test the group_create() function.
3153 public function testGroupCreate()
3155 $this->markTestIncomplete();
3159 * Test the api_friendica_group_create() function.
3163 public function testApiFriendicaGroupCreate()
3165 $this->markTestIncomplete();
3169 * Test the api_lists_create() function.
3173 public function testApiListsCreate()
3175 $this->markTestIncomplete();
3179 * Test the api_friendica_group_update() function.
3183 public function testApiFriendicaGroupUpdate()
3185 $this->markTestIncomplete();
3189 * Test the api_lists_update() function.
3193 public function testApiListsUpdate()
3195 $this->markTestIncomplete();
3199 * Test the api_friendica_activity() function.
3203 public function testApiFriendicaActivity()
3205 $this->markTestIncomplete();
3209 * Test the api_friendica_notification_seen() function.
3213 public function testApiFriendicaNotificationSeen()
3215 $this->markTestIncomplete();
3219 * Test the api_friendica_direct_messages_setseen() function.
3223 public function testApiFriendicaDirectMessagesSetseen()
3225 $this->markTestIncomplete();
3229 * Test the api_friendica_direct_messages_search() function.
3233 public function testApiFriendicaDirectMessagesSearch()
3235 $this->markTestIncomplete();