]> git.mxchange.org Git - friendica.git/blob - tests/src/Module/Api/Twitter/Statuses/ShowTest.php
Reenable Twitter/Statuses tests
[friendica.git] / tests / src / Module / Api / Twitter / Statuses / ShowTest.php
1 <?php
2
3 namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
4
5 use Friendica\App\Router;
6 use Friendica\DI;
7 use Friendica\Module\Api\Twitter\Statuses\Show;
8 use Friendica\Network\HTTPException\BadRequestException;
9 use Friendica\Test\src\Module\Api\ApiTest;
10
11 class ShowTest extends ApiTest
12 {
13         /**
14          * Test the api_statuses_show() function.
15          *
16          * @return void
17          */
18         public function testApiStatusesShow()
19         {
20                 $this->expectException(BadRequestException::class);
21
22                 $show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
23                 $show->run();
24         }
25
26         /**
27          * Test the api_statuses_show() function with an ID.
28          *
29          * @return void
30          */
31         public function testApiStatusesShowWithId()
32         {
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]);
35
36                 $json = $this->toJson($response);
37
38                 self::assertIsInt($json->id);
39                 self::assertIsString($json->text);
40         }
41
42         /**
43          * Test the api_statuses_show() function with the conversation parameter.
44          *
45          * @return void
46          */
47         public function testApiStatusesShowWithConversation()
48         {
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]);
51
52                 $json = $this->toJson($response);
53
54                 self::assertIsArray($json);
55
56                 foreach ($json as $status) {
57                         self::assertIsInt($status->id);
58                         self::assertIsString($status->text);
59                 }
60         }
61
62         /**
63          * Test the api_statuses_show() function with an unallowed user.
64          *
65          * @return void
66          */
67         public function testApiStatusesShowWithUnallowedUser()
68         {
69                 self::markTestIncomplete('Needs BasicAuth as dynamic method for overriding first');
70
71                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
72                 // BasicAuth::setCurrentUserID();
73                 // api_statuses_show('json');
74         }
75 }