Reenable Incoming test and fixes an array_reverse() bug

This commit is contained in:
Philipp 2021-12-04 23:32:03 +01:00
parent 6d8b8d95b1
commit 85b9f2b02c
No known key found for this signature in database
GPG Key ID: 24A7501396EB5432
3 changed files with 16 additions and 6 deletions

View File

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

View File

@ -26,9 +26,6 @@ class ListsTest extends ApiTest
$json = json_decode($body); $json = json_decode($body);
self::assertIsArray($json->users); self::assertIsArray($json->users);
// $result = api_statuses_f('friends');
// self::assertArrayHasKey('user', $result);
} }
/** /**

View File

@ -2,6 +2,9 @@
namespace Friendica\Test\src\Module\Api\Twitter\Friendships; namespace Friendica\Test\src\Module\Api\Twitter\Friendships;
use Friendica\App\Router;
use Friendica\DI;
use Friendica\Module\Api\Twitter\Friendships\Incoming;
use Friendica\Test\src\Module\Api\ApiTest; use Friendica\Test\src\Module\Api\ApiTest;
class IncomingTest extends ApiTest class IncomingTest extends ApiTest
@ -13,8 +16,16 @@ class IncomingTest extends ApiTest
*/ */
public function testApiFriendshipsIncoming() public function testApiFriendshipsIncoming()
{ {
// $result = api_friendships_incoming('json'); $lists = new Incoming(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
// self::assertArrayHasKey('id', $result); $response = $lists->run();
$body = (string)$response->getBody();
self::assertJson($body);
$json = json_decode($body);
self::assertIsArray($json->ids);
} }
/** /**
@ -24,6 +35,8 @@ class IncomingTest extends ApiTest
*/ */
public function testApiFriendshipsIncomingWithUndefinedCursor() public function testApiFriendshipsIncomingWithUndefinedCursor()
{ {
self::markTestIncomplete('Needs refactoring of Incoming - replace filter_input() with $request parameter checks');
// $_GET['cursor'] = 'undefined'; // $_GET['cursor'] = 'undefined';
// self::assertFalse(api_friendships_incoming('json')); // self::assertFalse(api_friendships_incoming('json'));
} }