]> git.mxchange.org Git - friendica.git/blob - tests/src/Module/Api/Twitter/Statuses/DestroyTest.php
Reenable Twitter/Destroy tests
[friendica.git] / tests / src / Module / Api / Twitter / Statuses / DestroyTest.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\Destroy;
8 use Friendica\Network\HTTPException\BadRequestException;
9 use Friendica\Test\src\Module\Api\ApiTest;
10
11 class DestroyTest extends ApiTest
12 {
13         /**
14          * Test the api_statuses_destroy() function.
15          *
16          * @return void
17          */
18         public function testApiStatusesDestroy()
19         {
20                 $this->expectException(BadRequestException::class);
21
22                 $destroy = new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
23                 $destroy->run();
24         }
25
26         /**
27          * Test the api_statuses_destroy() function without an authenticated user.
28          *
29          * @return void
30          */
31         public function testApiStatusesDestroyWithoutAuthenticatedUser()
32         {
33                 self::markTestIncomplete('Needs BasicAuth as dynamic method for overriding first');
34
35                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
36                 // BasicAuth::setCurrentUserID();
37                 // $_SESSION['authenticated'] = false;
38                 // api_statuses_destroy('json');
39         }
40
41         /**
42          * Test the api_statuses_destroy() function with an ID.
43          *
44          * @return void
45          */
46         public function testApiStatusesDestroyWithId()
47         {
48                 $destroy = new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
49                 $response = $destroy->run(['id' => 1]);
50
51                 $json = $this->toJson($response);
52
53                 self::assertEquals(1, $json->id);
54                 self::assertIsObject($json->user);
55                 self::assertIsObject($json->friendica_author);
56         }
57 }