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()
558 $user_info = ['url' => 'user_url', 'lang' => 'en'];
559 $result = api_rss_extra([], $user_info);
560 self::assertEquals($user_info, $result['$user']);
561 self::assertEquals($user_info['url'], $result['$rss']['alternate']);
562 self::assertArrayHasKey('self', $result['$rss']);
563 self::assertArrayHasKey('base', $result['$rss']);
564 self::assertArrayHasKey('updated', $result['$rss']);
565 self::assertArrayHasKey('atom_updated', $result['$rss']);
566 self::assertArrayHasKey('language', $result['$rss']);
567 self::assertArrayHasKey('logo', $result['$rss']);
571 * Test the api_rss_extra() function without any user info.
575 public function testApiRssExtraWithoutUserInfo()
577 $result = api_rss_extra([], null);
578 self::assertIsArray($result['$user']);
579 self::assertArrayHasKey('alternate', $result['$rss']);
580 self::assertArrayHasKey('self', $result['$rss']);
581 self::assertArrayHasKey('base', $result['$rss']);
582 self::assertArrayHasKey('updated', $result['$rss']);
583 self::assertArrayHasKey('atom_updated', $result['$rss']);
584 self::assertArrayHasKey('language', $result['$rss']);
585 self::assertArrayHasKey('logo', $result['$rss']);
589 * Test the api_get_user() function.
593 public function testApiGetUser()
595 // $user = api_get_user();
596 // self::assertSelfUser($user);
597 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
598 // self::assertEquals('6fdbe8', $user['profile_link_color']);
599 // self::assertEquals('ededed', $user['profile_background_color']);
603 * Test the api_get_user() function with a Frio schema.
607 public function testApiGetUserWithFrioSchema()
609 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
610 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
611 // $user = api_get_user();
612 // self::assertSelfUser($user);
613 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
614 // self::assertEquals('6fdbe8', $user['profile_link_color']);
615 // self::assertEquals('ededed', $user['profile_background_color']);
619 * Test the api_get_user() function with an empty Frio schema.
623 public function testApiGetUserWithEmptyFrioSchema()
625 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
626 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
627 // $user = api_get_user();
628 // self::assertSelfUser($user);
629 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
630 // self::assertEquals('6fdbe8', $user['profile_link_color']);
631 // self::assertEquals('ededed', $user['profile_background_color']);
635 * Test the api_get_user() function with a custom Frio schema.
639 public function testApiGetUserWithCustomFrioSchema()
641 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
642 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
643 // $pConfig->set($this->selfUser['id'], 'frio', 'nav_bg', '#123456');
644 // $pConfig->set($this->selfUser['id'], 'frio', 'link_color', '#123456');
645 // $pConfig->set($this->selfUser['id'], 'frio', 'background_color', '#123456');
646 // $user = api_get_user();
647 // self::assertSelfUser($user);
648 // self::assertEquals('123456', $user['profile_sidebar_fill_color']);
649 // self::assertEquals('123456', $user['profile_link_color']);
650 // self::assertEquals('123456', $user['profile_background_color']);
654 * Test the api_get_user() function with an user that is not allowed to use the API.
656 * @runInSeparateProcess
657 * @preserveGlobalState disabled
659 public function testApiGetUserWithoutApiUser()
661 // api_get_user() with empty parameters is not used anymore
663 $_SERVER['PHP_AUTH_USER'] = 'Test user';
664 $_SERVER['PHP_AUTH_PW'] = 'password';
665 BasicAuth::setCurrentUserID();
666 self::assertFalse(api_get_user());
671 * Test the api_get_user() function with an user ID in a GET parameter.
675 public function testApiGetUserWithGetId()
677 // self::assertOtherUser(api_get_user());
681 * Test the api_get_user() function with a wrong user ID in a GET parameter.
685 public function testApiGetUserWithWrongGetId()
687 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
688 // self::assertOtherUser(api_get_user());
692 * Test the api_get_user() function with an user name in a GET parameter.
696 public function testApiGetUserWithGetName()
698 // self::assertSelfUser(api_get_user());
702 * Test the api_get_user() function with a profile URL in a GET parameter.
706 public function testApiGetUserWithGetUrl()
708 // self::assertSelfUser(api_get_user());
712 * Test the api_get_user() function with an user ID in the API path.
716 public function testApiGetUserWithNumericCalledApi()
718 // global $called_api;
719 // $called_api = ['api_path'];
720 // DI::args()->setArgv(['', $this->otherUser['id'] . '.json']);
721 // self::assertOtherUser(api_get_user());
725 * Test the api_get_user() function with the $called_api global variable.
729 public function testApiGetUserWithCalledApi()
731 // global $called_api;
732 // $called_api = ['api', 'api_path'];
733 // self::assertSelfUser(api_get_user());
737 * Test the api_get_user() function with a 0 user ID.
741 public function testApiGetUserWithZeroUser()
743 self::assertSelfUser(DI::twitterUser()->createFromUserId(BaseApi::getCurrentUserID())->toArray());
747 * Test the Arrays::walkRecursive() function.
751 public function testApiWalkRecursive()
756 Arrays::walkRecursive(
759 // Should we test this with a callback that actually does something?
767 * Test the Arrays::walkRecursive() function with an array.
771 public function testApiWalkRecursiveWithArray()
773 $array = [['item1'], ['item2']];
776 Arrays::walkRecursive(
779 // Should we test this with a callback that actually does something?
787 * Test the BaseApi::reformatXML() function.
791 public function testApiReformatXml()
795 self::assertTrue(ApiResponse::reformatXML($item, $key));
796 self::assertEquals('true', $item);
800 * Test the BaseApi::reformatXML() function with a statusnet_api key.
804 public function testApiReformatXmlWithStatusnetKey()
807 $key = 'statusnet_api';
808 self::assertTrue(ApiResponse::reformatXML($item, $key));
809 self::assertEquals('statusnet:api', $key);
813 * Test the BaseApi::reformatXML() function with a friendica_api key.
817 public function testApiReformatXmlWithFriendicaKey()
820 $key = 'friendica_api';
821 self::assertTrue(ApiResponse::reformatXML($item, $key));
822 self::assertEquals('friendica:api', $key);
826 * Test the BaseApi::createXML() function.
830 public function testApiCreateXml()
833 '<?xml version="1.0"?>' . "\n" .
834 '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
835 'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
836 'xmlns:georss="http://www.georss.org/georss">' . "\n" .
837 ' <data>some_data</data>' . "\n" .
838 '</root_element>' . "\n",
839 DI::apiResponse()->createXML(['data' => ['some_data']], 'root_element')
844 * Test the BaseApi::createXML() function without any XML namespace.
848 public function testApiCreateXmlWithoutNamespaces()
851 '<?xml version="1.0"?>' . "\n" .
853 ' <data>some_data</data>' . "\n" .
855 DI::apiResponse()->createXML(['data' => ['some_data']], 'ok')
860 * Test the BaseApi::formatData() function.
864 public function testApiFormatData()
866 $data = ['some_data'];
867 self::assertEquals($data, DI::apiResponse()->formatData('root_element', 'json', $data));
871 * Test the BaseApi::formatData() function with an XML result.
875 public function testApiFormatDataWithXml()
878 '<?xml version="1.0"?>' . "\n" .
879 '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
880 'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
881 'xmlns:georss="http://www.georss.org/georss">' . "\n" .
882 ' <data>some_data</data>' . "\n" .
883 '</root_element>' . "\n",
884 DI::apiResponse()->formatData('root_element', 'xml', ['data' => ['some_data']])
889 * Test the api_account_verify_credentials() function.
893 public function testApiAccountVerifyCredentials()
895 self::assertArrayHasKey('user', api_account_verify_credentials('json'));
899 * Test the api_account_verify_credentials() function without an authenticated user.
903 public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
905 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
906 BasicAuth::setCurrentUserID();
907 $_SESSION['authenticated'] = false;
908 api_account_verify_credentials('json');
912 * Test the requestdata() function.
916 public function testRequestdata()
918 self::assertNull(requestdata('variable_name'));
922 * Test the requestdata() function with a POST parameter.
926 public function testRequestdataWithPost()
928 $_POST['variable_name'] = 'variable_value';
929 self::assertEquals('variable_value', requestdata('variable_name'));
933 * Test the requestdata() function with a GET parameter.
937 public function testRequestdataWithGet()
939 $_GET['variable_name'] = 'variable_value';
940 self::assertEquals('variable_value', requestdata('variable_name'));
944 * Test the api_statuses_mediap() function.
948 public function testApiStatusesMediap()
950 DI::args()->setArgc(2);
958 'tmp_name' => $this->getTempImage(),
959 'name' => 'spacer.png',
960 'type' => 'image/png'
963 $_GET['status'] = '<b>Status content</b>';
965 $result = api_statuses_mediap('json');
966 self::assertStatus($result['status']);
970 * Test the api_statuses_mediap() function without an authenticated user.
974 public function testApiStatusesMediapWithoutAuthenticatedUser()
976 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
977 BasicAuth::setCurrentUserID();
978 $_SESSION['authenticated'] = false;
979 api_statuses_mediap('json');
983 * Test the api_statuses_update() function.
987 public function testApiStatusesUpdate()
989 $_GET['status'] = 'Status content #friendica';
990 $_GET['in_reply_to_status_id'] = -1;
999 'tmp_name' => $this->getTempImage(),
1000 'name' => 'spacer.png',
1001 'type' => 'image/png'
1005 $result = api_statuses_update('json');
1006 self::assertStatus($result['status']);
1010 * Test the api_statuses_update() function with an HTML status.
1014 public function testApiStatusesUpdateWithHtml()
1016 $_GET['htmlstatus'] = '<b>Status content</b>';
1018 $result = api_statuses_update('json');
1019 self::assertStatus($result['status']);
1023 * Test the api_statuses_update() function without an authenticated user.
1027 public function testApiStatusesUpdateWithoutAuthenticatedUser()
1029 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1030 BasicAuth::setCurrentUserID();
1031 $_SESSION['authenticated'] = false;
1032 api_statuses_update('json');
1036 * Test the api_statuses_update() function with a parent status.
1040 public function testApiStatusesUpdateWithParent()
1042 $this->markTestIncomplete('This triggers an exit() somewhere and kills PHPUnit.');
1046 * Test the api_statuses_update() function with a media_ids parameter.
1050 public function testApiStatusesUpdateWithMediaIds()
1052 $this->markTestIncomplete();
1056 * Test the api_statuses_update() function with the throttle limit reached.
1060 public function testApiStatusesUpdateWithDayThrottleReached()
1062 $this->markTestIncomplete();
1066 * Test the api_media_upload() function.
1067 * @runInSeparateProcess
1068 * @preserveGlobalState disabled
1070 public function testApiMediaUpload()
1072 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1077 * Test the api_media_upload() function without an authenticated user.
1081 public function testApiMediaUploadWithoutAuthenticatedUser()
1083 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1084 BasicAuth::setCurrentUserID();
1085 $_SESSION['authenticated'] = false;
1090 * Test the api_media_upload() function with an invalid uploaded media.
1094 public function testApiMediaUploadWithMedia()
1096 $this->expectException(\Friendica\Network\HTTPException\InternalServerErrorException::class);
1100 'tmp_name' => 'tmp_name'
1107 * Test the api_media_upload() function with an valid uploaded media.
1111 public function testApiMediaUploadWithValidMedia()
1119 'tmp_name' => $this->getTempImage(),
1120 'name' => 'spacer.png',
1121 'type' => 'image/png'
1125 DI::args()->setArgc(2);
1127 $result = api_media_upload();
1128 self::assertEquals('image/png', $result['media']['image']['image_type']);
1129 self::assertEquals(1, $result['media']['image']['w']);
1130 self::assertEquals(1, $result['media']['image']['h']);
1131 self::assertNotEmpty($result['media']['image']['friendica_preview_url']);
1135 * Test the api_status_show() function.
1137 public function testApiStatusShowWithJson()
1139 $result = api_status_show('json', 1);
1140 self::assertStatus($result['status']);
1144 * Test the api_status_show() function with an XML result.
1146 public function testApiStatusShowWithXml()
1148 $result = api_status_show('xml', 1);
1149 self::assertXml($result, 'statuses');
1153 * Test the api_get_last_status() function
1155 public function testApiGetLastStatus()
1157 $item = api_get_last_status($this->selfUser['id'], $this->selfUser['id']);
1159 self::assertNotNull($item);
1163 * Test the api_users_show() function.
1167 public function testApiUsersShow()
1169 $result = api_users_show('json');
1170 // We can't use assertSelfUser() here because the user object is missing some properties.
1171 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
1172 self::assertEquals('DFRN', $result['user']['location']);
1173 self::assertEquals($this->selfUser['name'], $result['user']['name']);
1174 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
1175 self::assertEquals('dfrn', $result['user']['network']);
1176 self::assertTrue($result['user']['verified']);
1180 * Test the api_users_show() function with an XML result.
1184 public function testApiUsersShowWithXml()
1186 $result = api_users_show('xml');
1187 self::assertXml($result, 'statuses');
1191 * Test the api_users_search() function.
1195 public function testApiUsersSearch()
1197 $_GET['q'] = 'othercontact';
1198 $result = api_users_search('json');
1199 self::assertOtherUser($result['users'][0]);
1203 * Test the api_users_search() function with an XML result.
1207 public function testApiUsersSearchWithXml()
1209 $_GET['q'] = 'othercontact';
1210 $result = api_users_search('xml');
1211 self::assertXml($result, 'users');
1215 * Test the api_users_search() function without a GET q parameter.
1219 public function testApiUsersSearchWithoutQuery()
1221 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1222 api_users_search('json');
1226 * Test the api_users_lookup() function.
1230 public function testApiUsersLookup()
1232 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
1233 api_users_lookup('json');
1237 * Test the api_users_lookup() function with an user ID.
1241 public function testApiUsersLookupWithUserId()
1243 $_REQUEST['user_id'] = $this->otherUser['id'];
1244 $result = api_users_lookup('json');
1245 self::assertOtherUser($result['users'][0]);
1249 * Test the api_search() function.
1253 public function testApiSearch()
1255 $_REQUEST['q'] = 'reply';
1256 $_REQUEST['max_id'] = 10;
1257 $result = api_search('json');
1258 foreach ($result['status'] as $status) {
1259 self::assertStatus($status);
1260 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1265 * Test the api_search() function a count parameter.
1269 public function testApiSearchWithCount()
1271 $_REQUEST['q'] = 'reply';
1272 $_REQUEST['count'] = 20;
1273 $result = api_search('json');
1274 foreach ($result['status'] as $status) {
1275 self::assertStatus($status);
1276 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1281 * Test the api_search() function with an rpp parameter.
1285 public function testApiSearchWithRpp()
1287 $_REQUEST['q'] = 'reply';
1288 $_REQUEST['rpp'] = 20;
1289 $result = api_search('json');
1290 foreach ($result['status'] as $status) {
1291 self::assertStatus($status);
1292 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1297 * Test the api_search() function with an q parameter contains hashtag.
1298 * @doesNotPerformAssertions
1300 public function testApiSearchWithHashtag()
1302 $_REQUEST['q'] = '%23friendica';
1303 $result = api_search('json');
1304 foreach ($result['status'] as $status) {
1305 self::assertStatus($status);
1306 self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true);
1311 * Test the api_search() function with an exclude_replies parameter.
1312 * @doesNotPerformAssertions
1314 public function testApiSearchWithExcludeReplies()
1316 $_REQUEST['max_id'] = 10;
1317 $_REQUEST['exclude_replies'] = true;
1318 $_REQUEST['q'] = 'friendica';
1319 $result = api_search('json');
1320 foreach ($result['status'] as $status) {
1321 self::assertStatus($status);
1326 * Test the api_search() function without an authenticated user.
1330 public function testApiSearchWithUnallowedUser()
1332 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1333 BasicAuth::setCurrentUserID();
1338 * Test the api_search() function without any GET query parameter.
1342 public function testApiSearchWithoutQuery()
1344 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1349 * Test the api_statuses_home_timeline() function.
1353 public function testApiStatusesHomeTimeline()
1355 $_REQUEST['max_id'] = 10;
1356 $_REQUEST['exclude_replies'] = true;
1357 $_REQUEST['conversation_id'] = 1;
1358 $result = api_statuses_home_timeline('json');
1359 self::assertNotEmpty($result['status']);
1360 foreach ($result['status'] as $status) {
1361 self::assertStatus($status);
1366 * Test the api_statuses_home_timeline() function with a negative page parameter.
1370 public function testApiStatusesHomeTimelineWithNegativePage()
1372 $_REQUEST['page'] = -2;
1373 $result = api_statuses_home_timeline('json');
1374 self::assertNotEmpty($result['status']);
1375 foreach ($result['status'] as $status) {
1376 self::assertStatus($status);
1381 * Test the api_statuses_home_timeline() with an unallowed user.
1385 public function testApiStatusesHomeTimelineWithUnallowedUser()
1387 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1388 BasicAuth::setCurrentUserID();
1389 api_statuses_home_timeline('json');
1393 * Test the api_statuses_home_timeline() function with an RSS result.
1397 public function testApiStatusesHomeTimelineWithRss()
1399 $result = api_statuses_home_timeline('rss');
1400 self::assertXml($result, 'statuses');
1404 * Test the api_statuses_public_timeline() function.
1408 public function testApiStatusesPublicTimeline()
1410 $_REQUEST['max_id'] = 10;
1411 $_REQUEST['conversation_id'] = 1;
1412 $result = api_statuses_public_timeline('json');
1413 self::assertNotEmpty($result['status']);
1414 foreach ($result['status'] as $status) {
1415 self::assertStatus($status);
1420 * Test the api_statuses_public_timeline() function with the exclude_replies parameter.
1424 public function testApiStatusesPublicTimelineWithExcludeReplies()
1426 $_REQUEST['max_id'] = 10;
1427 $_REQUEST['exclude_replies'] = true;
1428 $result = api_statuses_public_timeline('json');
1429 self::assertNotEmpty($result['status']);
1430 foreach ($result['status'] as $status) {
1431 self::assertStatus($status);
1436 * Test the api_statuses_public_timeline() function with a negative page parameter.
1440 public function testApiStatusesPublicTimelineWithNegativePage()
1442 $_REQUEST['page'] = -2;
1443 $result = api_statuses_public_timeline('json');
1444 self::assertNotEmpty($result['status']);
1445 foreach ($result['status'] as $status) {
1446 self::assertStatus($status);
1451 * Test the api_statuses_public_timeline() function with an unallowed user.
1455 public function testApiStatusesPublicTimelineWithUnallowedUser()
1457 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1458 BasicAuth::setCurrentUserID();
1459 api_statuses_public_timeline('json');
1463 * Test the api_statuses_public_timeline() function with an RSS result.
1467 public function testApiStatusesPublicTimelineWithRss()
1469 $result = api_statuses_public_timeline('rss');
1470 self::assertXml($result, 'statuses');
1474 * Test the api_statuses_networkpublic_timeline() function.
1478 public function testApiStatusesNetworkpublicTimeline()
1480 $_REQUEST['max_id'] = 10;
1481 $result = api_statuses_networkpublic_timeline('json');
1482 self::assertNotEmpty($result['status']);
1483 foreach ($result['status'] as $status) {
1484 self::assertStatus($status);
1489 * Test the api_statuses_networkpublic_timeline() function with a negative page parameter.
1493 public function testApiStatusesNetworkpublicTimelineWithNegativePage()
1495 $_REQUEST['page'] = -2;
1496 $result = api_statuses_networkpublic_timeline('json');
1497 self::assertNotEmpty($result['status']);
1498 foreach ($result['status'] as $status) {
1499 self::assertStatus($status);
1504 * Test the api_statuses_networkpublic_timeline() function with an unallowed user.
1508 public function testApiStatusesNetworkpublicTimelineWithUnallowedUser()
1510 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1511 BasicAuth::setCurrentUserID();
1512 api_statuses_networkpublic_timeline('json');
1516 * Test the api_statuses_networkpublic_timeline() function with an RSS result.
1520 public function testApiStatusesNetworkpublicTimelineWithRss()
1522 $result = api_statuses_networkpublic_timeline('rss');
1523 self::assertXml($result, 'statuses');
1527 * Test the api_statuses_show() function.
1531 public function testApiStatusesShow()
1533 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1534 api_statuses_show('json');
1538 * Test the api_statuses_show() function with an ID.
1542 public function testApiStatusesShowWithId()
1544 DI::args()->setArgv(['', '', '', 1]);
1545 $result = api_statuses_show('json');
1546 self::assertStatus($result['status']);
1550 * Test the api_statuses_show() function with the conversation parameter.
1554 public function testApiStatusesShowWithConversation()
1556 DI::args()->setArgv(['', '', '', 1]);
1557 $_REQUEST['conversation'] = 1;
1558 $result = api_statuses_show('json');
1559 self::assertNotEmpty($result['status']);
1560 foreach ($result['status'] as $status) {
1561 self::assertStatus($status);
1566 * Test the api_statuses_show() function with an unallowed user.
1570 public function testApiStatusesShowWithUnallowedUser()
1572 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1573 BasicAuth::setCurrentUserID();
1574 api_statuses_show('json');
1578 * Test the api_conversation_show() function.
1582 public function testApiConversationShow()
1584 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1585 api_conversation_show('json');
1589 * Test the api_conversation_show() function with an ID.
1593 public function testApiConversationShowWithId()
1595 DI::args()->setArgv(['', '', '', 1]);
1596 $_REQUEST['max_id'] = 10;
1597 $_REQUEST['page'] = -2;
1598 $result = api_conversation_show('json');
1599 self::assertNotEmpty($result['status']);
1600 foreach ($result['status'] as $status) {
1601 self::assertStatus($status);
1606 * Test the api_conversation_show() function with an unallowed user.
1610 public function testApiConversationShowWithUnallowedUser()
1612 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1613 BasicAuth::setCurrentUserID();
1614 api_conversation_show('json');
1618 * Test the api_statuses_repeat() function.
1622 public function testApiStatusesRepeat()
1624 $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
1625 api_statuses_repeat('json');
1629 * Test the api_statuses_repeat() function without an authenticated user.
1633 public function testApiStatusesRepeatWithoutAuthenticatedUser()
1635 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1636 BasicAuth::setCurrentUserID();
1637 $_SESSION['authenticated'] = false;
1638 api_statuses_repeat('json');
1642 * Test the api_statuses_repeat() function with an ID.
1646 public function testApiStatusesRepeatWithId()
1648 DI::args()->setArgv(['', '', '', 1]);
1649 $result = api_statuses_repeat('json');
1650 self::assertStatus($result['status']);
1652 // Also test with a shared status
1653 DI::args()->setArgv(['', '', '', 5]);
1654 $result = api_statuses_repeat('json');
1655 self::assertStatus($result['status']);
1659 * Test the api_statuses_destroy() function.
1663 public function testApiStatusesDestroy()
1665 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1666 api_statuses_destroy('json');
1670 * Test the api_statuses_destroy() function without an authenticated user.
1674 public function testApiStatusesDestroyWithoutAuthenticatedUser()
1676 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1677 BasicAuth::setCurrentUserID();
1678 $_SESSION['authenticated'] = false;
1679 api_statuses_destroy('json');
1683 * Test the api_statuses_destroy() function with an ID.
1687 public function testApiStatusesDestroyWithId()
1689 DI::args()->setArgv(['', '', '', 1]);
1690 $result = api_statuses_destroy('json');
1691 self::assertStatus($result['status']);
1695 * Test the api_statuses_mentions() function.
1699 public function testApiStatusesMentions()
1701 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
1702 $_REQUEST['max_id'] = 10;
1703 $result = api_statuses_mentions('json');
1704 self::assertEmpty($result['status']);
1705 // We should test with mentions in the database.
1709 * Test the api_statuses_mentions() function with a negative page parameter.
1713 public function testApiStatusesMentionsWithNegativePage()
1715 $_REQUEST['page'] = -2;
1716 $result = api_statuses_mentions('json');
1717 self::assertEmpty($result['status']);
1721 * Test the api_statuses_mentions() function with an unallowed user.
1725 public function testApiStatusesMentionsWithUnallowedUser()
1727 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1728 BasicAuth::setCurrentUserID();
1729 api_statuses_mentions('json');
1733 * Test the api_statuses_mentions() function with an RSS result.
1737 public function testApiStatusesMentionsWithRss()
1739 $result = api_statuses_mentions('rss');
1740 self::assertXml($result, 'statuses');
1744 * Test the api_statuses_user_timeline() function.
1748 public function testApiStatusesUserTimeline()
1750 $_REQUEST['max_id'] = 10;
1751 $_REQUEST['exclude_replies'] = true;
1752 $_REQUEST['conversation_id'] = 1;
1753 $result = api_statuses_user_timeline('json');
1754 self::assertNotEmpty($result['status']);
1755 foreach ($result['status'] as $status) {
1756 self::assertStatus($status);
1761 * Test the api_statuses_user_timeline() function with a negative page parameter.
1765 public function testApiStatusesUserTimelineWithNegativePage()
1767 $_REQUEST['page'] = -2;
1768 $result = api_statuses_user_timeline('json');
1769 self::assertNotEmpty($result['status']);
1770 foreach ($result['status'] as $status) {
1771 self::assertStatus($status);
1776 * Test the api_statuses_user_timeline() function with an RSS result.
1780 public function testApiStatusesUserTimelineWithRss()
1782 $result = api_statuses_user_timeline('rss');
1783 self::assertXml($result, 'statuses');
1787 * Test the api_statuses_user_timeline() function with an unallowed user.
1791 public function testApiStatusesUserTimelineWithUnallowedUser()
1793 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1794 BasicAuth::setCurrentUserID();
1795 api_statuses_user_timeline('json');
1799 * Test the api_favorites_create_destroy() function.
1803 public function testApiFavoritesCreateDestroy()
1805 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1806 DI::args()->setArgv(['api', '1.1', 'favorites', 'create']);
1807 api_favorites_create_destroy('json');
1811 * Test the api_favorites_create_destroy() function with an invalid ID.
1815 public function testApiFavoritesCreateDestroyWithInvalidId()
1817 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1818 DI::args()->setArgv(['api', '1.1', 'favorites', 'create', '12.json']);
1819 api_favorites_create_destroy('json');
1823 * Test the api_favorites_create_destroy() function with an invalid action.
1827 public function testApiFavoritesCreateDestroyWithInvalidAction()
1829 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1830 DI::args()->setArgv(['api', '1.1', 'favorites', 'change.json']);
1831 $_REQUEST['id'] = 1;
1832 api_favorites_create_destroy('json');
1836 * Test the api_favorites_create_destroy() function with the create action.
1840 public function testApiFavoritesCreateDestroyWithCreateAction()
1842 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1843 $_REQUEST['id'] = 3;
1844 $result = api_favorites_create_destroy('json');
1845 self::assertStatus($result['status']);
1849 * Test the api_favorites_create_destroy() function with the create action and an RSS result.
1853 public function testApiFavoritesCreateDestroyWithCreateActionAndRss()
1855 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.rss']);
1856 $_REQUEST['id'] = 3;
1857 $result = api_favorites_create_destroy('rss');
1858 self::assertXml($result, 'status');
1862 * Test the api_favorites_create_destroy() function with the destroy action.
1866 public function testApiFavoritesCreateDestroyWithDestroyAction()
1868 DI::args()->setArgv(['api', '1.1', 'favorites', 'destroy.json']);
1869 $_REQUEST['id'] = 3;
1870 $result = api_favorites_create_destroy('json');
1871 self::assertStatus($result['status']);
1875 * Test the api_favorites_create_destroy() function without an authenticated user.
1879 public function testApiFavoritesCreateDestroyWithoutAuthenticatedUser()
1881 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1882 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1883 BasicAuth::setCurrentUserID();
1884 $_SESSION['authenticated'] = false;
1885 api_favorites_create_destroy('json');
1889 * Test the api_favorites() function.
1893 public function testApiFavorites()
1895 $_REQUEST['page'] = -1;
1896 $_REQUEST['max_id'] = 10;
1897 $result = api_favorites('json');
1898 foreach ($result['status'] as $status) {
1899 self::assertStatus($status);
1904 * Test the api_favorites() function with an RSS result.
1908 public function testApiFavoritesWithRss()
1910 $result = api_favorites('rss');
1911 self::assertXml($result, 'statuses');
1915 * Test the api_favorites() function with an unallowed user.
1919 public function testApiFavoritesWithUnallowedUser()
1921 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1922 BasicAuth::setCurrentUserID();
1923 api_favorites('json');
1927 * Test the api_format_messages() function.
1931 public function testApiFormatMessages()
1933 $result = api_format_messages(
1934 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1935 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1936 ['id' => 3, 'uri-id' => 2, 'screen_name' => 'sender_name']
1938 self::assertEquals('item_title' . "\n" . 'item_body', $result['text']);
1939 self::assertEquals(1, $result['id']);
1940 self::assertEquals(2, $result['recipient_id']);
1941 self::assertEquals(3, $result['sender_id']);
1942 self::assertEquals('recipient_name', $result['recipient_screen_name']);
1943 self::assertEquals('sender_name', $result['sender_screen_name']);
1947 * Test the api_format_messages() function with HTML.
1951 public function testApiFormatMessagesWithHtmlText()
1953 $_GET['getText'] = 'html';
1954 $result = api_format_messages(
1955 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1956 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1957 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1959 self::assertEquals('item_title', $result['title']);
1960 self::assertEquals('<strong>item_body</strong>', $result['text']);
1964 * Test the api_format_messages() function with plain text.
1968 public function testApiFormatMessagesWithPlainText()
1970 $_GET['getText'] = 'plain';
1971 $result = api_format_messages(
1972 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1973 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1974 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1976 self::assertEquals('item_title', $result['title']);
1977 self::assertEquals('item_body', $result['text']);
1981 * Test the api_format_messages() function with the getUserObjects GET parameter set to false.
1985 public function testApiFormatMessagesWithoutUserObjects()
1987 $_GET['getUserObjects'] = 'false';
1988 $result = api_format_messages(
1989 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1990 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1991 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1993 self::assertTrue(!isset($result['sender']));
1994 self::assertTrue(!isset($result['recipient']));
1998 * Test the api_convert_item() function.
2002 public function testApiConvertItem()
2004 $result = api_convert_item(
2006 'network' => 'feed',
2007 'title' => 'item_title',
2009 // We need a long string to test that it is correctly cut
2010 'body' => 'perspiciatis impedit voluptatem quis molestiae ea qui ' .
2011 'reiciendis dolorum aut ducimus sunt consequatur inventore dolor ' .
2012 'officiis pariatur doloremque nemo culpa aut quidem qui dolore ' .
2013 'laudantium atque commodi alias voluptatem non possimus aperiam ' .
2014 'ipsum rerum consequuntur aut amet fugit quia aliquid praesentium ' .
2015 'repellendus quibusdam et et inventore mollitia rerum sit autem ' .
2016 'pariatur maiores ipsum accusantium perferendis vel sit possimus ' .
2017 'veritatis nihil distinctio qui eum repellat officia illum quos ' .
2018 'impedit quam iste esse unde qui suscipit aut facilis ut inventore ' .
2019 'omnis exercitationem quo magnam consequatur maxime aut illum ' .
2020 'soluta quaerat natus unde aspernatur et sed beatae nihil ullam ' .
2021 'temporibus corporis ratione blanditiis perspiciatis impedit ' .
2022 'voluptatem quis molestiae ea qui reiciendis dolorum aut ducimus ' .
2023 'sunt consequatur inventore dolor officiis pariatur doloremque ' .
2024 'nemo culpa aut quidem qui dolore laudantium atque commodi alias ' .
2025 'voluptatem non possimus aperiam ipsum rerum consequuntur aut ' .
2026 'amet fugit quia aliquid praesentium repellendus quibusdam et et ' .
2027 'inventore mollitia rerum sit autem pariatur maiores ipsum accusantium ' .
2028 'perferendis vel sit possimus veritatis nihil distinctio qui eum ' .
2029 'repellat officia illum quos impedit quam iste esse unde qui ' .
2030 'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
2031 'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
2032 'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
2033 'plink' => 'item_plink'
2036 self::assertStringStartsWith('item_title', $result['text']);
2037 self::assertStringStartsWith('<h4>item_title</h4><br>perspiciatis impedit voluptatem', $result['html']);
2041 * Test the api_convert_item() function with an empty item body.
2045 public function testApiConvertItemWithoutBody()
2047 $result = api_convert_item(
2049 'network' => 'feed',
2050 'title' => 'item_title',
2053 'plink' => 'item_plink'
2056 self::assertEquals("item_title", $result['text']);
2057 self::assertEquals('<h4>item_title</h4><br>item_plink', $result['html']);
2061 * Test the api_convert_item() function with the title in the body.
2065 public function testApiConvertItemWithTitleInBody()
2067 $result = api_convert_item(
2069 'title' => 'item_title',
2070 'body' => 'item_title item_body',
2074 self::assertEquals('item_title item_body', $result['text']);
2075 self::assertEquals('<h4>item_title</h4><br>item_title item_body', $result['html']);
2079 * Test the api_get_attachments() function.
2083 public function testApiGetAttachments()
2086 self::assertEmpty(api_get_attachments($body, 0));
2090 * Test the api_get_attachments() function with an img tag.
2094 public function testApiGetAttachmentsWithImage()
2096 $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2097 self::assertIsArray(api_get_attachments($body, 0));
2101 * Test the api_get_attachments() function with an img tag and an AndStatus user agent.
2105 public function testApiGetAttachmentsWithImageAndAndStatus()
2107 $_SERVER['HTTP_USER_AGENT'] = 'AndStatus';
2108 $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2109 self::assertIsArray(api_get_attachments($body, 0));
2113 * Test the api_get_entitities() function.
2117 public function testApiGetEntitities()
2120 self::assertIsArray(api_get_entitities($text, 'bbcode', 0));
2124 * Test the api_get_entitities() function with the include_entities parameter.
2128 public function testApiGetEntititiesWithIncludeEntities()
2130 $_REQUEST['include_entities'] = 'true';
2132 $result = api_get_entitities($text, 'bbcode', 0);
2133 self::assertIsArray($result['hashtags']);
2134 self::assertIsArray($result['symbols']);
2135 self::assertIsArray($result['urls']);
2136 self::assertIsArray($result['user_mentions']);
2140 * Test the api_format_items_embeded_images() function.
2144 public function testApiFormatItemsEmbededImages()
2147 'text ' . DI::baseUrl() . '/display/item_guid',
2148 api_format_items_embeded_images(['guid' => 'item_guid'], 'text data:image/foo')
2153 * Test the api_contactlink_to_array() function.
2157 public function testApiContactlinkToArray()
2164 api_contactlink_to_array('text')
2169 * Test the api_contactlink_to_array() function with an URL.
2173 public function testApiContactlinkToArrayWithUrl()
2177 'name' => ['link_text'],
2180 api_contactlink_to_array('text <a href="url">link_text</a>')
2185 * Test the api_format_items_activities() function.
2189 public function testApiFormatItemsActivities()
2191 $item = ['uid' => 0, 'uri' => ''];
2192 $result = api_format_items_activities($item);
2193 self::assertArrayHasKey('like', $result);
2194 self::assertArrayHasKey('dislike', $result);
2195 self::assertArrayHasKey('attendyes', $result);
2196 self::assertArrayHasKey('attendno', $result);
2197 self::assertArrayHasKey('attendmaybe', $result);
2201 * Test the api_format_items_activities() function with an XML result.
2205 public function testApiFormatItemsActivitiesWithXml()
2207 $item = ['uid' => 0, 'uri' => ''];
2208 $result = api_format_items_activities($item, 'xml');
2209 self::assertArrayHasKey('friendica:like', $result);
2210 self::assertArrayHasKey('friendica:dislike', $result);
2211 self::assertArrayHasKey('friendica:attendyes', $result);
2212 self::assertArrayHasKey('friendica:attendno', $result);
2213 self::assertArrayHasKey('friendica:attendmaybe', $result);
2217 * Test the api_format_items() function.
2218 * @doesNotPerformAssertions
2220 public function testApiFormatItems()
2224 'item_network' => 'item_network',
2230 'author-network' => Protocol::DFRN,
2231 'author-link' => 'http://localhost/profile/othercontact',
2235 $result = api_format_items($items);
2236 foreach ($result as $status) {
2237 self::assertStatus($status);
2242 * Test the api_format_items() function with an XML result.
2243 * @doesNotPerformAssertions
2245 public function testApiFormatItemsWithXml()
2253 'author-network' => Protocol::DFRN,
2254 'author-link' => 'http://localhost/profile/othercontact',
2258 $result = api_format_items($items, 'xml');
2259 foreach ($result as $status) {
2260 self::assertStatus($status);
2265 * Test the api_lists_list() function.
2269 public function testApiListsList()
2271 $result = api_lists_list('json');
2272 self::assertEquals(['lists_list' => []], $result);
2276 * Test the api_lists_ownerships() function.
2280 public function testApiListsOwnerships()
2282 $result = api_lists_ownerships('json');
2283 foreach ($result['lists']['lists'] as $list) {
2284 self::assertList($list);
2289 * Test the api_lists_ownerships() function without an authenticated user.
2293 public function testApiListsOwnershipsWithoutAuthenticatedUser()
2295 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2296 BasicAuth::setCurrentUserID();
2297 $_SESSION['authenticated'] = false;
2298 api_lists_ownerships('json');
2302 * Test the api_lists_statuses() function.
2306 public function testApiListsStatuses()
2308 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2309 api_lists_statuses('json');
2313 * Test the api_lists_statuses() function with a list ID.
2314 * @doesNotPerformAssertions
2316 public function testApiListsStatusesWithListId()
2318 $_REQUEST['list_id'] = 1;
2319 $_REQUEST['page'] = -1;
2320 $_REQUEST['max_id'] = 10;
2321 $result = api_lists_statuses('json');
2322 foreach ($result['status'] as $status) {
2323 self::assertStatus($status);
2328 * Test the api_lists_statuses() function with a list ID and a RSS result.
2332 public function testApiListsStatusesWithListIdAndRss()
2334 $_REQUEST['list_id'] = 1;
2335 $result = api_lists_statuses('rss');
2336 self::assertXml($result, 'statuses');
2340 * Test the api_lists_statuses() function with an unallowed user.
2344 public function testApiListsStatusesWithUnallowedUser()
2346 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2347 BasicAuth::setCurrentUserID();
2348 api_lists_statuses('json');
2352 * Test the api_statuses_f() function.
2356 public function testApiStatusesFWithFriends()
2359 $result = api_statuses_f('friends');
2360 self::assertArrayHasKey('user', $result);
2364 * Test the api_statuses_f() function.
2368 public function testApiStatusesFWithFollowers()
2370 $result = api_statuses_f('followers');
2371 self::assertArrayHasKey('user', $result);
2375 * Test the api_statuses_f() function.
2379 public function testApiStatusesFWithBlocks()
2381 $result = api_statuses_f('blocks');
2382 self::assertArrayHasKey('user', $result);
2386 * Test the api_statuses_f() function.
2390 public function testApiStatusesFWithIncoming()
2392 $result = api_statuses_f('incoming');
2393 self::assertArrayHasKey('user', $result);
2397 * Test the api_statuses_f() function an undefined cursor GET variable.
2401 public function testApiStatusesFWithUndefinedCursor()
2403 $_GET['cursor'] = 'undefined';
2404 self::assertFalse(api_statuses_f('friends'));
2408 * Test the api_statuses_friends() function.
2412 public function testApiStatusesFriends()
2414 $result = api_statuses_friends('json');
2415 self::assertArrayHasKey('user', $result);
2419 * Test the api_statuses_friends() function an undefined cursor GET variable.
2423 public function testApiStatusesFriendsWithUndefinedCursor()
2425 $_GET['cursor'] = 'undefined';
2426 self::assertFalse(api_statuses_friends('json'));
2430 * Test the api_statuses_followers() function.
2434 public function testApiStatusesFollowers()
2436 $result = api_statuses_followers('json');
2437 self::assertArrayHasKey('user', $result);
2441 * Test the api_statuses_followers() function an undefined cursor GET variable.
2445 public function testApiStatusesFollowersWithUndefinedCursor()
2447 $_GET['cursor'] = 'undefined';
2448 self::assertFalse(api_statuses_followers('json'));
2452 * Test the api_blocks_list() function.
2456 public function testApiBlocksList()
2458 $result = api_blocks_list('json');
2459 self::assertArrayHasKey('user', $result);
2463 * Test the api_blocks_list() function an undefined cursor GET variable.
2467 public function testApiBlocksListWithUndefinedCursor()
2469 $_GET['cursor'] = 'undefined';
2470 self::assertFalse(api_blocks_list('json'));
2474 * Test the api_friendships_incoming() function.
2478 public function testApiFriendshipsIncoming()
2480 $result = api_friendships_incoming('json');
2481 self::assertArrayHasKey('id', $result);
2485 * Test the api_friendships_incoming() function an undefined cursor GET variable.
2489 public function testApiFriendshipsIncomingWithUndefinedCursor()
2491 $_GET['cursor'] = 'undefined';
2492 self::assertFalse(api_friendships_incoming('json'));
2496 * Test the api_statusnet_config() function.
2500 public function testApiStatusnetConfig()
2503 $result = api_statusnet_config('json');
2504 self::assertEquals('localhost', $result['config']['site']['server']);
2505 self::assertEquals('default', $result['config']['site']['theme']);
2506 self::assertEquals(DI::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']);
2507 self::assertTrue($result['config']['site']['fancy']);
2508 self::assertEquals('en', $result['config']['site']['language']);
2509 self::assertEquals('UTC', $result['config']['site']['timezone']);
2510 self::assertEquals(200000, $result['config']['site']['textlimit']);
2511 self::assertEquals('false', $result['config']['site']['private']);
2512 self::assertEquals('false', $result['config']['site']['ssl']);
2513 self::assertEquals(30, $result['config']['site']['shorturllength']);
2518 * Test the api_direct_messages_new() function.
2522 public function testApiDirectMessagesNew()
2524 $result = api_direct_messages_new('json');
2525 self::assertNull($result);
2529 * Test the api_direct_messages_new() function without an authenticated user.
2533 public function testApiDirectMessagesNewWithoutAuthenticatedUser()
2535 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2536 BasicAuth::setCurrentUserID();
2537 $_SESSION['authenticated'] = false;
2538 api_direct_messages_new('json');
2542 * Test the api_direct_messages_new() function with an user ID.
2546 public function testApiDirectMessagesNewWithUserId()
2548 $_POST['text'] = 'message_text';
2549 $_POST['user_id'] = $this->otherUser['id'];
2550 $result = api_direct_messages_new('json');
2551 self::assertEquals(['direct_message' => ['error' => -1]], $result);
2555 * Test the api_direct_messages_new() function with a screen name.
2559 public function testApiDirectMessagesNewWithScreenName()
2561 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2562 $_POST['text'] = 'message_text';
2563 $_POST['screen_name'] = $this->friendUser['nick'];
2564 $result = api_direct_messages_new('json');
2565 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2566 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2567 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2571 * Test the api_direct_messages_new() function with a title.
2575 public function testApiDirectMessagesNewWithTitle()
2577 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2578 $_POST['text'] = 'message_text';
2579 $_POST['screen_name'] = $this->friendUser['nick'];
2580 $_REQUEST['title'] = 'message_title';
2581 $result = api_direct_messages_new('json');
2582 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2583 self::assertStringContainsString('message_title', $result['direct_message']['text']);
2584 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2585 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2589 * Test the api_direct_messages_new() function with an RSS result.
2593 public function testApiDirectMessagesNewWithRss()
2595 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2596 $_POST['text'] = 'message_text';
2597 $_POST['screen_name'] = $this->friendUser['nick'];
2598 $result = api_direct_messages_new('rss');
2599 self::assertXml($result, 'direct-messages');
2603 * Test the api_direct_messages_destroy() function.
2607 public function testApiDirectMessagesDestroy()
2609 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2610 api_direct_messages_destroy('json');
2614 * Test the api_direct_messages_destroy() function with the friendica_verbose GET param.
2618 public function testApiDirectMessagesDestroyWithVerbose()
2620 $_GET['friendica_verbose'] = 'true';
2621 $result = api_direct_messages_destroy('json');
2625 'result' => 'error',
2626 'message' => 'message id or parenturi not specified'
2634 * Test the api_direct_messages_destroy() function without an authenticated user.
2638 public function testApiDirectMessagesDestroyWithoutAuthenticatedUser()
2640 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2641 BasicAuth::setCurrentUserID();
2642 $_SESSION['authenticated'] = false;
2643 api_direct_messages_destroy('json');
2647 * Test the api_direct_messages_destroy() function with a non-zero ID.
2651 public function testApiDirectMessagesDestroyWithId()
2653 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2654 $_REQUEST['id'] = 1;
2655 api_direct_messages_destroy('json');
2659 * Test the api_direct_messages_destroy() with a non-zero ID and the friendica_verbose GET param.
2663 public function testApiDirectMessagesDestroyWithIdAndVerbose()
2665 $_REQUEST['id'] = 1;
2666 $_REQUEST['friendica_parenturi'] = 'parent_uri';
2667 $_GET['friendica_verbose'] = 'true';
2668 $result = api_direct_messages_destroy('json');
2672 'result' => 'error',
2673 'message' => 'message id not in database'
2681 * Test the api_direct_messages_destroy() function with a non-zero ID.
2685 public function testApiDirectMessagesDestroyWithCorrectId()
2687 $this->markTestIncomplete('We need to add a dataset for this.');
2691 * Test the api_direct_messages_box() function.
2695 public function testApiDirectMessagesBoxWithSentbox()
2697 $_REQUEST['page'] = -1;
2698 $_REQUEST['max_id'] = 10;
2699 $result = api_direct_messages_box('json', 'sentbox', 'false');
2700 self::assertArrayHasKey('direct_message', $result);
2704 * Test the api_direct_messages_box() function.
2708 public function testApiDirectMessagesBoxWithConversation()
2710 $result = api_direct_messages_box('json', 'conversation', 'false');
2711 self::assertArrayHasKey('direct_message', $result);
2715 * Test the api_direct_messages_box() function.
2719 public function testApiDirectMessagesBoxWithAll()
2721 $result = api_direct_messages_box('json', 'all', 'false');
2722 self::assertArrayHasKey('direct_message', $result);
2726 * Test the api_direct_messages_box() function.
2730 public function testApiDirectMessagesBoxWithInbox()
2732 $result = api_direct_messages_box('json', 'inbox', 'false');
2733 self::assertArrayHasKey('direct_message', $result);
2737 * Test the api_direct_messages_box() function.
2741 public function testApiDirectMessagesBoxWithVerbose()
2743 $result = api_direct_messages_box('json', 'sentbox', 'true');
2747 'result' => 'error',
2748 'message' => 'no mails available'
2756 * Test the api_direct_messages_box() function with a RSS result.
2760 public function testApiDirectMessagesBoxWithRss()
2762 $result = api_direct_messages_box('rss', 'sentbox', 'false');
2763 self::assertXml($result, 'direct-messages');
2767 * Test the api_direct_messages_box() function without an authenticated user.
2771 public function testApiDirectMessagesBoxWithUnallowedUser()
2773 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2774 BasicAuth::setCurrentUserID();
2775 api_direct_messages_box('json', 'sentbox', 'false');
2779 * Test the api_direct_messages_sentbox() function.
2783 public function testApiDirectMessagesSentbox()
2785 $result = api_direct_messages_sentbox('json');
2786 self::assertArrayHasKey('direct_message', $result);
2790 * Test the api_direct_messages_inbox() function.
2794 public function testApiDirectMessagesInbox()
2796 $result = api_direct_messages_inbox('json');
2797 self::assertArrayHasKey('direct_message', $result);
2801 * Test the api_direct_messages_all() function.
2805 public function testApiDirectMessagesAll()
2807 $result = api_direct_messages_all('json');
2808 self::assertArrayHasKey('direct_message', $result);
2812 * Test the api_direct_messages_conversation() function.
2816 public function testApiDirectMessagesConversation()
2818 $result = api_direct_messages_conversation('json');
2819 self::assertArrayHasKey('direct_message', $result);
2823 * Test the api_oauth_request_token() function.
2827 public function testApiOauthRequestToken()
2829 $this->markTestIncomplete('exit() kills phpunit as well');
2833 * Test the api_oauth_access_token() function.
2837 public function testApiOauthAccessToken()
2839 $this->markTestIncomplete('exit() kills phpunit as well');
2843 * Test the api_fr_photos_list() function.
2847 public function testApiFrPhotosList()
2849 $result = api_fr_photos_list('json');
2850 self::assertArrayHasKey('photo', $result);
2854 * Test the api_fr_photos_list() function without an authenticated user.
2858 public function testApiFrPhotosListWithoutAuthenticatedUser()
2860 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2861 BasicAuth::setCurrentUserID();
2862 $_SESSION['authenticated'] = false;
2863 api_fr_photos_list('json');
2867 * Test the api_fr_photo_create_update() function.
2869 public function testApiFrPhotoCreateUpdate()
2871 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2872 api_fr_photo_create_update('json');
2876 * Test the api_fr_photo_create_update() function without an authenticated user.
2880 public function testApiFrPhotoCreateUpdateWithoutAuthenticatedUser()
2882 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2883 BasicAuth::setCurrentUserID();
2884 $_SESSION['authenticated'] = false;
2885 api_fr_photo_create_update('json');
2889 * Test the api_fr_photo_create_update() function with an album name.
2893 public function testApiFrPhotoCreateUpdateWithAlbum()
2895 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2896 $_REQUEST['album'] = 'album_name';
2897 api_fr_photo_create_update('json');
2901 * Test the api_fr_photo_create_update() function with the update mode.
2905 public function testApiFrPhotoCreateUpdateWithUpdate()
2907 $this->markTestIncomplete('We need to create a dataset for this');
2911 * Test the api_fr_photo_create_update() function with an uploaded file.
2915 public function testApiFrPhotoCreateUpdateWithFile()
2917 $this->markTestIncomplete();
2921 * Test the api_fr_photo_detail() function.
2925 public function testApiFrPhotoDetail()
2927 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2928 api_fr_photo_detail('json');
2932 * Test the api_fr_photo_detail() function without an authenticated user.
2936 public function testApiFrPhotoDetailWithoutAuthenticatedUser()
2938 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2939 BasicAuth::setCurrentUserID();
2940 $_SESSION['authenticated'] = false;
2941 api_fr_photo_detail('json');
2945 * Test the api_fr_photo_detail() function with a photo ID.
2949 public function testApiFrPhotoDetailWithPhotoId()
2951 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
2952 $_REQUEST['photo_id'] = 1;
2953 api_fr_photo_detail('json');
2957 * Test the api_fr_photo_detail() function with a correct photo ID.
2961 public function testApiFrPhotoDetailCorrectPhotoId()
2963 $this->markTestIncomplete('We need to create a dataset for this.');
2967 * Test the api_account_update_profile_image() function.
2971 public function testApiAccountUpdateProfileImage()
2973 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2974 api_account_update_profile_image('json');
2978 * Test the api_account_update_profile_image() function without an authenticated user.
2982 public function testApiAccountUpdateProfileImageWithoutAuthenticatedUser()
2984 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2985 BasicAuth::setCurrentUserID();
2986 $_SESSION['authenticated'] = false;
2987 api_account_update_profile_image('json');
2991 * Test the api_account_update_profile_image() function with an uploaded file.
2995 public function testApiAccountUpdateProfileImageWithUpload()
2997 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2998 $this->markTestIncomplete();
3003 * Test the api_account_update_profile() function.
3007 public function testApiAccountUpdateProfile()
3009 $_POST['name'] = 'new_name';
3010 $_POST['description'] = 'new_description';
3011 $result = api_account_update_profile('json');
3012 // We can't use assertSelfUser() here because the user object is missing some properties.
3013 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
3014 self::assertEquals('DFRN', $result['user']['location']);
3015 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
3016 self::assertEquals('dfrn', $result['user']['network']);
3017 self::assertEquals('new_name', $result['user']['name']);
3018 self::assertEquals('new_description', $result['user']['description']);
3022 * Test the check_acl_input() function.
3026 public function testCheckAclInput()
3028 $result = check_acl_input('<aclstring>');
3029 // Where does this result come from?
3030 self::assertEquals(1, $result);
3034 * Test the check_acl_input() function with an empty ACL string.
3038 public function testCheckAclInputWithEmptyAclString()
3040 $result = check_acl_input(' ');
3041 self::assertFalse($result);
3045 * Test the save_media_to_database() function.
3049 public function testSaveMediaToDatabase()
3051 $this->markTestIncomplete();
3055 * Test the post_photo_item() function.
3059 public function testPostPhotoItem()
3061 $this->markTestIncomplete();
3065 * Test the prepare_photo_data() function.
3069 public function testPreparePhotoData()
3071 $this->markTestIncomplete();
3075 * Test the api_share_as_retweet() function with a valid item.
3079 public function testApiShareAsRetweetWithValidItem()
3081 $this->markTestIncomplete();
3085 * Test the api_in_reply_to() function.
3089 public function testApiInReplyTo()
3091 $result = api_in_reply_to(['id' => 0, 'parent' => 0, 'uri' => '', 'thr-parent' => '']);
3092 self::assertArrayHasKey('status_id', $result);
3093 self::assertArrayHasKey('user_id', $result);
3094 self::assertArrayHasKey('status_id_str', $result);
3095 self::assertArrayHasKey('user_id_str', $result);
3096 self::assertArrayHasKey('screen_name', $result);
3100 * Test the api_in_reply_to() function with a valid item.
3104 public function testApiInReplyToWithValidItem()
3106 $this->markTestIncomplete();
3110 * Test the api_clean_plain_items() function.
3114 public function testApiCleanPlainItems()
3116 $_REQUEST['include_entities'] = 'true';
3117 $result = api_clean_plain_items('some_text [url="some_url"]some_text[/url]');
3118 self::assertEquals('some_text [url="some_url"]"some_url"[/url]', $result);
3122 * Test the api_best_nickname() function with contacts.
3126 public function testApiBestNicknameWithContacts()
3128 $this->markTestIncomplete();
3132 * Test the api_friendica_group_show() function.
3136 public function testApiFriendicaGroupShow()
3138 $this->markTestIncomplete();
3142 * Test the api_friendica_group_delete() function.
3146 public function testApiFriendicaGroupDelete()
3148 $this->markTestIncomplete();
3152 * Test the api_lists_destroy() function.
3156 public function testApiListsDestroy()
3158 $this->markTestIncomplete();
3162 * Test the group_create() function.
3166 public function testGroupCreate()
3168 $this->markTestIncomplete();
3172 * Test the api_friendica_group_create() function.
3176 public function testApiFriendicaGroupCreate()
3178 $this->markTestIncomplete();
3182 * Test the api_lists_create() function.
3186 public function testApiListsCreate()
3188 $this->markTestIncomplete();
3192 * Test the api_friendica_group_update() function.
3196 public function testApiFriendicaGroupUpdate()
3198 $this->markTestIncomplete();
3202 * Test the api_lists_update() function.
3206 public function testApiListsUpdate()
3208 $this->markTestIncomplete();
3212 * Test the api_friendica_activity() function.
3216 public function testApiFriendicaActivity()
3218 $this->markTestIncomplete();
3222 * Test the api_friendica_notification_seen() function.
3226 public function testApiFriendicaNotificationSeen()
3228 $this->markTestIncomplete();
3232 * Test the api_friendica_direct_messages_setseen() function.
3236 public function testApiFriendicaDirectMessagesSetseen()
3238 $this->markTestIncomplete();
3242 * Test the api_friendica_direct_messages_search() function.
3246 public function testApiFriendicaDirectMessagesSearch()
3248 $this->markTestIncomplete();