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

This commit is contained in:
Philipp 2021-12-04 23:29:29 +01:00
parent 7ca47e8d21
commit 6d8b8d95b1
No known key found for this signature in database
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();
System::jsonExit($return);
$this->response->exit('lists', ['lists' => $return]);
}
}

View File

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

View File

@ -2,6 +2,9 @@
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;
class ListsTest extends ApiTest
@ -13,7 +16,17 @@ class ListsTest extends ApiTest
*/
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');
// self::assertArrayHasKey('user', $result);
}
@ -25,29 +38,9 @@ class ListsTest extends ApiTest
*/
public function testApiStatusesFWithUndefinedCursor()
{
self::markTestIncomplete('Needs refactoring of Lists - replace filter_input() with $request parameter checks');
// $_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'));
}
}