Reenable Twitter/Show test

This commit is contained in:
Philipp 2021-12-09 21:43:35 +01:00
parent e10045f13f
commit 2b57266c88
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
2 changed files with 21 additions and 11 deletions

View file

@ -38,7 +38,7 @@ class Show extends BaseApi
$uid = BaseApi::getCurrentUserID();
if (empty($this->parameters['id'])) {
$cid = BaseApi::getContactIDForSearchterm($_REQUEST['screen_name'] ?? '', $_REQUEST['profileurl'] ?? '', $_REQUEST['user_id'] ?? 0, $uid);
$cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
} else {
$cid = (int)$this->parameters['id'];
}

View file

@ -2,6 +2,10 @@
namespace Friendica\Test\src\Module\Api\Twitter\Users;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI;
use Friendica\Module\Api\Twitter\Users\Show;
use Friendica\Test\src\Module\Api\ApiTest;
class ShowTest extends ApiTest
@ -13,15 +17,17 @@ class ShowTest extends ApiTest
*/
public function testApiUsersShow()
{
/*
$result = api_users_show('json');
$show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
$response = $show->run();
$json = $this->toJson($response);
// 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']);
*/
self::assertEquals(static::SELF_USER['id'], $json->cid);
self::assertEquals('DFRN', $json->location);
self::assertEquals(static::SELF_USER['name'], $json->name);
self::assertEquals(static::SELF_USER['nick'], $json->screen_name);
self::assertTrue($json->verified);
}
/**
@ -31,7 +37,11 @@ class ShowTest extends ApiTest
*/
public function testApiUsersShowWithXml()
{
// $result = api_users_show('xml');
// self::assertXml($result, 'statuses');
$show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_XML]);
$response = $show->run();
self::assertEquals(ICanCreateResponses::TYPE_XML, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
self::assertXml((string)$response->getBody(), 'statuses');
}
}