mirror of
https://github.com/friendica/friendica
synced 2024-11-09 16:22:56 +00:00
Reenable Twitter/Show test
This commit is contained in:
parent
e10045f13f
commit
2b57266c88
2 changed files with 21 additions and 11 deletions
|
@ -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'];
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue