3 namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
5 use Friendica\App\Router;
6 use Friendica\Capabilities\ICanCreateResponses;
8 use Friendica\Module\Api\Twitter\Statuses\Mentions;
9 use Friendica\Test\src\Module\Api\ApiTest;
11 class MentionsTest extends ApiTest
14 * Test the api_statuses_mentions() function.
18 public function testApiStatusesMentions()
20 $mentions = new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
21 $response = $mentions->run(['max_id' => 10]);
23 $json = $this->toJson($response);
25 self::assertEmpty($json);
26 // We should test with mentions in the database.
30 * Test the api_statuses_mentions() function with a negative page parameter.
34 public function testApiStatusesMentionsWithNegativePage()
36 $mentions = new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
37 $response = $mentions->run(['page' => -2]);
39 $json = $this->toJson($response);
41 self::assertEmpty($json);
42 // We should test with mentions in the database.
46 * Test the api_statuses_mentions() function with an unallowed user.
50 public function testApiStatusesMentionsWithUnallowedUser()
52 self::markTestIncomplete('Needs BasicAuth as dynamic method for overriding first');
54 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
55 // BasicAuth::setCurrentUserID();
56 // api_statuses_mentions('json');
60 * Test the api_statuses_mentions() function with an RSS result.
64 public function testApiStatusesMentionsWithRss()
66 $mentions = new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_RSS]);
67 $response = $mentions->run(['page' => -2]);
69 self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
71 self::assertXml((string)$response->getBody(), 'statuses');