diff --git a/src/LegacyModule.php b/src/LegacyModule.php index f0dfe0e015..8c24617c83 100644 --- a/src/LegacyModule.php +++ b/src/LegacyModule.php @@ -68,12 +68,12 @@ class LegacyModule extends BaseModule require_once $file_path; } - public function content(array $request = []): string + protected function content(array $request = []): string { return $this->runModuleFunction('content'); } - public function post(array $request = [], array $post = []) + protected function post(array $request = [], array $post = []) { parent::post($post); diff --git a/src/Module/Api/Friendica/Notification/Seen.php b/src/Module/Api/Friendica/Notification/Seen.php index bb6c5b7385..92039be145 100644 --- a/src/Module/Api/Friendica/Notification/Seen.php +++ b/src/Module/Api/Friendica/Notification/Seen.php @@ -38,7 +38,7 @@ use Friendica\Network\HTTPException\NotFoundException; */ class Seen extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/GNUSocial/Statusnet/Conversation.php b/src/Module/Api/GNUSocial/Statusnet/Conversation.php index e81cd3d1fe..4b1760031d 100644 --- a/src/Module/Api/GNUSocial/Statusnet/Conversation.php +++ b/src/Module/Api/GNUSocial/Statusnet/Conversation.php @@ -34,7 +34,7 @@ use Friendica\Network\HTTPException\BadRequestException; */ class Conversation extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Filters.php b/src/Module/Api/Mastodon/Filters.php index 3c902bc17b..b48b38b6e4 100644 --- a/src/Module/Api/Mastodon/Filters.php +++ b/src/Module/Api/Mastodon/Filters.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Filters extends BaseApi { - public function post(array $request = [], array $post = []) + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); diff --git a/src/Module/Api/Twitter/Account/UpdateProfile.php b/src/Module/Api/Twitter/Account/UpdateProfile.php index 2f1e1efa2b..9c8c901511 100644 --- a/src/Module/Api/Twitter/Account/UpdateProfile.php +++ b/src/Module/Api/Twitter/Account/UpdateProfile.php @@ -32,7 +32,7 @@ use Friendica\Model\Profile; */ class UpdateProfile extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Account/VerifyCredentials.php b/src/Module/Api/Twitter/Account/VerifyCredentials.php index f5c0e0201f..170da69c66 100644 --- a/src/Module/Api/Twitter/Account/VerifyCredentials.php +++ b/src/Module/Api/Twitter/Account/VerifyCredentials.php @@ -32,7 +32,7 @@ use Friendica\DI; */ class VerifyCredentials extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Blocks/Ids.php b/src/Module/Api/Twitter/Blocks/Ids.php index c733d7d641..ea8655a63f 100644 --- a/src/Module/Api/Twitter/Blocks/Ids.php +++ b/src/Module/Api/Twitter/Blocks/Ids.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Ids extends ContactEndpoint { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Blocks/Lists.php b/src/Module/Api/Twitter/Blocks/Lists.php index 4eb03a920a..c0322ed6eb 100644 --- a/src/Module/Api/Twitter/Blocks/Lists.php +++ b/src/Module/Api/Twitter/Blocks/Lists.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Lists extends ContactEndpoint { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Favorites.php b/src/Module/Api/Twitter/Favorites.php index 4376b5b086..8c6f7082a4 100644 --- a/src/Module/Api/Twitter/Favorites.php +++ b/src/Module/Api/Twitter/Favorites.php @@ -35,7 +35,7 @@ use Friendica\Model\Post; */ class Favorites extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Friendships/Incoming.php b/src/Module/Api/Twitter/Friendships/Incoming.php index 6cc811453c..8a4a99565f 100644 --- a/src/Module/Api/Twitter/Friendships/Incoming.php +++ b/src/Module/Api/Twitter/Friendships/Incoming.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Incoming extends ContactEndpoint { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Lists/Statuses.php b/src/Module/Api/Twitter/Lists/Statuses.php index 41ef0a3019..03bbce7bde 100644 --- a/src/Module/Api/Twitter/Lists/Statuses.php +++ b/src/Module/Api/Twitter/Lists/Statuses.php @@ -35,7 +35,7 @@ use Friendica\Network\HTTPException\BadRequestException; */ class Statuses extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Search/Tweets.php b/src/Module/Api/Twitter/Search/Tweets.php index a8a0aea3af..4d1aec833e 100644 --- a/src/Module/Api/Twitter/Search/Tweets.php +++ b/src/Module/Api/Twitter/Search/Tweets.php @@ -36,7 +36,7 @@ use Friendica\Network\HTTPException\BadRequestException; */ class Tweets extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Statuses/Destroy.php b/src/Module/Api/Twitter/Statuses/Destroy.php index 193e6fa7e7..ae493eb2a1 100644 --- a/src/Module/Api/Twitter/Statuses/Destroy.php +++ b/src/Module/Api/Twitter/Statuses/Destroy.php @@ -34,7 +34,7 @@ use Friendica\Model\Item; */ class Destroy extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Statuses/HomeTimeline.php b/src/Module/Api/Twitter/Statuses/HomeTimeline.php index c805c7d7c8..c98134807a 100644 --- a/src/Module/Api/Twitter/Statuses/HomeTimeline.php +++ b/src/Module/Api/Twitter/Statuses/HomeTimeline.php @@ -35,7 +35,7 @@ use Friendica\Model\Post; */ class HomeTimeline extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Statuses/Mentions.php b/src/Module/Api/Twitter/Statuses/Mentions.php index 14a7f0b3f1..08970340fc 100644 --- a/src/Module/Api/Twitter/Statuses/Mentions.php +++ b/src/Module/Api/Twitter/Statuses/Mentions.php @@ -34,7 +34,7 @@ use Friendica\Model\Post; */ class Mentions extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Statuses/NetworkPublicTimeline.php b/src/Module/Api/Twitter/Statuses/NetworkPublicTimeline.php index 51aafef11d..56f2f10d50 100644 --- a/src/Module/Api/Twitter/Statuses/NetworkPublicTimeline.php +++ b/src/Module/Api/Twitter/Statuses/NetworkPublicTimeline.php @@ -33,7 +33,7 @@ use Friendica\Model\Post; */ class NetworkPublicTimeline extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Statuses/PublicTimeline.php b/src/Module/Api/Twitter/Statuses/PublicTimeline.php index 51e597ef32..ad4380fe1c 100644 --- a/src/Module/Api/Twitter/Statuses/PublicTimeline.php +++ b/src/Module/Api/Twitter/Statuses/PublicTimeline.php @@ -33,7 +33,7 @@ use Friendica\Model\Post; */ class PublicTimeline extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Statuses/Show.php b/src/Module/Api/Twitter/Statuses/Show.php index 28e5655a8e..681d4130b8 100644 --- a/src/Module/Api/Twitter/Statuses/Show.php +++ b/src/Module/Api/Twitter/Statuses/Show.php @@ -36,7 +36,7 @@ use Friendica\Network\HTTPException\BadRequestException; */ class Show extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Statuses/UserTimeline.php b/src/Module/Api/Twitter/Statuses/UserTimeline.php index 29fbc4fef6..2b01449099 100644 --- a/src/Module/Api/Twitter/Statuses/UserTimeline.php +++ b/src/Module/Api/Twitter/Statuses/UserTimeline.php @@ -35,7 +35,7 @@ use Friendica\Model\Post; */ class UserTimeline extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Users/Lookup.php b/src/Module/Api/Twitter/Users/Lookup.php index b8e28c3650..53bedd53a8 100644 --- a/src/Module/Api/Twitter/Users/Lookup.php +++ b/src/Module/Api/Twitter/Users/Lookup.php @@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\NotFoundException; */ class Lookup extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Users/Search.php b/src/Module/Api/Twitter/Users/Search.php index 7ec9bed373..e30480e267 100644 --- a/src/Module/Api/Twitter/Users/Search.php +++ b/src/Module/Api/Twitter/Users/Search.php @@ -35,7 +35,7 @@ use Friendica\Network\HTTPException\NotFoundException; */ class Search extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Users/Show.php b/src/Module/Api/Twitter/Users/Show.php index 1ace54880a..d0d8f17bba 100644 --- a/src/Module/Api/Twitter/Users/Show.php +++ b/src/Module/Api/Twitter/Users/Show.php @@ -32,7 +32,7 @@ use Friendica\DI; */ class Show extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 8d5e26a261..9ffd176267 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -157,7 +157,7 @@ class Contact extends BaseModule Model\Contact\User::setIgnored($contact_id, local_user(), $ignored); } - public function content($update = 0): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form($_SERVER['REQUEST_URI']); diff --git a/src/Module/OAuth/Revoke.php b/src/Module/OAuth/Revoke.php index 8e92c63c3f..6543969bfb 100644 --- a/src/Module/OAuth/Revoke.php +++ b/src/Module/OAuth/Revoke.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Revoke extends BaseApi { - public function post(array $request = [], array $post = []) + protected function post(array $request = [], array $post = []) { $request = self::getRequest([ 'client_id' => '', // Client ID, obtained during app registration diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index df76a2ae18..541a938c88 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -867,29 +867,6 @@ class ApiTest extends FixtureTest ); } - /** - * Test the api_account_verify_credentials() function. - * - * @return void - */ - public function testApiAccountVerifyCredentials() - { - // self::assertArrayHasKey('user', api_account_verify_credentials('json')); - } - - /** - * Test the api_account_verify_credentials() function without an authenticated user. - * - * @return void - */ - public function testApiAccountVerifyCredentialsWithoutAuthenticatedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // $_SESSION['authenticated'] = false; - // api_account_verify_credentials('json'); - } - /** * Test the api_statuses_mediap() function. * @@ -1081,519 +1058,6 @@ class ApiTest extends FixtureTest self::assertNotEmpty($result['media']['image']['friendica_preview_url']); } - /** - * Test the api_status_show() function. - */ - public function testApiStatusShowWithJson() - { - // $result = api_status_show('json', 1); - // self::assertStatus($result['status']); - } - - /** - * Test the api_status_show() function with an XML result. - */ - public function testApiStatusShowWithXml() - { - // $result = api_status_show('xml', 1); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_get_last_status() function - */ - public function testApiGetLastStatus() - { - // $item = api_get_last_status($this->selfUser['id'], $this->selfUser['id']); - // self::assertNotNull($item); - } - - /** - * Test the api_users_show() function. - * - * @return void - */ - public function testApiUsersShow() - { - /* - $result = api_users_show('json'); - // We can't use assertSelfUser() here because the user object is missing some properties. - self::assertEquals($this->selfUser['id'], $result['user']['cid']); - self::assertEquals('DFRN', $result['user']['location']); - self::assertEquals($this->selfUser['name'], $result['user']['name']); - self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']); - self::assertTrue($result['user']['verified']); - */ - } - - /** - * Test the api_users_show() function with an XML result. - * - * @return void - */ - public function testApiUsersShowWithXml() - { - // $result = api_users_show('xml'); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_users_search() function. - * - * @return void - */ - public function testApiUsersSearch() - { - // $_GET['q'] = 'othercontact'; - // $result = api_users_search('json'); - // self::assertOtherUser($result['users'][0]); - } - - /** - * Test the api_users_search() function with an XML result. - * - * @return void - */ - public function testApiUsersSearchWithXml() - { - // $_GET['q'] = 'othercontact'; - // $result = api_users_search('xml'); - // self::assertXml($result, 'users'); - } - - /** - * Test the api_users_search() function without a GET q parameter. - * - * @return void - */ - public function testApiUsersSearchWithoutQuery() - { - // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); - // api_users_search('json'); - } - - /** - * Test the api_users_lookup() function. - * - * @return void - */ - public function testApiUsersLookup() - { - // $this->expectException(\Friendica\Network\HTTPException\NotFoundException::class); - // api_users_lookup('json'); - } - - /** - * Test the api_users_lookup() function with an user ID. - * - * @return void - */ - public function testApiUsersLookupWithUserId() - { - // $_REQUEST['user_id'] = $this->otherUser['id']; - // $result = api_users_lookup('json'); - // self::assertOtherUser($result['users'][0]); - } - - /** - * Test the api_search() function. - * - * @return void - */ - public function testApiSearch() - { - /* - $_REQUEST['q'] = 'reply'; - $_REQUEST['max_id'] = 10; - $result = api_search('json'); - foreach ($result['status'] as $status) { - self::assertStatus($status); - self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true); - } - */ - } - - /** - * Test the api_search() function a count parameter. - * - * @return void - */ - public function testApiSearchWithCount() - { - /* - $_REQUEST['q'] = 'reply'; - $_REQUEST['count'] = 20; - $result = api_search('json'); - foreach ($result['status'] as $status) { - self::assertStatus($status); - self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true); - } - */ - } - - /** - * Test the api_search() function with an rpp parameter. - * - * @return void - */ - public function testApiSearchWithRpp() - { - /* - $_REQUEST['q'] = 'reply'; - $_REQUEST['rpp'] = 20; - $result = api_search('json'); - foreach ($result['status'] as $status) { - self::assertStatus($status); - self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true); - } - */ - } - - /** - * Test the api_search() function with an q parameter contains hashtag. - * @doesNotPerformAssertions - */ - public function testApiSearchWithHashtag() - { - /* - $_REQUEST['q'] = '%23friendica'; - $result = api_search('json'); - foreach ($result['status'] as $status) { - self::assertStatus($status); - self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true); - } - */ - } - - /** - * Test the api_search() function with an exclude_replies parameter. - * @doesNotPerformAssertions - */ - public function testApiSearchWithExcludeReplies() - { - /* - $_REQUEST['max_id'] = 10; - $_REQUEST['exclude_replies'] = true; - $_REQUEST['q'] = 'friendica'; - $result = api_search('json'); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_search() function without an authenticated user. - * - * @return void - */ - public function testApiSearchWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_search('json'); - } - - /** - * Test the api_search() function without any GET query parameter. - * - * @return void - */ - public function testApiSearchWithoutQuery() - { - // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); - // api_search('json'); - } - - /** - * Test the api_statuses_home_timeline() function. - * - * @return void - */ - public function testApiStatusesHomeTimeline() - { - /* - $_REQUEST['max_id'] = 10; - $_REQUEST['exclude_replies'] = true; - $_REQUEST['conversation_id'] = 1; - $result = api_statuses_home_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_home_timeline() function with a negative page parameter. - * - * @return void - */ - public function testApiStatusesHomeTimelineWithNegativePage() - { - /* - $_REQUEST['page'] = -2; - $result = api_statuses_home_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_home_timeline() with an unallowed user. - * - * @return void - */ - public function testApiStatusesHomeTimelineWithUnallowedUser() - { - /* - $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - BasicAuth::setCurrentUserID(); - api_statuses_home_timeline('json'); - */ - } - - /** - * Test the api_statuses_home_timeline() function with an RSS result. - * - * @return void - */ - public function testApiStatusesHomeTimelineWithRss() - { - // $result = api_statuses_home_timeline('rss'); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_statuses_public_timeline() function. - * - * @return void - */ - public function testApiStatusesPublicTimeline() - { - /* - $_REQUEST['max_id'] = 10; - $_REQUEST['conversation_id'] = 1; - $result = api_statuses_public_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_public_timeline() function with the exclude_replies parameter. - * - * @return void - */ - public function testApiStatusesPublicTimelineWithExcludeReplies() - { - /* - $_REQUEST['max_id'] = 10; - $_REQUEST['exclude_replies'] = true; - $result = api_statuses_public_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_public_timeline() function with a negative page parameter. - * - * @return void - */ - public function testApiStatusesPublicTimelineWithNegativePage() - { - /* - $_REQUEST['page'] = -2; - $result = api_statuses_public_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_public_timeline() function with an unallowed user. - * - * @return void - */ - public function testApiStatusesPublicTimelineWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_statuses_public_timeline('json'); - } - - /** - * Test the api_statuses_public_timeline() function with an RSS result. - * - * @return void - */ - public function testApiStatusesPublicTimelineWithRss() - { - // $result = api_statuses_public_timeline('rss'); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_statuses_networkpublic_timeline() function. - * - * @return void - */ - public function testApiStatusesNetworkpublicTimeline() - { - /* - $_REQUEST['max_id'] = 10; - $result = api_statuses_networkpublic_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_networkpublic_timeline() function with a negative page parameter. - * - * @return void - */ - public function testApiStatusesNetworkpublicTimelineWithNegativePage() - { - /* - $_REQUEST['page'] = -2; - $result = api_statuses_networkpublic_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_networkpublic_timeline() function with an unallowed user. - * - * @return void - */ - public function testApiStatusesNetworkpublicTimelineWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_statuses_networkpublic_timeline('json'); - } - - /** - * Test the api_statuses_networkpublic_timeline() function with an RSS result. - * - * @return void - */ - public function testApiStatusesNetworkpublicTimelineWithRss() - { - // $result = api_statuses_networkpublic_timeline('rss'); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_statuses_show() function. - * - * @return void - */ - public function testApiStatusesShow() - { - // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); - // api_statuses_show('json'); - } - - /** - * Test the api_statuses_show() function with an ID. - * - * @return void - */ - public function testApiStatusesShowWithId() - { - // DI::args()->setArgv(['', '', '', 1]); - // $result = api_statuses_show('json'); - // self::assertStatus($result['status']); - } - - /** - * Test the api_statuses_show() function with the conversation parameter. - * - * @return void - */ - public function testApiStatusesShowWithConversation() - { - /* - DI::args()->setArgv(['', '', '', 1]); - $_REQUEST['conversation'] = 1; - $result = api_statuses_show('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_show() function with an unallowed user. - * - * @return void - */ - public function testApiStatusesShowWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_statuses_show('json'); - } - - /** - * Test the api_conversation_show() function. - * - * @return void - */ - public function testApiConversationShow() - { - // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); - // api_conversation_show('json'); - } - - /** - * Test the api_conversation_show() function with an ID. - * - * @return void - */ - public function testApiConversationShowWithId() - { - /* - DI::args()->setArgv(['', '', '', 1]); - $_REQUEST['max_id'] = 10; - $_REQUEST['page'] = -2; - $result = api_conversation_show('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_conversation_show() function with an unallowed user. - * - * @return void - */ - public function testApiConversationShowWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_conversation_show('json'); - } - /** * Test the api_statuses_repeat() function. * @@ -1635,156 +1099,6 @@ class ApiTest extends FixtureTest self::assertStatus($result['status']); } - /** - * Test the api_statuses_destroy() function. - * - * @return void - */ - public function testApiStatusesDestroy() - { - // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); - // api_statuses_destroy('json'); - } - - /** - * Test the api_statuses_destroy() function without an authenticated user. - * - * @return void - */ - public function testApiStatusesDestroyWithoutAuthenticatedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // $_SESSION['authenticated'] = false; - // api_statuses_destroy('json'); - } - - /** - * Test the api_statuses_destroy() function with an ID. - * - * @return void - */ - public function testApiStatusesDestroyWithId() - { - // DI::args()->setArgv(['', '', '', 1]); - // $result = api_statuses_destroy('json'); - // self::assertStatus($result['status']); - } - - /** - * Test the api_statuses_mentions() function. - * - * @return void - */ - public function testApiStatusesMentions() - { - /* - $this->app->setLoggedInUserNickname($this->selfUser['nick']); - $_REQUEST['max_id'] = 10; - $result = api_statuses_mentions('json'); - self::assertEmpty($result['status']); - // We should test with mentions in the database. - */ - } - - /** - * Test the api_statuses_mentions() function with a negative page parameter. - * - * @return void - */ - public function testApiStatusesMentionsWithNegativePage() - { - // $_REQUEST['page'] = -2; - // $result = api_statuses_mentions('json'); - // self::assertEmpty($result['status']); - } - - /** - * Test the api_statuses_mentions() function with an unallowed user. - * - * @return void - */ - public function testApiStatusesMentionsWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_statuses_mentions('json'); - } - - /** - * Test the api_statuses_mentions() function with an RSS result. - * - * @return void - */ - public function testApiStatusesMentionsWithRss() - { - // $result = api_statuses_mentions('rss'); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_statuses_user_timeline() function. - * - * @return void - */ - public function testApiStatusesUserTimeline() - { - /* - $_REQUEST['user_id'] = 42; - $_REQUEST['max_id'] = 10; - $_REQUEST['exclude_replies'] = true; - $_REQUEST['conversation_id'] = 7; - - $result = api_statuses_user_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_user_timeline() function with a negative page parameter. - * - * @return void - */ - public function testApiStatusesUserTimelineWithNegativePage() - { - /* - $_REQUEST['user_id'] = 42; - $_REQUEST['page'] = -2; - - $result = api_statuses_user_timeline('json'); - self::assertNotEmpty($result['status']); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_statuses_user_timeline() function with an RSS result. - * - * @return void - */ - public function testApiStatusesUserTimelineWithRss() - { - // $result = api_statuses_user_timeline('rss'); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_statuses_user_timeline() function with an unallowed user. - * - * @return void - */ - public function testApiStatusesUserTimelineWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_statuses_user_timeline('json'); - } - /** * Test the api_favorites_create_destroy() function. * @@ -1875,45 +1189,7 @@ class ApiTest extends FixtureTest api_favorites_create_destroy('json'); } - /** - * Test the api_favorites() function. - * - * @return void - */ - public function testApiFavorites() - { - /* - $_REQUEST['page'] = -1; - $_REQUEST['max_id'] = 10; - $result = api_favorites('json'); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - /** - * Test the api_favorites() function with an RSS result. - * - * @return void - */ - public function testApiFavoritesWithRss() - { - // $result = api_favorites('rss'); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_favorites() function with an unallowed user. - * - * @return void - */ - public function testApiFavoritesWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_favorites('json'); - } /** * Test the api_format_messages() function. @@ -2250,92 +1526,6 @@ class ApiTest extends FixtureTest api_lists_ownerships('json'); } - /** - * Test the api_lists_statuses() function. - * - * @return void - */ - public function testApiListsStatuses() - { - // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); - // api_lists_statuses('json'); - } - - /** - * Test the api_lists_statuses() function with a list ID. - * @doesNotPerformAssertions - */ - public function testApiListsStatusesWithListId() - { - /* - $_REQUEST['list_id'] = 1; - $_REQUEST['page'] = -1; - $_REQUEST['max_id'] = 10; - $result = api_lists_statuses('json'); - foreach ($result['status'] as $status) { - self::assertStatus($status); - } - */ - } - - /** - * Test the api_lists_statuses() function with a list ID and a RSS result. - * - * @return void - */ - public function testApiListsStatusesWithListIdAndRss() - { - // $_REQUEST['list_id'] = 1; - // $result = api_lists_statuses('rss'); - // self::assertXml($result, 'statuses'); - } - - /** - * Test the api_lists_statuses() function with an unallowed user. - * - * @return void - */ - public function testApiListsStatusesWithUnallowedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); - // BasicAuth::setCurrentUserID(); - // api_lists_statuses('json'); - } - - /** - * Test the api_statuses_f() function. - * - * @return void - */ - public function testApiStatusesFWithFriends() - { - // $_GET['page'] = -1; - // $result = api_statuses_f('friends'); - // self::assertArrayHasKey('user', $result); - } - - /** - * Test the api_statuses_f() function. - * - * @return void - */ - public function testApiStatusesFWithFollowers() - { - // $result = api_statuses_f('followers'); - // self::assertArrayHasKey('user', $result); - } - - /** - * Test the api_statuses_f() function. - * - * @return void - */ - public function testApiStatusesFWithBlocks() - { - // $result = api_statuses_f('blocks'); - // self::assertArrayHasKey('user', $result); - } - /** * Test the api_statuses_f() function. * @@ -2347,126 +1537,6 @@ class ApiTest extends FixtureTest // self::assertArrayHasKey('user', $result); } - /** - * Test the api_statuses_f() function an undefined cursor GET variable. - * - * @return void - */ - public function testApiStatusesFWithUndefinedCursor() - { - // $_GET['cursor'] = 'undefined'; - // self::assertFalse(api_statuses_f('friends')); - } - - /** - * Test the api_statuses_friends() function. - * - * @return void - */ - public function testApiStatusesFriends() - { - // $result = api_statuses_friends('json'); - // self::assertArrayHasKey('user', $result); - } - - /** - * Test the api_statuses_friends() function an undefined cursor GET variable. - * - * @return void - */ - public function testApiStatusesFriendsWithUndefinedCursor() - { - // $_GET['cursor'] = 'undefined'; - // self::assertFalse(api_statuses_friends('json')); - } - - /** - * Test the api_statuses_followers() function. - * - * @return void - */ - public function testApiStatusesFollowers() - { - // $result = api_statuses_followers('json'); - // self::assertArrayHasKey('user', $result); - } - - /** - * Test the api_statuses_followers() function an undefined cursor GET variable. - * - * @return void - */ - public function testApiStatusesFollowersWithUndefinedCursor() - { - // $_GET['cursor'] = 'undefined'; - // self::assertFalse(api_statuses_followers('json')); - } - - /** - * Test the api_blocks_list() function. - * - * @return void - */ - public function testApiBlocksList() - { - // $result = api_blocks_list('json'); - // self::assertArrayHasKey('user', $result); - } - - /** - * Test the api_blocks_list() function an undefined cursor GET variable. - * - * @return void - */ - public function testApiBlocksListWithUndefinedCursor() - { - // $_GET['cursor'] = 'undefined'; - // self::assertFalse(api_blocks_list('json')); - } - - /** - * Test the api_friendships_incoming() function. - * - * @return void - */ - public function testApiFriendshipsIncoming() - { - // $result = api_friendships_incoming('json'); - // self::assertArrayHasKey('id', $result); - } - - /** - * Test the api_friendships_incoming() function an undefined cursor GET variable. - * - * @return void - */ - public function testApiFriendshipsIncomingWithUndefinedCursor() - { - // $_GET['cursor'] = 'undefined'; - // self::assertFalse(api_friendships_incoming('json')); - } - - /** - * Test the api_statusnet_config() function. - * - * @return void - */ - public function testApiStatusnetConfig() - { - /* - $result = api_statusnet_config('json'); - self::assertEquals('localhost', $result['config']['site']['server']); - self::assertEquals('default', $result['config']['site']['theme']); - self::assertEquals(DI::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']); - self::assertTrue($result['config']['site']['fancy']); - self::assertEquals('en', $result['config']['site']['language']); - self::assertEquals('UTC', $result['config']['site']['timezone']); - self::assertEquals(200000, $result['config']['site']['textlimit']); - self::assertEquals('false', $result['config']['site']['private']); - self::assertEquals('false', $result['config']['site']['ssl']); - self::assertEquals(30, $result['config']['site']['shorturllength']); - */ - } /** * Test the api_direct_messages_new() function. @@ -2952,27 +2022,6 @@ class ApiTest extends FixtureTest $this->markTestIncomplete(); } - - /** - * Test the api_account_update_profile() function. - * - * @return void - */ - public function testApiAccountUpdateProfile() - { - /* - $_POST['name'] = 'new_name'; - $_POST['description'] = 'new_description'; - $result = api_account_update_profile('json'); - // We can't use assertSelfUser() here because the user object is missing some properties. - self::assertEquals($this->selfUser['id'], $result['user']['cid']); - self::assertEquals('DFRN', $result['user']['location']); - self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']); - self::assertEquals('new_name', $result['user']['name']); - self::assertEquals('new_description', $result['user']['description']); - */ - } - /** * Test the check_acl_input() function. * diff --git a/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php b/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php new file mode 100644 index 0000000000..287b47b40c --- /dev/null +++ b/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php @@ -0,0 +1,30 @@ +expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // $_SESSION['authenticated'] = false; + // api_account_verify_credentials('json'); + } +} diff --git a/tests/src/Module/Api/Mastodon/ConversationsTest.php b/tests/src/Module/Api/Mastodon/ConversationsTest.php new file mode 100644 index 0000000000..838c591c2f --- /dev/null +++ b/tests/src/Module/Api/Mastodon/ConversationsTest.php @@ -0,0 +1,50 @@ +expectException(\Friendica\Network\HTTPException\BadRequestException::class); + // api_conversation_show('json'); + } + + /** + * Test the api_conversation_show() function with an ID. + * + * @return void + */ + public function testApiConversationShowWithId() + { + /* + DI::args()->setArgv(['', '', '', 1]); + $_REQUEST['max_id'] = 10; + $_REQUEST['page'] = -2; + $result = api_conversation_show('json'); + self::assertNotEmpty($result['status']); + foreach ($result['status'] as $status) { + self::assertStatus($status); + } + */ + } + + /** + * Test the api_conversation_show() function with an unallowed user. + * + * @return void + */ + public function testApiConversationShowWithUnallowedUser() + { + // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_conversation_show('json'); + } +} diff --git a/tests/src/Module/Api/Mastodon/SearchTest.php b/tests/src/Module/Api/Mastodon/SearchTest.php new file mode 100644 index 0000000000..417cb4d4b8 --- /dev/null +++ b/tests/src/Module/Api/Mastodon/SearchTest.php @@ -0,0 +1,118 @@ +expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_search('json'); + } + + /** + * Test the api_search() function without any GET query parameter. + * + * @return void + */ + public function testApiSearchWithoutQuery() + { + // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); + // api_search('json'); + } +} diff --git a/tests/src/Module/Api/Mastodon/Timelines/HomeTest.php b/tests/src/Module/Api/Mastodon/Timelines/HomeTest.php new file mode 100644 index 0000000000..74b32ba798 --- /dev/null +++ b/tests/src/Module/Api/Mastodon/Timelines/HomeTest.php @@ -0,0 +1,69 @@ +expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + BasicAuth::setCurrentUserID(); + api_statuses_home_timeline('json'); + */ + } + + /** + * Test the api_statuses_home_timeline() function with an RSS result. + * + * @return void + */ + public function testApiStatusesHomeTimelineWithRss() + { + // $result = api_statuses_home_timeline('rss'); + // self::assertXml($result, 'statuses'); + } +} diff --git a/tests/src/Module/Api/Mastodon/Timelines/PublicTimelineTest.php b/tests/src/Module/Api/Mastodon/Timelines/PublicTimelineTest.php new file mode 100644 index 0000000000..c475dc2d6a --- /dev/null +++ b/tests/src/Module/Api/Mastodon/Timelines/PublicTimelineTest.php @@ -0,0 +1,84 @@ +expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_statuses_public_timeline('json'); + } + + /** + * Test the api_statuses_public_timeline() function with an RSS result. + * + * @return void + */ + public function testApiStatusesPublicTimelineWithRss() + { + // $result = api_statuses_public_timeline('rss'); + // self::assertXml($result, 'statuses'); + } +} diff --git a/tests/src/Module/Api/Twitter/Account/UpdateTest.php b/tests/src/Module/Api/Twitter/Account/UpdateTest.php new file mode 100644 index 0000000000..0be8700424 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Account/UpdateTest.php @@ -0,0 +1,28 @@ +selfUser['id'], $result['user']['cid']); + self::assertEquals('DFRN', $result['user']['location']); + self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']); + self::assertEquals('new_name', $result['user']['name']); + self::assertEquals('new_description', $result['user']['description']); + */ + } +} diff --git a/tests/src/Module/Api/Twitter/Blocks/ListsTest.php b/tests/src/Module/Api/Twitter/Blocks/ListsTest.php new file mode 100644 index 0000000000..9783a51e47 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Blocks/ListsTest.php @@ -0,0 +1,41 @@ +expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_favorites('json'); + } +} diff --git a/tests/src/Module/Api/Twitter/Followers/ListsTest.php b/tests/src/Module/Api/Twitter/Followers/ListsTest.php new file mode 100644 index 0000000000..2008227951 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Followers/ListsTest.php @@ -0,0 +1,41 @@ +expectException(\Friendica\Network\HTTPException\BadRequestException::class); + // api_lists_statuses('json'); + } + + /** + * Test the api_lists_statuses() function with a list ID. + * @doesNotPerformAssertions + */ + public function testApiListsStatusesWithListId() + { + /* + $_REQUEST['list_id'] = 1; + $_REQUEST['page'] = -1; + $_REQUEST['max_id'] = 10; + $result = api_lists_statuses('json'); + foreach ($result['status'] as $status) { + self::assertStatus($status); + } + */ + } + + /** + * Test the api_lists_statuses() function with a list ID and a RSS result. + * + * @return void + */ + public function testApiListsStatusesWithListIdAndRss() + { + // $_REQUEST['list_id'] = 1; + // $result = api_lists_statuses('rss'); + // self::assertXml($result, 'statuses'); + } + + /** + * Test the api_lists_statuses() function with an unallowed user. + * + * @return void + */ + public function testApiListsStatusesWithUnallowedUser() + { + // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_lists_statuses('json'); + } +} diff --git a/tests/src/Module/Api/Twitter/Statuses/DestroyTest.php b/tests/src/Module/Api/Twitter/Statuses/DestroyTest.php new file mode 100644 index 0000000000..73f32c5d6b --- /dev/null +++ b/tests/src/Module/Api/Twitter/Statuses/DestroyTest.php @@ -0,0 +1,44 @@ +expectException(\Friendica\Network\HTTPException\BadRequestException::class); + // api_statuses_destroy('json'); + } + + /** + * Test the api_statuses_destroy() function without an authenticated user. + * + * @return void + */ + public function testApiStatusesDestroyWithoutAuthenticatedUser() + { + // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // $_SESSION['authenticated'] = false; + // api_statuses_destroy('json'); + } + + /** + * Test the api_statuses_destroy() function with an ID. + * + * @return void + */ + public function testApiStatusesDestroyWithId() + { + // DI::args()->setArgv(['', '', '', 1]); + // $result = api_statuses_destroy('json'); + // self::assertStatus($result['status']); + } +} diff --git a/tests/src/Module/Api/Twitter/Statuses/MentionsTest.php b/tests/src/Module/Api/Twitter/Statuses/MentionsTest.php new file mode 100644 index 0000000000..fb9a6b0b29 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Statuses/MentionsTest.php @@ -0,0 +1,59 @@ +app->setLoggedInUserNickname($this->selfUser['nick']); + $_REQUEST['max_id'] = 10; + $result = api_statuses_mentions('json'); + self::assertEmpty($result['status']); + // We should test with mentions in the database. + */ + } + + /** + * Test the api_statuses_mentions() function with a negative page parameter. + * + * @return void + */ + public function testApiStatusesMentionsWithNegativePage() + { + // $_REQUEST['page'] = -2; + // $result = api_statuses_mentions('json'); + // self::assertEmpty($result['status']); + } + + /** + * Test the api_statuses_mentions() function with an unallowed user. + * + * @return void + */ + public function testApiStatusesMentionsWithUnallowedUser() + { + // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_statuses_mentions('json'); + } + + /** + * Test the api_statuses_mentions() function with an RSS result. + * + * @return void + */ + public function testApiStatusesMentionsWithRss() + { + // $result = api_statuses_mentions('rss'); + // self::assertXml($result, 'statuses'); + } +} diff --git a/tests/src/Module/Api/Twitter/Statuses/NetworkPublicTimelineTest.php b/tests/src/Module/Api/Twitter/Statuses/NetworkPublicTimelineTest.php new file mode 100644 index 0000000000..e340753f42 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Statuses/NetworkPublicTimelineTest.php @@ -0,0 +1,65 @@ +expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_statuses_networkpublic_timeline('json'); + } + + /** + * Test the api_statuses_networkpublic_timeline() function with an RSS result. + * + * @return void + */ + public function testApiStatusesNetworkpublicTimelineWithRss() + { + // $result = api_statuses_networkpublic_timeline('rss'); + // self::assertXml($result, 'statuses'); + } +} diff --git a/tests/src/Module/Api/Twitter/Statuses/ShowTest.php b/tests/src/Module/Api/Twitter/Statuses/ShowTest.php new file mode 100644 index 0000000000..00fcbd5541 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Statuses/ShowTest.php @@ -0,0 +1,61 @@ +expectException(\Friendica\Network\HTTPException\BadRequestException::class); + // api_statuses_show('json'); + } + + /** + * Test the api_statuses_show() function with an ID. + * + * @return void + */ + public function testApiStatusesShowWithId() + { + // DI::args()->setArgv(['', '', '', 1]); + // $result = api_statuses_show('json'); + // self::assertStatus($result['status']); + } + + /** + * Test the api_statuses_show() function with the conversation parameter. + * + * @return void + */ + public function testApiStatusesShowWithConversation() + { + /* + DI::args()->setArgv(['', '', '', 1]); + $_REQUEST['conversation'] = 1; + $result = api_statuses_show('json'); + self::assertNotEmpty($result['status']); + foreach ($result['status'] as $status) { + self::assertStatus($status); + } + */ + } + + /** + * Test the api_statuses_show() function with an unallowed user. + * + * @return void + */ + public function testApiStatusesShowWithUnallowedUser() + { + // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_statuses_show('json'); + } +} diff --git a/tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php b/tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php new file mode 100644 index 0000000000..1e4f9cbb7e --- /dev/null +++ b/tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php @@ -0,0 +1,71 @@ +expectException(\Friendica\Network\HTTPException\UnauthorizedException::class); + // BasicAuth::setCurrentUserID(); + // api_statuses_user_timeline('json'); + } +} diff --git a/tests/src/Module/Api/Twitter/Users/LookupTest.php b/tests/src/Module/Api/Twitter/Users/LookupTest.php new file mode 100644 index 0000000000..ddcedbc763 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Users/LookupTest.php @@ -0,0 +1,31 @@ +expectException(\Friendica\Network\HTTPException\NotFoundException::class); + // api_users_lookup('json'); + } + + /** + * Test the api_users_lookup() function with an user ID. + * + * @return void + */ + public function testApiUsersLookupWithUserId() + { + // $_REQUEST['user_id'] = $this->otherUser['id']; + // $result = api_users_lookup('json'); + // self::assertOtherUser($result['users'][0]); + } +} diff --git a/tests/src/Module/Api/Twitter/Users/SearchTest.php b/tests/src/Module/Api/Twitter/Users/SearchTest.php new file mode 100644 index 0000000000..ce088a5412 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Users/SearchTest.php @@ -0,0 +1,43 @@ +expectException(\Friendica\Network\HTTPException\BadRequestException::class); + // api_users_search('json'); + } +} diff --git a/tests/src/Module/Api/Twitter/Users/ShowTest.php b/tests/src/Module/Api/Twitter/Users/ShowTest.php new file mode 100644 index 0000000000..e34f5c28a3 --- /dev/null +++ b/tests/src/Module/Api/Twitter/Users/ShowTest.php @@ -0,0 +1,37 @@ +selfUser['id'], $result['user']['cid']); + self::assertEquals('DFRN', $result['user']['location']); + self::assertEquals($this->selfUser['name'], $result['user']['name']); + self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']); + self::assertTrue($result['user']['verified']); + */ + } + + /** + * Test the api_users_show() function with an XML result. + * + * @return void + */ + public function testApiUsersShowWithXml() + { + // $result = api_users_show('xml'); + // self::assertXml($result, 'statuses'); + } +}