]> git.mxchange.org Git - friendica.git/blob - tests/src/Module/Api/Twitter/Lists/StatusesTest.php
Reenable Twitter/Search test
[friendica.git] / tests / src / Module / Api / Twitter / Lists / StatusesTest.php
1 <?php
2
3 namespace Friendica\Test\src\Module\Api\Twitter\Lists;
4
5 use Friendica\App\Router;
6 use Friendica\DI;
7 use Friendica\Module\Api\Twitter\Lists\Statuses;
8 use Friendica\Network\HTTPException\BadRequestException;
9 use Friendica\Test\src\Module\Api\ApiTest;
10
11 class StatusesTest extends ApiTest
12 {
13         /**
14          * Test the api_lists_statuses() function.
15          *
16          * @return void
17          */
18         public function testApiListsStatuses()
19         {
20                 $this->expectException(BadRequestException::class);
21
22                 $lists = new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
23                 $lists->run();
24         }
25
26         /**
27          * Test the api_lists_statuses() function with a list ID.
28          */
29         public function testApiListsStatusesWithListId()
30         {
31                 $lists    = new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
32                 $response = $lists->run(['list_id' => 1, 'page' => -1, 'max_id' => 10]);
33
34                 $json = $this->toJson($response);
35
36                 foreach ($json as $status) {
37                         self::assertIsString($status->text);
38                         self::assertIsInt($status->id);
39                 }
40         }
41
42         /**
43          * Test the api_lists_statuses() function with a list ID and a RSS result.
44          */
45         public function testApiListsStatusesWithListIdAndRss()
46         {
47                 $lists    = new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'rss']);
48                 $response = $lists->run(['list_id' => 1]);
49
50                 self::assertXml((string)$response->getBody());
51         }
52
53         /**
54          * Test the api_lists_statuses() function with an unallowed user.
55          *
56          * @return void
57          */
58         public function testApiListsStatusesWithUnallowedUser()
59         {
60                 self::markTestIncomplete('Needs BasicAuth as dynamic method for overriding first');
61
62                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
63                 // BasicAuth::setCurrentUserID();
64                 // api_lists_statuses('json');
65         }
66 }