1
1
Fork 0

Reenable Followers&Friends Lists and fixes a array_reverse() Bug

This commit is contained in:
Philipp Holzer 2021-12-04 23:29:29 +01:00
parent 7ca47e8d21
commit 6d8b8d95b1
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
4 changed files with 32 additions and 39 deletions

View file

@ -92,6 +92,6 @@ class Lists extends ContactEndpoint
self::setLinkHeader(); self::setLinkHeader();
System::jsonExit($return); $this->response->exit('lists', ['lists' => $return]);
} }
} }

View file

@ -92,6 +92,6 @@ class Lists extends ContactEndpoint
self::setLinkHeader(); self::setLinkHeader();
System::jsonExit($return); $this->response->exit('lists', ['lists' => $return]);
} }
} }

View file

@ -2,30 +2,28 @@
namespace Friendica\Test\src\Module\Api\Twitter\Followers; namespace Friendica\Test\src\Module\Api\Twitter\Followers;
use Friendica\App\Router;
use Friendica\DI;
use Friendica\Module\Api\Twitter\Followers\Lists;
use Friendica\Test\src\Module\Api\ApiTest; use Friendica\Test\src\Module\Api\ApiTest;
class ListsTest extends ApiTest class ListsTest extends ApiTest
{ {
/** /**
* Test the api_statuses_f() function. * Test the api_statuses_f() function.
*
* @return void
*/ */
public function testApiStatusesFWithFollowers() public function testApiStatusesFWithFollowers()
{ {
// $result = api_statuses_f('followers'); $lists = new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
// self::assertArrayHasKey('user', $result); $response = $lists->run();
}
/** $body = (string)$response->getBody();
* Test the api_statuses_followers() function.
* self::assertJson($body);
* @return void
*/ $json = json_decode($body);
public function testApiStatusesFollowers()
{ self::assertIsArray($json->users);
// $result = api_statuses_followers('json');
// self::assertArrayHasKey('user', $result);
} }
/** /**
@ -35,6 +33,8 @@ class ListsTest extends ApiTest
*/ */
public function testApiStatusesFollowersWithUndefinedCursor() public function testApiStatusesFollowersWithUndefinedCursor()
{ {
self::markTestIncomplete('Needs refactoring of Lists - replace filter_input() with $request parameter checks');
// $_GET['cursor'] = 'undefined'; // $_GET['cursor'] = 'undefined';
// self::assertFalse(api_statuses_followers('json')); // self::assertFalse(api_statuses_followers('json'));
} }

View file

@ -2,6 +2,9 @@
namespace Friendica\Test\src\Module\Api\Twitter\Friends; namespace Friendica\Test\src\Module\Api\Twitter\Friends;
use Friendica\App\Router;
use Friendica\DI;
use Friendica\Module\Api\Twitter\Friends\Lists;
use Friendica\Test\src\Module\Api\ApiTest; use Friendica\Test\src\Module\Api\ApiTest;
class ListsTest extends ApiTest class ListsTest extends ApiTest
@ -13,7 +16,17 @@ class ListsTest extends ApiTest
*/ */
public function testApiStatusesFWithFriends() public function testApiStatusesFWithFriends()
{ {
// $_GET['page'] = -1; $lists = new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
$response = $lists->run();
$body = (string)$response->getBody();
self::assertJson($body);
$json = json_decode($body);
self::assertIsArray($json->users);
// $result = api_statuses_f('friends'); // $result = api_statuses_f('friends');
// self::assertArrayHasKey('user', $result); // self::assertArrayHasKey('user', $result);
} }
@ -25,29 +38,9 @@ class ListsTest extends ApiTest
*/ */
public function testApiStatusesFWithUndefinedCursor() public function testApiStatusesFWithUndefinedCursor()
{ {
self::markTestIncomplete('Needs refactoring of Lists - replace filter_input() with $request parameter checks');
// $_GET['cursor'] = 'undefined'; // $_GET['cursor'] = 'undefined';
// self::assertFalse(api_statuses_f('friends')); // 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'));
}
} }