3 namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
5 use Friendica\App\Router;
7 use Friendica\Module\Api\Twitter\Statuses\Destroy;
8 use Friendica\Network\HTTPException\BadRequestException;
9 use Friendica\Test\src\Module\Api\ApiTest;
11 class DestroyTest extends ApiTest
14 * Test the api_statuses_destroy() function.
18 public function testApiStatusesDestroy()
20 $this->expectException(BadRequestException::class);
22 $destroy = new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
27 * Test the api_statuses_destroy() function without an authenticated user.
31 public function testApiStatusesDestroyWithoutAuthenticatedUser()
33 self::markTestIncomplete('Needs BasicAuth as dynamic method for overriding first');
35 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
36 // BasicAuth::setCurrentUserID();
37 // $_SESSION['authenticated'] = false;
38 // api_statuses_destroy('json');
42 * Test the api_statuses_destroy() function with an ID.
46 public function testApiStatusesDestroyWithId()
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]);
51 $json = $this->toJson($response);
53 self::assertEquals(1, $json->id);
54 self::assertIsObject($json->user);
55 self::assertIsObject($json->friendica_author);