3 namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
5 use Friendica\App\Router;
7 use Friendica\Module\Api\Twitter\Statuses\Show;
8 use Friendica\Network\HTTPException\BadRequestException;
9 use Friendica\Test\src\Module\Api\ApiTest;
11 class ShowTest extends ApiTest
14 * Test the api_statuses_show() function.
18 public function testApiStatusesShow()
20 $this->expectException(BadRequestException::class);
22 $show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
27 * Test the api_statuses_show() function with an ID.
31 public function testApiStatusesShowWithId()
33 $show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
34 $response = $show->run(['id' => 1]);
36 $json = $this->toJson($response);
38 self::assertIsInt($json->id);
39 self::assertIsString($json->text);
43 * Test the api_statuses_show() function with the conversation parameter.
47 public function testApiStatusesShowWithConversation()
49 $show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
50 $response = $show->run(['id' => 1, 'conversation' => 1]);
52 $json = $this->toJson($response);
54 self::assertIsArray($json);
56 foreach ($json as $status) {
57 self::assertIsInt($status->id);
58 self::assertIsString($status->text);
63 * Test the api_statuses_show() function with an unallowed user.
67 public function testApiStatusesShowWithUnallowedUser()
69 self::markTestIncomplete('Needs BasicAuth as dynamic method for overriding first');
71 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
72 // BasicAuth::setCurrentUserID();
73 // api_statuses_show('json');