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_unique_id_to_nurl() function.
593 public function testApiUniqueIdToNurl()
595 self::assertFalse(api_unique_id_to_nurl($this->wrongUserId));
599 * Test the api_unique_id_to_nurl() function with a correct ID.
603 public function testApiUniqueIdToNurlWithCorrectId()
605 self::assertEquals($this->otherUser['nurl'], api_unique_id_to_nurl($this->otherUser['id']));
609 * Test the api_get_user() function.
613 public function testApiGetUser()
615 // $user = api_get_user();
616 // self::assertSelfUser($user);
617 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
618 // self::assertEquals('6fdbe8', $user['profile_link_color']);
619 // self::assertEquals('ededed', $user['profile_background_color']);
623 * Test the api_get_user() function with a Frio schema.
627 public function testApiGetUserWithFrioSchema()
629 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
630 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', 'red');
631 // $user = api_get_user();
632 // self::assertSelfUser($user);
633 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
634 // self::assertEquals('6fdbe8', $user['profile_link_color']);
635 // self::assertEquals('ededed', $user['profile_background_color']);
639 * Test the api_get_user() function with an empty Frio schema.
643 public function testApiGetUserWithEmptyFrioSchema()
645 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
646 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
647 // $user = api_get_user();
648 // self::assertSelfUser($user);
649 // self::assertEquals('708fa0', $user['profile_sidebar_fill_color']);
650 // self::assertEquals('6fdbe8', $user['profile_link_color']);
651 // self::assertEquals('ededed', $user['profile_background_color']);
655 * Test the api_get_user() function with a custom Frio schema.
659 public function testApiGetUserWithCustomFrioSchema()
661 // $pConfig = $this->dice->create(IManagePersonalConfigValues::class);
662 // $pConfig->set($this->selfUser['id'], 'frio', 'schema', '---');
663 // $pConfig->set($this->selfUser['id'], 'frio', 'nav_bg', '#123456');
664 // $pConfig->set($this->selfUser['id'], 'frio', 'link_color', '#123456');
665 // $pConfig->set($this->selfUser['id'], 'frio', 'background_color', '#123456');
666 // $user = api_get_user();
667 // self::assertSelfUser($user);
668 // self::assertEquals('123456', $user['profile_sidebar_fill_color']);
669 // self::assertEquals('123456', $user['profile_link_color']);
670 // self::assertEquals('123456', $user['profile_background_color']);
674 * Test the api_get_user() function with an user that is not allowed to use the API.
676 * @runInSeparateProcess
677 * @preserveGlobalState disabled
679 public function testApiGetUserWithoutApiUser()
681 // api_get_user() with empty parameters is not used anymore
683 $_SERVER['PHP_AUTH_USER'] = 'Test user';
684 $_SERVER['PHP_AUTH_PW'] = 'password';
685 BasicAuth::setCurrentUserID();
686 self::assertFalse(api_get_user());
691 * Test the api_get_user() function with an user ID in a GET parameter.
695 public function testApiGetUserWithGetId()
697 // self::assertOtherUser(api_get_user());
701 * Test the api_get_user() function with a wrong user ID in a GET parameter.
705 public function testApiGetUserWithWrongGetId()
707 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
708 // self::assertOtherUser(api_get_user());
712 * Test the api_get_user() function with an user name in a GET parameter.
716 public function testApiGetUserWithGetName()
718 // self::assertSelfUser(api_get_user());
722 * Test the api_get_user() function with a profile URL in a GET parameter.
726 public function testApiGetUserWithGetUrl()
728 // self::assertSelfUser(api_get_user());
732 * Test the api_get_user() function with an user ID in the API path.
736 public function testApiGetUserWithNumericCalledApi()
738 // global $called_api;
739 // $called_api = ['api_path'];
740 // DI::args()->setArgv(['', $this->otherUser['id'] . '.json']);
741 // self::assertOtherUser(api_get_user());
745 * Test the api_get_user() function with the $called_api global variable.
749 public function testApiGetUserWithCalledApi()
751 // global $called_api;
752 // $called_api = ['api', 'api_path'];
753 // self::assertSelfUser(api_get_user());
757 * Test the api_get_user() function with a 0 user ID.
761 public function testApiGetUserWithZeroUser()
763 self::assertSelfUser(DI::twitterUser()->createFromUserId(BaseApi::getCurrentUserID())->toArray());
767 * Test the Arrays::walkRecursive() function.
771 public function testApiWalkRecursive()
776 Arrays::walkRecursive(
779 // Should we test this with a callback that actually does something?
787 * Test the Arrays::walkRecursive() function with an array.
791 public function testApiWalkRecursiveWithArray()
793 $array = [['item1'], ['item2']];
796 Arrays::walkRecursive(
799 // Should we test this with a callback that actually does something?
807 * Test the BaseApi::reformatXML() function.
811 public function testApiReformatXml()
815 self::assertTrue(ApiResponse::reformatXML($item, $key));
816 self::assertEquals('true', $item);
820 * Test the BaseApi::reformatXML() function with a statusnet_api key.
824 public function testApiReformatXmlWithStatusnetKey()
827 $key = 'statusnet_api';
828 self::assertTrue(ApiResponse::reformatXML($item, $key));
829 self::assertEquals('statusnet:api', $key);
833 * Test the BaseApi::reformatXML() function with a friendica_api key.
837 public function testApiReformatXmlWithFriendicaKey()
840 $key = 'friendica_api';
841 self::assertTrue(ApiResponse::reformatXML($item, $key));
842 self::assertEquals('friendica:api', $key);
846 * Test the BaseApi::createXML() function.
850 public function testApiCreateXml()
853 '<?xml version="1.0"?>' . "\n" .
854 '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
855 'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
856 'xmlns:georss="http://www.georss.org/georss">' . "\n" .
857 ' <data>some_data</data>' . "\n" .
858 '</root_element>' . "\n",
859 DI::apiResponse()->createXML(['data' => ['some_data']], 'root_element')
864 * Test the BaseApi::createXML() function without any XML namespace.
868 public function testApiCreateXmlWithoutNamespaces()
871 '<?xml version="1.0"?>' . "\n" .
873 ' <data>some_data</data>' . "\n" .
875 DI::apiResponse()->createXML(['data' => ['some_data']], 'ok')
880 * Test the BaseApi::formatData() function.
884 public function testApiFormatData()
886 $data = ['some_data'];
887 self::assertEquals($data, DI::apiResponse()->formatData('root_element', 'json', $data));
891 * Test the BaseApi::formatData() function with an XML result.
895 public function testApiFormatDataWithXml()
898 '<?xml version="1.0"?>' . "\n" .
899 '<root_element xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" ' .
900 'xmlns:friendica="http://friendi.ca/schema/api/1/" ' .
901 'xmlns:georss="http://www.georss.org/georss">' . "\n" .
902 ' <data>some_data</data>' . "\n" .
903 '</root_element>' . "\n",
904 DI::apiResponse()->formatData('root_element', 'xml', ['data' => ['some_data']])
909 * Test the api_account_verify_credentials() function.
913 public function testApiAccountVerifyCredentials()
915 self::assertArrayHasKey('user', api_account_verify_credentials('json'));
919 * Test the api_account_verify_credentials() function without an authenticated user.
923 public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser()
925 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
926 BasicAuth::setCurrentUserID();
927 $_SESSION['authenticated'] = false;
928 api_account_verify_credentials('json');
932 * Test the requestdata() function.
936 public function testRequestdata()
938 self::assertNull(requestdata('variable_name'));
942 * Test the requestdata() function with a POST parameter.
946 public function testRequestdataWithPost()
948 $_POST['variable_name'] = 'variable_value';
949 self::assertEquals('variable_value', requestdata('variable_name'));
953 * Test the requestdata() function with a GET parameter.
957 public function testRequestdataWithGet()
959 $_GET['variable_name'] = 'variable_value';
960 self::assertEquals('variable_value', requestdata('variable_name'));
964 * Test the api_statuses_mediap() function.
968 public function testApiStatusesMediap()
970 DI::args()->setArgc(2);
978 'tmp_name' => $this->getTempImage(),
979 'name' => 'spacer.png',
980 'type' => 'image/png'
983 $_GET['status'] = '<b>Status content</b>';
985 $result = api_statuses_mediap('json');
986 self::assertStatus($result['status']);
990 * Test the api_statuses_mediap() function without an authenticated user.
994 public function testApiStatusesMediapWithoutAuthenticatedUser()
996 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
997 BasicAuth::setCurrentUserID();
998 $_SESSION['authenticated'] = false;
999 api_statuses_mediap('json');
1003 * Test the api_statuses_update() function.
1007 public function testApiStatusesUpdate()
1009 $_GET['status'] = 'Status content #friendica';
1010 $_GET['in_reply_to_status_id'] = -1;
1019 'tmp_name' => $this->getTempImage(),
1020 'name' => 'spacer.png',
1021 'type' => 'image/png'
1025 $result = api_statuses_update('json');
1026 self::assertStatus($result['status']);
1030 * Test the api_statuses_update() function with an HTML status.
1034 public function testApiStatusesUpdateWithHtml()
1036 $_GET['htmlstatus'] = '<b>Status content</b>';
1038 $result = api_statuses_update('json');
1039 self::assertStatus($result['status']);
1043 * Test the api_statuses_update() function without an authenticated user.
1047 public function testApiStatusesUpdateWithoutAuthenticatedUser()
1049 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1050 BasicAuth::setCurrentUserID();
1051 $_SESSION['authenticated'] = false;
1052 api_statuses_update('json');
1056 * Test the api_statuses_update() function with a parent status.
1060 public function testApiStatusesUpdateWithParent()
1062 $this->markTestIncomplete('This triggers an exit() somewhere and kills PHPUnit.');
1066 * Test the api_statuses_update() function with a media_ids parameter.
1070 public function testApiStatusesUpdateWithMediaIds()
1072 $this->markTestIncomplete();
1076 * Test the api_statuses_update() function with the throttle limit reached.
1080 public function testApiStatusesUpdateWithDayThrottleReached()
1082 $this->markTestIncomplete();
1086 * Test the api_media_upload() function.
1087 * @runInSeparateProcess
1088 * @preserveGlobalState disabled
1090 public function testApiMediaUpload()
1092 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1097 * Test the api_media_upload() function without an authenticated user.
1101 public function testApiMediaUploadWithoutAuthenticatedUser()
1103 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1104 BasicAuth::setCurrentUserID();
1105 $_SESSION['authenticated'] = false;
1110 * Test the api_media_upload() function with an invalid uploaded media.
1114 public function testApiMediaUploadWithMedia()
1116 $this->expectException(\Friendica\Network\HTTPException\InternalServerErrorException::class);
1120 'tmp_name' => 'tmp_name'
1127 * Test the api_media_upload() function with an valid uploaded media.
1131 public function testApiMediaUploadWithValidMedia()
1139 'tmp_name' => $this->getTempImage(),
1140 'name' => 'spacer.png',
1141 'type' => 'image/png'
1145 DI::args()->setArgc(2);
1147 $result = api_media_upload();
1148 self::assertEquals('image/png', $result['media']['image']['image_type']);
1149 self::assertEquals(1, $result['media']['image']['w']);
1150 self::assertEquals(1, $result['media']['image']['h']);
1151 self::assertNotEmpty($result['media']['image']['friendica_preview_url']);
1155 * Test the api_status_show() function.
1157 public function testApiStatusShowWithJson()
1159 $result = api_status_show('json', 1);
1160 self::assertStatus($result['status']);
1164 * Test the api_status_show() function with an XML result.
1166 public function testApiStatusShowWithXml()
1168 $result = api_status_show('xml', 1);
1169 self::assertXml($result, 'statuses');
1173 * Test the api_get_last_status() function
1175 public function testApiGetLastStatus()
1177 $item = api_get_last_status($this->selfUser['id'], $this->selfUser['id']);
1179 self::assertNotNull($item);
1183 * Test the api_users_show() function.
1187 public function testApiUsersShow()
1189 $result = api_users_show('json');
1190 // We can't use assertSelfUser() here because the user object is missing some properties.
1191 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
1192 self::assertEquals('DFRN', $result['user']['location']);
1193 self::assertEquals($this->selfUser['name'], $result['user']['name']);
1194 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
1195 self::assertEquals('dfrn', $result['user']['network']);
1196 self::assertTrue($result['user']['verified']);
1200 * Test the api_users_show() function with an XML result.
1204 public function testApiUsersShowWithXml()
1206 $result = api_users_show('xml');
1207 self::assertXml($result, 'statuses');
1211 * Test the api_users_search() function.
1215 public function testApiUsersSearch()
1217 $_GET['q'] = 'othercontact';
1218 $result = api_users_search('json');
1219 self::assertOtherUser($result['users'][0]);
1223 * Test the api_users_search() function with an XML result.
1227 public function testApiUsersSearchWithXml()
1229 $_GET['q'] = 'othercontact';
1230 $result = api_users_search('xml');
1231 self::assertXml($result, 'users');
1235 * Test the api_users_search() function without a GET q parameter.
1239 public function testApiUsersSearchWithoutQuery()
1241 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1242 api_users_search('json');
1246 * Test the api_users_lookup() function.
1250 public function testApiUsersLookup()
1252 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
1253 api_users_lookup('json');
1257 * Test the api_users_lookup() function with an user ID.
1261 public function testApiUsersLookupWithUserId()
1263 $_REQUEST['user_id'] = $this->otherUser['id'];
1264 $result = api_users_lookup('json');
1265 self::assertOtherUser($result['users'][0]);
1269 * Test the api_search() function.
1273 public function testApiSearch()
1275 $_REQUEST['q'] = 'reply';
1276 $_REQUEST['max_id'] = 10;
1277 $result = api_search('json');
1278 foreach ($result['status'] as $status) {
1279 self::assertStatus($status);
1280 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1285 * Test the api_search() function a count parameter.
1289 public function testApiSearchWithCount()
1291 $_REQUEST['q'] = 'reply';
1292 $_REQUEST['count'] = 20;
1293 $result = api_search('json');
1294 foreach ($result['status'] as $status) {
1295 self::assertStatus($status);
1296 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1301 * Test the api_search() function with an rpp parameter.
1305 public function testApiSearchWithRpp()
1307 $_REQUEST['q'] = 'reply';
1308 $_REQUEST['rpp'] = 20;
1309 $result = api_search('json');
1310 foreach ($result['status'] as $status) {
1311 self::assertStatus($status);
1312 self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
1317 * Test the api_search() function with an q parameter contains hashtag.
1318 * @doesNotPerformAssertions
1320 public function testApiSearchWithHashtag()
1322 $_REQUEST['q'] = '%23friendica';
1323 $result = api_search('json');
1324 foreach ($result['status'] as $status) {
1325 self::assertStatus($status);
1326 self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true);
1331 * Test the api_search() function with an exclude_replies parameter.
1332 * @doesNotPerformAssertions
1334 public function testApiSearchWithExcludeReplies()
1336 $_REQUEST['max_id'] = 10;
1337 $_REQUEST['exclude_replies'] = true;
1338 $_REQUEST['q'] = 'friendica';
1339 $result = api_search('json');
1340 foreach ($result['status'] as $status) {
1341 self::assertStatus($status);
1346 * Test the api_search() function without an authenticated user.
1350 public function testApiSearchWithUnallowedUser()
1352 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1353 BasicAuth::setCurrentUserID();
1358 * Test the api_search() function without any GET query parameter.
1362 public function testApiSearchWithoutQuery()
1364 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1369 * Test the api_statuses_home_timeline() function.
1373 public function testApiStatusesHomeTimeline()
1375 $_REQUEST['max_id'] = 10;
1376 $_REQUEST['exclude_replies'] = true;
1377 $_REQUEST['conversation_id'] = 1;
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() function with a negative page parameter.
1390 public function testApiStatusesHomeTimelineWithNegativePage()
1392 $_REQUEST['page'] = -2;
1393 $result = api_statuses_home_timeline('json');
1394 self::assertNotEmpty($result['status']);
1395 foreach ($result['status'] as $status) {
1396 self::assertStatus($status);
1401 * Test the api_statuses_home_timeline() with an unallowed user.
1405 public function testApiStatusesHomeTimelineWithUnallowedUser()
1407 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1408 BasicAuth::setCurrentUserID();
1409 api_statuses_home_timeline('json');
1413 * Test the api_statuses_home_timeline() function with an RSS result.
1417 public function testApiStatusesHomeTimelineWithRss()
1419 $result = api_statuses_home_timeline('rss');
1420 self::assertXml($result, 'statuses');
1424 * Test the api_statuses_public_timeline() function.
1428 public function testApiStatusesPublicTimeline()
1430 $_REQUEST['max_id'] = 10;
1431 $_REQUEST['conversation_id'] = 1;
1432 $result = api_statuses_public_timeline('json');
1433 self::assertNotEmpty($result['status']);
1434 foreach ($result['status'] as $status) {
1435 self::assertStatus($status);
1440 * Test the api_statuses_public_timeline() function with the exclude_replies parameter.
1444 public function testApiStatusesPublicTimelineWithExcludeReplies()
1446 $_REQUEST['max_id'] = 10;
1447 $_REQUEST['exclude_replies'] = true;
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 a negative page parameter.
1460 public function testApiStatusesPublicTimelineWithNegativePage()
1462 $_REQUEST['page'] = -2;
1463 $result = api_statuses_public_timeline('json');
1464 self::assertNotEmpty($result['status']);
1465 foreach ($result['status'] as $status) {
1466 self::assertStatus($status);
1471 * Test the api_statuses_public_timeline() function with an unallowed user.
1475 public function testApiStatusesPublicTimelineWithUnallowedUser()
1477 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1478 BasicAuth::setCurrentUserID();
1479 api_statuses_public_timeline('json');
1483 * Test the api_statuses_public_timeline() function with an RSS result.
1487 public function testApiStatusesPublicTimelineWithRss()
1489 $result = api_statuses_public_timeline('rss');
1490 self::assertXml($result, 'statuses');
1494 * Test the api_statuses_networkpublic_timeline() function.
1498 public function testApiStatusesNetworkpublicTimeline()
1500 $_REQUEST['max_id'] = 10;
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 a negative page parameter.
1513 public function testApiStatusesNetworkpublicTimelineWithNegativePage()
1515 $_REQUEST['page'] = -2;
1516 $result = api_statuses_networkpublic_timeline('json');
1517 self::assertNotEmpty($result['status']);
1518 foreach ($result['status'] as $status) {
1519 self::assertStatus($status);
1524 * Test the api_statuses_networkpublic_timeline() function with an unallowed user.
1528 public function testApiStatusesNetworkpublicTimelineWithUnallowedUser()
1530 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1531 BasicAuth::setCurrentUserID();
1532 api_statuses_networkpublic_timeline('json');
1536 * Test the api_statuses_networkpublic_timeline() function with an RSS result.
1540 public function testApiStatusesNetworkpublicTimelineWithRss()
1542 $result = api_statuses_networkpublic_timeline('rss');
1543 self::assertXml($result, 'statuses');
1547 * Test the api_statuses_show() function.
1551 public function testApiStatusesShow()
1553 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1554 api_statuses_show('json');
1558 * Test the api_statuses_show() function with an ID.
1562 public function testApiStatusesShowWithId()
1564 DI::args()->setArgv(['', '', '', 1]);
1565 $result = api_statuses_show('json');
1566 self::assertStatus($result['status']);
1570 * Test the api_statuses_show() function with the conversation parameter.
1574 public function testApiStatusesShowWithConversation()
1576 DI::args()->setArgv(['', '', '', 1]);
1577 $_REQUEST['conversation'] = 1;
1578 $result = api_statuses_show('json');
1579 self::assertNotEmpty($result['status']);
1580 foreach ($result['status'] as $status) {
1581 self::assertStatus($status);
1586 * Test the api_statuses_show() function with an unallowed user.
1590 public function testApiStatusesShowWithUnallowedUser()
1592 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1593 BasicAuth::setCurrentUserID();
1594 api_statuses_show('json');
1598 * Test the api_conversation_show() function.
1602 public function testApiConversationShow()
1604 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1605 api_conversation_show('json');
1609 * Test the api_conversation_show() function with an ID.
1613 public function testApiConversationShowWithId()
1615 DI::args()->setArgv(['', '', '', 1]);
1616 $_REQUEST['max_id'] = 10;
1617 $_REQUEST['page'] = -2;
1618 $result = api_conversation_show('json');
1619 self::assertNotEmpty($result['status']);
1620 foreach ($result['status'] as $status) {
1621 self::assertStatus($status);
1626 * Test the api_conversation_show() function with an unallowed user.
1630 public function testApiConversationShowWithUnallowedUser()
1632 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1633 BasicAuth::setCurrentUserID();
1634 api_conversation_show('json');
1638 * Test the api_statuses_repeat() function.
1642 public function testApiStatusesRepeat()
1644 $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class);
1645 api_statuses_repeat('json');
1649 * Test the api_statuses_repeat() function without an authenticated user.
1653 public function testApiStatusesRepeatWithoutAuthenticatedUser()
1655 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1656 BasicAuth::setCurrentUserID();
1657 $_SESSION['authenticated'] = false;
1658 api_statuses_repeat('json');
1662 * Test the api_statuses_repeat() function with an ID.
1666 public function testApiStatusesRepeatWithId()
1668 DI::args()->setArgv(['', '', '', 1]);
1669 $result = api_statuses_repeat('json');
1670 self::assertStatus($result['status']);
1672 // Also test with a shared status
1673 DI::args()->setArgv(['', '', '', 5]);
1674 $result = api_statuses_repeat('json');
1675 self::assertStatus($result['status']);
1679 * Test the api_statuses_destroy() function.
1683 public function testApiStatusesDestroy()
1685 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1686 api_statuses_destroy('json');
1690 * Test the api_statuses_destroy() function without an authenticated user.
1694 public function testApiStatusesDestroyWithoutAuthenticatedUser()
1696 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1697 BasicAuth::setCurrentUserID();
1698 $_SESSION['authenticated'] = false;
1699 api_statuses_destroy('json');
1703 * Test the api_statuses_destroy() function with an ID.
1707 public function testApiStatusesDestroyWithId()
1709 DI::args()->setArgv(['', '', '', 1]);
1710 $result = api_statuses_destroy('json');
1711 self::assertStatus($result['status']);
1715 * Test the api_statuses_mentions() function.
1719 public function testApiStatusesMentions()
1721 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
1722 $_REQUEST['max_id'] = 10;
1723 $result = api_statuses_mentions('json');
1724 self::assertEmpty($result['status']);
1725 // We should test with mentions in the database.
1729 * Test the api_statuses_mentions() function with a negative page parameter.
1733 public function testApiStatusesMentionsWithNegativePage()
1735 $_REQUEST['page'] = -2;
1736 $result = api_statuses_mentions('json');
1737 self::assertEmpty($result['status']);
1741 * Test the api_statuses_mentions() function with an unallowed user.
1745 public function testApiStatusesMentionsWithUnallowedUser()
1747 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1748 BasicAuth::setCurrentUserID();
1749 api_statuses_mentions('json');
1753 * Test the api_statuses_mentions() function with an RSS result.
1757 public function testApiStatusesMentionsWithRss()
1759 $result = api_statuses_mentions('rss');
1760 self::assertXml($result, 'statuses');
1764 * Test the api_statuses_user_timeline() function.
1768 public function testApiStatusesUserTimeline()
1770 $_REQUEST['max_id'] = 10;
1771 $_REQUEST['exclude_replies'] = true;
1772 $_REQUEST['conversation_id'] = 1;
1773 $result = api_statuses_user_timeline('json');
1774 self::assertNotEmpty($result['status']);
1775 foreach ($result['status'] as $status) {
1776 self::assertStatus($status);
1781 * Test the api_statuses_user_timeline() function with a negative page parameter.
1785 public function testApiStatusesUserTimelineWithNegativePage()
1787 $_REQUEST['page'] = -2;
1788 $result = api_statuses_user_timeline('json');
1789 self::assertNotEmpty($result['status']);
1790 foreach ($result['status'] as $status) {
1791 self::assertStatus($status);
1796 * Test the api_statuses_user_timeline() function with an RSS result.
1800 public function testApiStatusesUserTimelineWithRss()
1802 $result = api_statuses_user_timeline('rss');
1803 self::assertXml($result, 'statuses');
1807 * Test the api_statuses_user_timeline() function with an unallowed user.
1811 public function testApiStatusesUserTimelineWithUnallowedUser()
1813 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1814 BasicAuth::setCurrentUserID();
1815 api_statuses_user_timeline('json');
1819 * Test the api_favorites_create_destroy() function.
1823 public function testApiFavoritesCreateDestroy()
1825 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1826 DI::args()->setArgv(['api', '1.1', 'favorites', 'create']);
1827 api_favorites_create_destroy('json');
1831 * Test the api_favorites_create_destroy() function with an invalid ID.
1835 public function testApiFavoritesCreateDestroyWithInvalidId()
1837 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1838 DI::args()->setArgv(['api', '1.1', 'favorites', 'create', '12.json']);
1839 api_favorites_create_destroy('json');
1843 * Test the api_favorites_create_destroy() function with an invalid action.
1847 public function testApiFavoritesCreateDestroyWithInvalidAction()
1849 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
1850 DI::args()->setArgv(['api', '1.1', 'favorites', 'change.json']);
1851 $_REQUEST['id'] = 1;
1852 api_favorites_create_destroy('json');
1856 * Test the api_favorites_create_destroy() function with the create action.
1860 public function testApiFavoritesCreateDestroyWithCreateAction()
1862 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1863 $_REQUEST['id'] = 3;
1864 $result = api_favorites_create_destroy('json');
1865 self::assertStatus($result['status']);
1869 * Test the api_favorites_create_destroy() function with the create action and an RSS result.
1873 public function testApiFavoritesCreateDestroyWithCreateActionAndRss()
1875 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.rss']);
1876 $_REQUEST['id'] = 3;
1877 $result = api_favorites_create_destroy('rss');
1878 self::assertXml($result, 'status');
1882 * Test the api_favorites_create_destroy() function with the destroy action.
1886 public function testApiFavoritesCreateDestroyWithDestroyAction()
1888 DI::args()->setArgv(['api', '1.1', 'favorites', 'destroy.json']);
1889 $_REQUEST['id'] = 3;
1890 $result = api_favorites_create_destroy('json');
1891 self::assertStatus($result['status']);
1895 * Test the api_favorites_create_destroy() function without an authenticated user.
1899 public function testApiFavoritesCreateDestroyWithoutAuthenticatedUser()
1901 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1902 DI::args()->setArgv(['api', '1.1', 'favorites', 'create.json']);
1903 BasicAuth::setCurrentUserID();
1904 $_SESSION['authenticated'] = false;
1905 api_favorites_create_destroy('json');
1909 * Test the api_favorites() function.
1913 public function testApiFavorites()
1915 $_REQUEST['page'] = -1;
1916 $_REQUEST['max_id'] = 10;
1917 $result = api_favorites('json');
1918 foreach ($result['status'] as $status) {
1919 self::assertStatus($status);
1924 * Test the api_favorites() function with an RSS result.
1928 public function testApiFavoritesWithRss()
1930 $result = api_favorites('rss');
1931 self::assertXml($result, 'statuses');
1935 * Test the api_favorites() function with an unallowed user.
1939 public function testApiFavoritesWithUnallowedUser()
1941 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
1942 BasicAuth::setCurrentUserID();
1943 api_favorites('json');
1947 * Test the api_format_messages() function.
1951 public function testApiFormatMessages()
1953 $result = api_format_messages(
1954 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1955 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1956 ['id' => 3, 'uri-id' => 2, 'screen_name' => 'sender_name']
1958 self::assertEquals('item_title' . "\n" . 'item_body', $result['text']);
1959 self::assertEquals(1, $result['id']);
1960 self::assertEquals(2, $result['recipient_id']);
1961 self::assertEquals(3, $result['sender_id']);
1962 self::assertEquals('recipient_name', $result['recipient_screen_name']);
1963 self::assertEquals('sender_name', $result['sender_screen_name']);
1967 * Test the api_format_messages() function with HTML.
1971 public function testApiFormatMessagesWithHtmlText()
1973 $_GET['getText'] = 'html';
1974 $result = api_format_messages(
1975 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1976 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1977 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1979 self::assertEquals('item_title', $result['title']);
1980 self::assertEquals('<strong>item_body</strong>', $result['text']);
1984 * Test the api_format_messages() function with plain text.
1988 public function testApiFormatMessagesWithPlainText()
1990 $_GET['getText'] = 'plain';
1991 $result = api_format_messages(
1992 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
1993 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
1994 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
1996 self::assertEquals('item_title', $result['title']);
1997 self::assertEquals('item_body', $result['text']);
2001 * Test the api_format_messages() function with the getUserObjects GET parameter set to false.
2005 public function testApiFormatMessagesWithoutUserObjects()
2007 $_GET['getUserObjects'] = 'false';
2008 $result = api_format_messages(
2009 ['id' => 1, 'uri-id' => 1, 'title' => 'item_title', 'body' => '[b]item_body[/b]'],
2010 ['id' => 2, 'uri-id' => 2, 'screen_name' => 'recipient_name'],
2011 ['id' => 3, 'uri-id' => 3, 'screen_name' => 'sender_name']
2013 self::assertTrue(!isset($result['sender']));
2014 self::assertTrue(!isset($result['recipient']));
2018 * Test the api_convert_item() function.
2022 public function testApiConvertItem()
2024 $result = api_convert_item(
2026 'network' => 'feed',
2027 'title' => 'item_title',
2029 // We need a long string to test that it is correctly cut
2030 'body' => 'perspiciatis impedit voluptatem quis molestiae ea qui ' .
2031 'reiciendis dolorum aut ducimus sunt consequatur inventore dolor ' .
2032 'officiis pariatur doloremque nemo culpa aut quidem qui dolore ' .
2033 'laudantium atque commodi alias voluptatem non possimus aperiam ' .
2034 'ipsum rerum consequuntur aut amet fugit quia aliquid praesentium ' .
2035 'repellendus quibusdam et et inventore mollitia rerum sit autem ' .
2036 'pariatur maiores ipsum accusantium perferendis vel sit possimus ' .
2037 'veritatis nihil distinctio qui eum repellat officia illum quos ' .
2038 'impedit quam iste esse unde qui suscipit aut facilis ut inventore ' .
2039 'omnis exercitationem quo magnam consequatur maxime aut illum ' .
2040 'soluta quaerat natus unde aspernatur et sed beatae nihil ullam ' .
2041 'temporibus corporis ratione blanditiis perspiciatis impedit ' .
2042 'voluptatem quis molestiae ea qui reiciendis dolorum aut ducimus ' .
2043 'sunt consequatur inventore dolor officiis pariatur doloremque ' .
2044 'nemo culpa aut quidem qui dolore laudantium atque commodi alias ' .
2045 'voluptatem non possimus aperiam ipsum rerum consequuntur aut ' .
2046 'amet fugit quia aliquid praesentium repellendus quibusdam et et ' .
2047 'inventore mollitia rerum sit autem pariatur maiores ipsum accusantium ' .
2048 'perferendis vel sit possimus veritatis nihil distinctio qui eum ' .
2049 'repellat officia illum quos impedit quam iste esse unde qui ' .
2050 'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
2051 'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
2052 'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
2053 'plink' => 'item_plink'
2056 self::assertStringStartsWith('item_title', $result['text']);
2057 self::assertStringStartsWith('<h4>item_title</h4><br>perspiciatis impedit voluptatem', $result['html']);
2061 * Test the api_convert_item() function with an empty item body.
2065 public function testApiConvertItemWithoutBody()
2067 $result = api_convert_item(
2069 'network' => 'feed',
2070 'title' => 'item_title',
2073 'plink' => 'item_plink'
2076 self::assertEquals("item_title", $result['text']);
2077 self::assertEquals('<h4>item_title</h4><br>item_plink', $result['html']);
2081 * Test the api_convert_item() function with the title in the body.
2085 public function testApiConvertItemWithTitleInBody()
2087 $result = api_convert_item(
2089 'title' => 'item_title',
2090 'body' => 'item_title item_body',
2094 self::assertEquals('item_title item_body', $result['text']);
2095 self::assertEquals('<h4>item_title</h4><br>item_title item_body', $result['html']);
2099 * Test the api_get_attachments() function.
2103 public function testApiGetAttachments()
2106 self::assertEmpty(api_get_attachments($body, 0));
2110 * Test the api_get_attachments() function with an img tag.
2114 public function testApiGetAttachmentsWithImage()
2116 $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2117 self::assertIsArray(api_get_attachments($body, 0));
2121 * Test the api_get_attachments() function with an img tag and an AndStatus user agent.
2125 public function testApiGetAttachmentsWithImageAndAndStatus()
2127 $_SERVER['HTTP_USER_AGENT'] = 'AndStatus';
2128 $body = '[img]http://via.placeholder.com/1x1.png[/img]';
2129 self::assertIsArray(api_get_attachments($body, 0));
2133 * Test the api_get_entitities() function.
2137 public function testApiGetEntitities()
2140 self::assertIsArray(api_get_entitities($text, 'bbcode', 0));
2144 * Test the api_get_entitities() function with the include_entities parameter.
2148 public function testApiGetEntititiesWithIncludeEntities()
2150 $_REQUEST['include_entities'] = 'true';
2152 $result = api_get_entitities($text, 'bbcode', 0);
2153 self::assertIsArray($result['hashtags']);
2154 self::assertIsArray($result['symbols']);
2155 self::assertIsArray($result['urls']);
2156 self::assertIsArray($result['user_mentions']);
2160 * Test the api_format_items_embeded_images() function.
2164 public function testApiFormatItemsEmbededImages()
2167 'text ' . DI::baseUrl() . '/display/item_guid',
2168 api_format_items_embeded_images(['guid' => 'item_guid'], 'text data:image/foo')
2173 * Test the api_contactlink_to_array() function.
2177 public function testApiContactlinkToArray()
2184 api_contactlink_to_array('text')
2189 * Test the api_contactlink_to_array() function with an URL.
2193 public function testApiContactlinkToArrayWithUrl()
2197 'name' => ['link_text'],
2200 api_contactlink_to_array('text <a href="url">link_text</a>')
2205 * Test the api_format_items_activities() function.
2209 public function testApiFormatItemsActivities()
2211 $item = ['uid' => 0, 'uri' => ''];
2212 $result = api_format_items_activities($item);
2213 self::assertArrayHasKey('like', $result);
2214 self::assertArrayHasKey('dislike', $result);
2215 self::assertArrayHasKey('attendyes', $result);
2216 self::assertArrayHasKey('attendno', $result);
2217 self::assertArrayHasKey('attendmaybe', $result);
2221 * Test the api_format_items_activities() function with an XML result.
2225 public function testApiFormatItemsActivitiesWithXml()
2227 $item = ['uid' => 0, 'uri' => ''];
2228 $result = api_format_items_activities($item, 'xml');
2229 self::assertArrayHasKey('friendica:like', $result);
2230 self::assertArrayHasKey('friendica:dislike', $result);
2231 self::assertArrayHasKey('friendica:attendyes', $result);
2232 self::assertArrayHasKey('friendica:attendno', $result);
2233 self::assertArrayHasKey('friendica:attendmaybe', $result);
2237 * Test the api_format_items() function.
2238 * @doesNotPerformAssertions
2240 public function testApiFormatItems()
2244 'item_network' => 'item_network',
2250 'author-network' => Protocol::DFRN,
2251 'author-link' => 'http://localhost/profile/othercontact',
2255 $result = api_format_items($items, ['id' => 0], true);
2256 foreach ($result as $status) {
2257 self::assertStatus($status);
2262 * Test the api_format_items() function with an XML result.
2263 * @doesNotPerformAssertions
2265 public function testApiFormatItemsWithXml()
2273 'author-network' => Protocol::DFRN,
2274 'author-link' => 'http://localhost/profile/othercontact',
2278 $result = api_format_items($items, ['id' => 0], true, 'xml');
2279 foreach ($result as $status) {
2280 self::assertStatus($status);
2285 * Test the api_lists_list() function.
2289 public function testApiListsList()
2291 $result = api_lists_list('json');
2292 self::assertEquals(['lists_list' => []], $result);
2296 * Test the api_lists_ownerships() function.
2300 public function testApiListsOwnerships()
2302 $result = api_lists_ownerships('json');
2303 foreach ($result['lists']['lists'] as $list) {
2304 self::assertList($list);
2309 * Test the api_lists_ownerships() function without an authenticated user.
2313 public function testApiListsOwnershipsWithoutAuthenticatedUser()
2315 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2316 BasicAuth::setCurrentUserID();
2317 $_SESSION['authenticated'] = false;
2318 api_lists_ownerships('json');
2322 * Test the api_lists_statuses() function.
2326 public function testApiListsStatuses()
2328 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2329 api_lists_statuses('json');
2333 * Test the api_lists_statuses() function with a list ID.
2334 * @doesNotPerformAssertions
2336 public function testApiListsStatusesWithListId()
2338 $_REQUEST['list_id'] = 1;
2339 $_REQUEST['page'] = -1;
2340 $_REQUEST['max_id'] = 10;
2341 $result = api_lists_statuses('json');
2342 foreach ($result['status'] as $status) {
2343 self::assertStatus($status);
2348 * Test the api_lists_statuses() function with a list ID and a RSS result.
2352 public function testApiListsStatusesWithListIdAndRss()
2354 $_REQUEST['list_id'] = 1;
2355 $result = api_lists_statuses('rss');
2356 self::assertXml($result, 'statuses');
2360 * Test the api_lists_statuses() function with an unallowed user.
2364 public function testApiListsStatusesWithUnallowedUser()
2366 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2367 BasicAuth::setCurrentUserID();
2368 api_lists_statuses('json');
2372 * Test the api_statuses_f() function.
2376 public function testApiStatusesFWithFriends()
2379 $result = api_statuses_f('friends');
2380 self::assertArrayHasKey('user', $result);
2384 * Test the api_statuses_f() function.
2388 public function testApiStatusesFWithFollowers()
2390 $result = api_statuses_f('followers');
2391 self::assertArrayHasKey('user', $result);
2395 * Test the api_statuses_f() function.
2399 public function testApiStatusesFWithBlocks()
2401 $result = api_statuses_f('blocks');
2402 self::assertArrayHasKey('user', $result);
2406 * Test the api_statuses_f() function.
2410 public function testApiStatusesFWithIncoming()
2412 $result = api_statuses_f('incoming');
2413 self::assertArrayHasKey('user', $result);
2417 * Test the api_statuses_f() function an undefined cursor GET variable.
2421 public function testApiStatusesFWithUndefinedCursor()
2423 $_GET['cursor'] = 'undefined';
2424 self::assertFalse(api_statuses_f('friends'));
2428 * Test the api_statuses_friends() function.
2432 public function testApiStatusesFriends()
2434 $result = api_statuses_friends('json');
2435 self::assertArrayHasKey('user', $result);
2439 * Test the api_statuses_friends() function an undefined cursor GET variable.
2443 public function testApiStatusesFriendsWithUndefinedCursor()
2445 $_GET['cursor'] = 'undefined';
2446 self::assertFalse(api_statuses_friends('json'));
2450 * Test the api_statuses_followers() function.
2454 public function testApiStatusesFollowers()
2456 $result = api_statuses_followers('json');
2457 self::assertArrayHasKey('user', $result);
2461 * Test the api_statuses_followers() function an undefined cursor GET variable.
2465 public function testApiStatusesFollowersWithUndefinedCursor()
2467 $_GET['cursor'] = 'undefined';
2468 self::assertFalse(api_statuses_followers('json'));
2472 * Test the api_blocks_list() function.
2476 public function testApiBlocksList()
2478 $result = api_blocks_list('json');
2479 self::assertArrayHasKey('user', $result);
2483 * Test the api_blocks_list() function an undefined cursor GET variable.
2487 public function testApiBlocksListWithUndefinedCursor()
2489 $_GET['cursor'] = 'undefined';
2490 self::assertFalse(api_blocks_list('json'));
2494 * Test the api_friendships_incoming() function.
2498 public function testApiFriendshipsIncoming()
2500 $result = api_friendships_incoming('json');
2501 self::assertArrayHasKey('id', $result);
2505 * Test the api_friendships_incoming() function an undefined cursor GET variable.
2509 public function testApiFriendshipsIncomingWithUndefinedCursor()
2511 $_GET['cursor'] = 'undefined';
2512 self::assertFalse(api_friendships_incoming('json'));
2516 * Test the api_statusnet_config() function.
2520 public function testApiStatusnetConfig()
2523 $result = api_statusnet_config('json');
2524 self::assertEquals('localhost', $result['config']['site']['server']);
2525 self::assertEquals('default', $result['config']['site']['theme']);
2526 self::assertEquals(DI::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']);
2527 self::assertTrue($result['config']['site']['fancy']);
2528 self::assertEquals('en', $result['config']['site']['language']);
2529 self::assertEquals('UTC', $result['config']['site']['timezone']);
2530 self::assertEquals(200000, $result['config']['site']['textlimit']);
2531 self::assertEquals('false', $result['config']['site']['private']);
2532 self::assertEquals('false', $result['config']['site']['ssl']);
2533 self::assertEquals(30, $result['config']['site']['shorturllength']);
2538 * Test the api_direct_messages_new() function.
2542 public function testApiDirectMessagesNew()
2544 $result = api_direct_messages_new('json');
2545 self::assertNull($result);
2549 * Test the api_direct_messages_new() function without an authenticated user.
2553 public function testApiDirectMessagesNewWithoutAuthenticatedUser()
2555 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2556 BasicAuth::setCurrentUserID();
2557 $_SESSION['authenticated'] = false;
2558 api_direct_messages_new('json');
2562 * Test the api_direct_messages_new() function with an user ID.
2566 public function testApiDirectMessagesNewWithUserId()
2568 $_POST['text'] = 'message_text';
2569 $_POST['user_id'] = $this->otherUser['id'];
2570 $result = api_direct_messages_new('json');
2571 self::assertEquals(['direct_message' => ['error' => -1]], $result);
2575 * Test the api_direct_messages_new() function with a screen name.
2579 public function testApiDirectMessagesNewWithScreenName()
2581 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2582 $_POST['text'] = 'message_text';
2583 $_POST['screen_name'] = $this->friendUser['nick'];
2584 $result = api_direct_messages_new('json');
2585 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2586 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2587 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2591 * Test the api_direct_messages_new() function with a title.
2595 public function testApiDirectMessagesNewWithTitle()
2597 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2598 $_POST['text'] = 'message_text';
2599 $_POST['screen_name'] = $this->friendUser['nick'];
2600 $_REQUEST['title'] = 'message_title';
2601 $result = api_direct_messages_new('json');
2602 self::assertStringContainsString('message_text', $result['direct_message']['text']);
2603 self::assertStringContainsString('message_title', $result['direct_message']['text']);
2604 self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
2605 self::assertEquals(1, $result['direct_message']['friendica_seen']);
2609 * Test the api_direct_messages_new() function with an RSS result.
2613 public function testApiDirectMessagesNewWithRss()
2615 $this->app->setLoggedInUserNickname($this->selfUser['nick']);
2616 $_POST['text'] = 'message_text';
2617 $_POST['screen_name'] = $this->friendUser['nick'];
2618 $result = api_direct_messages_new('rss');
2619 self::assertXml($result, 'direct-messages');
2623 * Test the api_direct_messages_destroy() function.
2627 public function testApiDirectMessagesDestroy()
2629 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2630 api_direct_messages_destroy('json');
2634 * Test the api_direct_messages_destroy() function with the friendica_verbose GET param.
2638 public function testApiDirectMessagesDestroyWithVerbose()
2640 $_GET['friendica_verbose'] = 'true';
2641 $result = api_direct_messages_destroy('json');
2645 'result' => 'error',
2646 'message' => 'message id or parenturi not specified'
2654 * Test the api_direct_messages_destroy() function without an authenticated user.
2658 public function testApiDirectMessagesDestroyWithoutAuthenticatedUser()
2660 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2661 BasicAuth::setCurrentUserID();
2662 $_SESSION['authenticated'] = false;
2663 api_direct_messages_destroy('json');
2667 * Test the api_direct_messages_destroy() function with a non-zero ID.
2671 public function testApiDirectMessagesDestroyWithId()
2673 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2674 $_REQUEST['id'] = 1;
2675 api_direct_messages_destroy('json');
2679 * Test the api_direct_messages_destroy() with a non-zero ID and the friendica_verbose GET param.
2683 public function testApiDirectMessagesDestroyWithIdAndVerbose()
2685 $_REQUEST['id'] = 1;
2686 $_REQUEST['friendica_parenturi'] = 'parent_uri';
2687 $_GET['friendica_verbose'] = 'true';
2688 $result = api_direct_messages_destroy('json');
2692 'result' => 'error',
2693 'message' => 'message id not in database'
2701 * Test the api_direct_messages_destroy() function with a non-zero ID.
2705 public function testApiDirectMessagesDestroyWithCorrectId()
2707 $this->markTestIncomplete('We need to add a dataset for this.');
2711 * Test the api_direct_messages_box() function.
2715 public function testApiDirectMessagesBoxWithSentbox()
2717 $_REQUEST['page'] = -1;
2718 $_REQUEST['max_id'] = 10;
2719 $result = api_direct_messages_box('json', 'sentbox', 'false');
2720 self::assertArrayHasKey('direct_message', $result);
2724 * Test the api_direct_messages_box() function.
2728 public function testApiDirectMessagesBoxWithConversation()
2730 $result = api_direct_messages_box('json', 'conversation', 'false');
2731 self::assertArrayHasKey('direct_message', $result);
2735 * Test the api_direct_messages_box() function.
2739 public function testApiDirectMessagesBoxWithAll()
2741 $result = api_direct_messages_box('json', 'all', 'false');
2742 self::assertArrayHasKey('direct_message', $result);
2746 * Test the api_direct_messages_box() function.
2750 public function testApiDirectMessagesBoxWithInbox()
2752 $result = api_direct_messages_box('json', 'inbox', 'false');
2753 self::assertArrayHasKey('direct_message', $result);
2757 * Test the api_direct_messages_box() function.
2761 public function testApiDirectMessagesBoxWithVerbose()
2763 $result = api_direct_messages_box('json', 'sentbox', 'true');
2767 'result' => 'error',
2768 'message' => 'no mails available'
2776 * Test the api_direct_messages_box() function with a RSS result.
2780 public function testApiDirectMessagesBoxWithRss()
2782 $result = api_direct_messages_box('rss', 'sentbox', 'false');
2783 self::assertXml($result, 'direct-messages');
2787 * Test the api_direct_messages_box() function without an authenticated user.
2791 public function testApiDirectMessagesBoxWithUnallowedUser()
2793 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2794 BasicAuth::setCurrentUserID();
2795 api_direct_messages_box('json', 'sentbox', 'false');
2799 * Test the api_direct_messages_sentbox() function.
2803 public function testApiDirectMessagesSentbox()
2805 $result = api_direct_messages_sentbox('json');
2806 self::assertArrayHasKey('direct_message', $result);
2810 * Test the api_direct_messages_inbox() function.
2814 public function testApiDirectMessagesInbox()
2816 $result = api_direct_messages_inbox('json');
2817 self::assertArrayHasKey('direct_message', $result);
2821 * Test the api_direct_messages_all() function.
2825 public function testApiDirectMessagesAll()
2827 $result = api_direct_messages_all('json');
2828 self::assertArrayHasKey('direct_message', $result);
2832 * Test the api_direct_messages_conversation() function.
2836 public function testApiDirectMessagesConversation()
2838 $result = api_direct_messages_conversation('json');
2839 self::assertArrayHasKey('direct_message', $result);
2843 * Test the api_oauth_request_token() function.
2847 public function testApiOauthRequestToken()
2849 $this->markTestIncomplete('exit() kills phpunit as well');
2853 * Test the api_oauth_access_token() function.
2857 public function testApiOauthAccessToken()
2859 $this->markTestIncomplete('exit() kills phpunit as well');
2863 * Test the api_fr_photos_list() function.
2867 public function testApiFrPhotosList()
2869 $result = api_fr_photos_list('json');
2870 self::assertArrayHasKey('photo', $result);
2874 * Test the api_fr_photos_list() function without an authenticated user.
2878 public function testApiFrPhotosListWithoutAuthenticatedUser()
2880 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2881 BasicAuth::setCurrentUserID();
2882 $_SESSION['authenticated'] = false;
2883 api_fr_photos_list('json');
2887 * Test the api_fr_photo_create_update() function.
2889 public function testApiFrPhotoCreateUpdate()
2891 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2892 api_fr_photo_create_update('json');
2896 * Test the api_fr_photo_create_update() function without an authenticated user.
2900 public function testApiFrPhotoCreateUpdateWithoutAuthenticatedUser()
2902 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2903 BasicAuth::setCurrentUserID();
2904 $_SESSION['authenticated'] = false;
2905 api_fr_photo_create_update('json');
2909 * Test the api_fr_photo_create_update() function with an album name.
2913 public function testApiFrPhotoCreateUpdateWithAlbum()
2915 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2916 $_REQUEST['album'] = 'album_name';
2917 api_fr_photo_create_update('json');
2921 * Test the api_fr_photo_create_update() function with the update mode.
2925 public function testApiFrPhotoCreateUpdateWithUpdate()
2927 $this->markTestIncomplete('We need to create a dataset for this');
2931 * Test the api_fr_photo_create_update() function with an uploaded file.
2935 public function testApiFrPhotoCreateUpdateWithFile()
2937 $this->markTestIncomplete();
2941 * Test the api_fr_photo_detail() function.
2945 public function testApiFrPhotoDetail()
2947 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2948 api_fr_photo_detail('json');
2952 * Test the api_fr_photo_detail() function without an authenticated user.
2956 public function testApiFrPhotoDetailWithoutAuthenticatedUser()
2958 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
2959 BasicAuth::setCurrentUserID();
2960 $_SESSION['authenticated'] = false;
2961 api_fr_photo_detail('json');
2965 * Test the api_fr_photo_detail() function with a photo ID.
2969 public function testApiFrPhotoDetailWithPhotoId()
2971 $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class);
2972 $_REQUEST['photo_id'] = 1;
2973 api_fr_photo_detail('json');
2977 * Test the api_fr_photo_detail() function with a correct photo ID.
2981 public function testApiFrPhotoDetailCorrectPhotoId()
2983 $this->markTestIncomplete('We need to create a dataset for this.');
2987 * Test the api_account_update_profile_image() function.
2991 public function testApiAccountUpdateProfileImage()
2993 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
2994 api_account_update_profile_image('json');
2998 * Test the api_account_update_profile_image() function without an authenticated user.
3002 public function testApiAccountUpdateProfileImageWithoutAuthenticatedUser()
3004 $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
3005 BasicAuth::setCurrentUserID();
3006 $_SESSION['authenticated'] = false;
3007 api_account_update_profile_image('json');
3011 * Test the api_account_update_profile_image() function with an uploaded file.
3015 public function testApiAccountUpdateProfileImageWithUpload()
3017 $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
3018 $this->markTestIncomplete();
3023 * Test the api_account_update_profile() function.
3027 public function testApiAccountUpdateProfile()
3029 $_POST['name'] = 'new_name';
3030 $_POST['description'] = 'new_description';
3031 $result = api_account_update_profile('json');
3032 // We can't use assertSelfUser() here because the user object is missing some properties.
3033 self::assertEquals($this->selfUser['id'], $result['user']['cid']);
3034 self::assertEquals('DFRN', $result['user']['location']);
3035 self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']);
3036 self::assertEquals('dfrn', $result['user']['network']);
3037 self::assertEquals('new_name', $result['user']['name']);
3038 self::assertEquals('new_description', $result['user']['description']);
3042 * Test the check_acl_input() function.
3046 public function testCheckAclInput()
3048 $result = check_acl_input('<aclstring>');
3049 // Where does this result come from?
3050 self::assertEquals(1, $result);
3054 * Test the check_acl_input() function with an empty ACL string.
3058 public function testCheckAclInputWithEmptyAclString()
3060 $result = check_acl_input(' ');
3061 self::assertFalse($result);
3065 * Test the save_media_to_database() function.
3069 public function testSaveMediaToDatabase()
3071 $this->markTestIncomplete();
3075 * Test the post_photo_item() function.
3079 public function testPostPhotoItem()
3081 $this->markTestIncomplete();
3085 * Test the prepare_photo_data() function.
3089 public function testPreparePhotoData()
3091 $this->markTestIncomplete();
3095 * Test the api_share_as_retweet() function with a valid item.
3099 public function testApiShareAsRetweetWithValidItem()
3101 $this->markTestIncomplete();
3105 * Test the api_in_reply_to() function.
3109 public function testApiInReplyTo()
3111 $result = api_in_reply_to(['id' => 0, 'parent' => 0, 'uri' => '', 'thr-parent' => '']);
3112 self::assertArrayHasKey('status_id', $result);
3113 self::assertArrayHasKey('user_id', $result);
3114 self::assertArrayHasKey('status_id_str', $result);
3115 self::assertArrayHasKey('user_id_str', $result);
3116 self::assertArrayHasKey('screen_name', $result);
3120 * Test the api_in_reply_to() function with a valid item.
3124 public function testApiInReplyToWithValidItem()
3126 $this->markTestIncomplete();
3130 * Test the api_clean_plain_items() function.
3134 public function testApiCleanPlainItems()
3136 $_REQUEST['include_entities'] = 'true';
3137 $result = api_clean_plain_items('some_text [url="some_url"]some_text[/url]');
3138 self::assertEquals('some_text [url="some_url"]"some_url"[/url]', $result);
3142 * Test the api_best_nickname() function.
3146 public function testApiBestNickname()
3149 $result = api_best_nickname($contacts);
3150 self::assertNull($result);
3154 * Test the api_best_nickname() function with contacts.
3158 public function testApiBestNicknameWithContacts()
3160 $this->markTestIncomplete();
3164 * Test the api_friendica_group_show() function.
3168 public function testApiFriendicaGroupShow()
3170 $this->markTestIncomplete();
3174 * Test the api_friendica_group_delete() function.
3178 public function testApiFriendicaGroupDelete()
3180 $this->markTestIncomplete();
3184 * Test the api_lists_destroy() function.
3188 public function testApiListsDestroy()
3190 $this->markTestIncomplete();
3194 * Test the group_create() function.
3198 public function testGroupCreate()
3200 $this->markTestIncomplete();
3204 * Test the api_friendica_group_create() function.
3208 public function testApiFriendicaGroupCreate()
3210 $this->markTestIncomplete();
3214 * Test the api_lists_create() function.
3218 public function testApiListsCreate()
3220 $this->markTestIncomplete();
3224 * Test the api_friendica_group_update() function.
3228 public function testApiFriendicaGroupUpdate()
3230 $this->markTestIncomplete();
3234 * Test the api_lists_update() function.
3238 public function testApiListsUpdate()
3240 $this->markTestIncomplete();
3244 * Test the api_friendica_activity() function.
3248 public function testApiFriendicaActivity()
3250 $this->markTestIncomplete();
3254 * Test the api_friendica_notification_seen() function.
3258 public function testApiFriendicaNotificationSeen()
3260 $this->markTestIncomplete();
3264 * Test the api_friendica_direct_messages_setseen() function.
3268 public function testApiFriendicaDirectMessagesSetseen()
3270 $this->markTestIncomplete();
3274 * Test the api_friendica_direct_messages_search() function.
3278 public function testApiFriendicaDirectMessagesSearch()
3280 $this->markTestIncomplete();