Introduce FixtureTest::useHttpMethod for manually overwrite the HTTP Method argument

This commit is contained in:
Philipp 2022-01-02 22:51:16 +01:00
parent 4e67bfed8d
commit 5e85939502
No known key found for this signature in database
GPG Key ID: 24A7501396EB5432
36 changed files with 175 additions and 82 deletions

View File

@ -6,6 +6,8 @@
namespace Friendica\Test;
use Dice\Dice;
use Friendica\App\Arguments;
use Friendica\App\Router;
use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Session;
@ -50,4 +52,20 @@ abstract class FixtureTest extends DatabaseTest
// Load the API dataset for the whole API
$this->loadFixture(__DIR__ . '/datasets/api.fixture.php', $dba);
}
protected function useHttpMethod(string $method = Router::GET)
{
$server = $_SERVER;
$server['REQUEST_METHOD'] = $method;
$this->dice = $this->dice
->addRule(Arguments::class, [
'instanceOf' => Arguments::class,
'call' => [
['determine', [$server, $_GET], Dice::CHAIN_CALL],
],
]);
DI::init($this->dice);
}
}

View File

@ -21,7 +21,9 @@
namespace Friendica\Test\src\Module\Api;
use Dice\Dice;
use Friendica\App;
use Friendica\App\Arguments;
use Friendica\Capabilities\ICanCreateResponses;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
@ -167,9 +169,18 @@ abstract class ApiTest extends FixtureTest
{
parent::setUp(); // TODO: Change the autogenerated stub
$server = $_SERVER;
$server['REQUEST_METHOD'] = App\Router::GET;
$this->dice = $this->dice
->addRule(Authentication::class, ['instanceOf' => AuthenticationDouble::class, 'shared' => true])
->addRule(App::class, ['instanceOf' => AppDouble::class, 'shared' => true]);
->addRule(App::class, ['instanceOf' => AppDouble::class, 'shared' => true])
->addRule(Arguments::class, [
'instanceOf' => App\Arguments::class,
'call' => [
['determine', [$server, $_GET], Dice::CHAIN_CALL],
],
]);
DI::init($this->dice);
// Manual override to bypass API authentication

View File

@ -34,7 +34,7 @@ class SearchTest extends ApiTest
{
$directMessage = new DirectMessage(new NullLogger(), DI::dba(), DI::twitterUser());
$response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$json = $this->toJson($response);
@ -52,7 +52,7 @@ class SearchTest extends ApiTest
$directMessage = new DirectMessage(new NullLogger(), DI::dba(), DI::twitterUser());
$response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'searchstring' => 'item_body'
]);
@ -73,7 +73,7 @@ class SearchTest extends ApiTest
{
$directMessage = new DirectMessage(new NullLogger(), DI::dba(), DI::twitterUser());
$response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'searchstring' => 'test'
]);

View File

@ -29,10 +29,17 @@ use Friendica\Test\src\Module\Api\ApiTest;
class DeleteTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
public function testEmpty()
{
$this->expectException(BadRequestException::class);
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run();
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run();
}
public function testWithoutAuthenticatedUser()
@ -43,14 +50,14 @@ class DeleteTest extends ApiTest
public function testWrong()
{
$this->expectException(BadRequestException::class);
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run(['photo_id' => 1]);
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['photo_id' => 1]);
}
public function testValidWithPost()
{
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
$response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'photo_id' => '709057080661a283a6aa598501504178'
]);
@ -65,7 +72,7 @@ class DeleteTest extends ApiTest
{
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
$response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'photo_id' => '709057080661a283a6aa598501504178'
]);

View File

@ -29,10 +29,17 @@ use Friendica\Test\src\Module\Api\ApiTest;
class DeleteTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
public function testEmpty()
{
$this->expectException(BadRequestException::class);
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -40,7 +47,7 @@ class DeleteTest extends ApiTest
public function testWrong()
{
$this->expectException(BadRequestException::class);
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'album' => 'album_name'
]);
@ -50,7 +57,7 @@ class DeleteTest extends ApiTest
{
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
$response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'album' => 'test_album']
);

View File

@ -29,17 +29,24 @@ use Friendica\Test\src\Module\Api\ApiTest;
class UpdateTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
public function testEmpty()
{
$this->expectException(BadRequestException::class);
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
public function testTooFewArgs()
{
$this->expectException(BadRequestException::class);
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'album' => 'album_name'
]);
@ -48,7 +55,7 @@ class UpdateTest extends ApiTest
public function testWrongUpdate()
{
$this->expectException(BadRequestException::class);
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'album' => 'album_name',
'album_new' => 'album_name'
@ -64,7 +71,7 @@ class UpdateTest extends ApiTest
{
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'album' => 'test_album',
'album_new' => 'test_album_2'

View File

@ -17,9 +17,8 @@ class ConfigTest extends ApiTest
{
DI::config()->set('system', 'ssl_policy', BaseURL::SSL_POLICY_FULL);
$response = (new Config(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Config(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$json = $this->toJson($response);
self::assertEquals('localhost', $json->site->server);

View File

@ -16,7 +16,7 @@ class VerifyCredentialsTest extends ApiTest
*/
public function testApiAccountVerifyCredentials()
{
$response = (new VerifyCredentials(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new VerifyCredentials(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$json = $this->toJson($response);

View File

@ -12,7 +12,7 @@ class RateLimitStatusTest extends ApiTest
{
public function testWithJson()
{
$response = (new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run();
$result = $this->toJson($response);

View File

@ -14,7 +14,9 @@ class UpdateProfileTest extends ApiTest
*/
public function testApiAccountUpdateProfile()
{
$response = (new UpdateProfile(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST], ['extension' => 'json']))
$this->useHttpMethod(Router::POST);
$response = (new UpdateProfile(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'name' => 'new_name',
'description' => 'new_description'

View File

@ -14,7 +14,7 @@ class ListsTest extends ApiTest
*/
public function testApiStatusesFWithBlocks()
{
$response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$json = $this->toJson($response);

View File

@ -21,7 +21,7 @@ class AllTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new All($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new All($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run();
$json = $this->toJson($response);

View File

@ -19,7 +19,7 @@ class ConversationTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new Conversation($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new Conversation($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'friendica_verbose' => true,
]);

View File

@ -18,7 +18,7 @@ class DestroyTest extends ApiTest
public function testApiDirectMessagesDestroy()
{
$this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
(new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
(new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run();
}
@ -29,7 +29,7 @@ class DestroyTest extends ApiTest
*/
public function testApiDirectMessagesDestroyWithVerbose()
{
$response = (new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'friendica_verbose' => true,
]);
@ -65,7 +65,7 @@ class DestroyTest extends ApiTest
public function testApiDirectMessagesDestroyWithId()
{
$this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
(new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
(new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'id' => 1
]);
@ -78,7 +78,7 @@ class DestroyTest extends ApiTest
*/
public function testApiDirectMessagesDestroyWithIdAndVerbose()
{
$response = (new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'id' => 1,
'friendica_parenturi' => 'parent_uri',
@ -102,7 +102,7 @@ class DestroyTest extends ApiTest
$ids = DBA::selectToArray('mail', ['id']);
$id = $ids[0]['id'];
$response = (new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'id' => $id,
'friendica_verbose' => true,

View File

@ -21,7 +21,7 @@ class InboxTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new Inbox($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new Inbox($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run();
$json = $this->toJson($response);

View File

@ -19,7 +19,7 @@ class NewDMTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run();
self::assertEmpty((string)$response->getBody());
@ -51,7 +51,7 @@ class NewDMTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'text' => 'message_text',
'user_id' => 43
@ -73,7 +73,7 @@ class NewDMTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'text' => 'message_text',
'user_id' => 44
@ -97,7 +97,7 @@ class NewDMTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'text' => 'message_text',
'user_id' => 44,
@ -123,7 +123,7 @@ class NewDMTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'rss']))
$response = (new NewDM($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'rss']))
->run([
'text' => 'message_text',
'user_id' => 44,

View File

@ -19,7 +19,7 @@ class SentTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new Sent($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
$response = (new Sent($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run([
'friendica_verbose' => true,
]);
@ -39,7 +39,7 @@ class SentTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
$response = (new Sent($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'rss']))
$response = (new Sent($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'rss']))
->run();
self::assertXml((string)$response->getBody(), 'direct-messages');

View File

@ -11,6 +11,13 @@ use Friendica\Test\src\Module\Api\ApiTest;
class CreateTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
/**
* Test the api_favorites_create_destroy() function with an invalid ID.
*
@ -20,7 +27,7 @@ class CreateTest extends ApiTest
{
$this->expectException(BadRequestException::class);
(new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -31,7 +38,7 @@ class CreateTest extends ApiTest
*/
public function testApiFavoritesCreateDestroyWithCreateAction()
{
$response = (new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'id' => 3
]);
@ -48,7 +55,7 @@ class CreateTest extends ApiTest
*/
public function testApiFavoritesCreateDestroyWithCreateActionAndRss()
{
$response = (new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST], ['extension' => ICanCreateResponses::TYPE_RSS]))
$response = (new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => ICanCreateResponses::TYPE_RSS]))
->run([
'id' => 3
]);

View File

@ -10,6 +10,13 @@ use Friendica\Test\src\Module\Api\ApiTest;
class DestroyTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
/**
* Test the api_favorites_create_destroy() function with an invalid ID.
*
@ -19,7 +26,7 @@ class DestroyTest extends ApiTest
{
$this->expectException(BadRequestException::class);
(new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -30,7 +37,7 @@ class DestroyTest extends ApiTest
*/
public function testApiFavoritesCreateDestroyWithDestroyAction()
{
$response = (new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'id' => 3
]);

View File

@ -17,7 +17,7 @@ class FavoritesTest extends ApiTest
*/
public function testApiFavorites()
{
$response = (new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'page' => -1,
'max_id' => 10,
@ -37,7 +37,7 @@ class FavoritesTest extends ApiTest
*/
public function testApiFavoritesWithRss()
{
$response = (new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
$response = (new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
'extension' => ICanCreateResponses::TYPE_RSS
]))->run();

View File

@ -14,7 +14,7 @@ class ListsTest extends ApiTest
*/
public function testApiStatusesFWithFollowers()
{
$response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$json = $this->toJson($response);

View File

@ -16,7 +16,7 @@ class ListsTest extends ApiTest
*/
public function testApiStatusesFWithFriends()
{
$response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$json = $this->toJson($response);

View File

@ -16,7 +16,7 @@ class IncomingTest extends ApiTest
*/
public function testApiFriendshipsIncoming()
{
$response = (new Incoming(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Incoming(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$json = $this->toJson($response);

View File

@ -19,7 +19,7 @@ class StatusesTest extends ApiTest
{
$this->expectException(BadRequestException::class);
(new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
(new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -28,7 +28,7 @@ class StatusesTest extends ApiTest
*/
public function testApiListsStatusesWithListId()
{
$response = (new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'list_id' => 1,
'page' => -1,
@ -48,7 +48,7 @@ class StatusesTest extends ApiTest
*/
public function testApiListsStatusesWithListIdAndRss()
{
$response = (new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'rss']))
$response = (new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'rss']))
->run([
'list_id' => 1
]);

View File

@ -13,6 +13,13 @@ use Friendica\Test\Util\AuthTestConfig;
class UploadTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
/**
* Test the \Friendica\Module\Api\Twitter\Media\Upload module.
*/
@ -20,7 +27,7 @@ class UploadTest extends ApiTest
{
$this->expectException(BadRequestException::class);
(new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -34,7 +41,7 @@ class UploadTest extends ApiTest
$this->expectException(UnauthorizedException::class);
AuthTestConfig::$authenticated = false;
(new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -53,7 +60,7 @@ class UploadTest extends ApiTest
]
];
(new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -76,7 +83,7 @@ class UploadTest extends ApiTest
]
];
$response = (new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$media = $this->toJson($response);

View File

@ -10,6 +10,13 @@ use Friendica\Test\src\Module\Api\ApiTest;
class DestroyTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
/**
* Test the api_statuses_destroy() function.
*
@ -19,7 +26,7 @@ class DestroyTest extends ApiTest
{
$this->expectException(BadRequestException::class);
(new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -45,7 +52,7 @@ class DestroyTest extends ApiTest
*/
public function testApiStatusesDestroyWithId()
{
$response = (new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'id' => 1
]);

View File

@ -17,7 +17,7 @@ class MentionsTest extends ApiTest
*/
public function testApiStatusesMentions()
{
$response = (new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'max_id' => 10
]);
@ -35,7 +35,7 @@ class MentionsTest extends ApiTest
*/
public function testApiStatusesMentionsWithNegativePage()
{
$response = (new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'page' => -2
]);
@ -67,7 +67,7 @@ class MentionsTest extends ApiTest
*/
public function testApiStatusesMentionsWithRss()
{
$response = (new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_RSS]))
$response = (new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => ICanCreateResponses::TYPE_RSS]))
->run([
'page' => -2
]);

View File

@ -17,7 +17,7 @@ class NetworkPublicTimelineTest extends ApiTest
*/
public function testApiStatusesNetworkpublicTimeline()
{
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'max_id' => 10
]);
@ -39,7 +39,7 @@ class NetworkPublicTimelineTest extends ApiTest
*/
public function testApiStatusesNetworkpublicTimelineWithNegativePage()
{
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'page' => -2
]);
@ -75,7 +75,7 @@ class NetworkPublicTimelineTest extends ApiTest
*/
public function testApiStatusesNetworkpublicTimelineWithRss()
{
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
'extension' => ICanCreateResponses::TYPE_RSS
]))->run([
'page' => -2

View File

@ -10,6 +10,13 @@ use Friendica\Test\src\Module\Api\ApiTest;
class RetweetTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
/**
* Test the api_statuses_repeat() function.
*
@ -19,7 +26,7 @@ class RetweetTest extends ApiTest
{
$this->expectException(BadRequestException::class);
(new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
(new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -45,7 +52,7 @@ class RetweetTest extends ApiTest
*/
public function testApiStatusesRepeatWithId()
{
$response = (new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'id' => 1
]);
@ -62,7 +69,7 @@ class RetweetTest extends ApiTest
*/
public function testApiStatusesRepeatWithSharedId()
{
$response = (new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'id' => 5
]);

View File

@ -20,7 +20,7 @@ class ShowTest extends ApiTest
$this->expectException(BadRequestException::class);
(new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
(new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -31,7 +31,7 @@ class ShowTest extends ApiTest
*/
public function testApiStatusesShowWithId()
{
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'id' => 1
]);
@ -49,7 +49,7 @@ class ShowTest extends ApiTest
*/
public function testApiStatusesShowWithConversation()
{
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'id' => 1,
'conversation' => 1

View File

@ -9,6 +9,13 @@ use Friendica\Test\src\Module\Api\ApiTest;
class UpdateTest extends ApiTest
{
protected function setUp(): void
{
parent::setUp();
$this->useHttpMethod(Router::POST);
}
/**
* Test the api_statuses_update() function.
*
@ -28,7 +35,7 @@ class UpdateTest extends ApiTest
]
];
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'status' => 'Status content #friendica',
'in_reply_to_status_id' => 0,
@ -50,7 +57,7 @@ class UpdateTest extends ApiTest
*/
public function testApiStatusesUpdateWithHtml()
{
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'htmlstatus' => '<b>Status content</b>',
]);

View File

@ -17,7 +17,7 @@ class UserTimelineTest extends ApiTest
*/
public function testApiStatusesUserTimeline()
{
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'user_id' => 42,
'max_id' => 10,
@ -42,7 +42,7 @@ class UserTimelineTest extends ApiTest
*/
public function testApiStatusesUserTimelineWithNegativePage()
{
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'user_id' => 42,
'page' => -2,
@ -65,7 +65,7 @@ class UserTimelineTest extends ApiTest
*/
public function testApiStatusesUserTimelineWithRss()
{
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
'extension' => ICanCreateResponses::TYPE_RSS
]))->run();

View File

@ -19,7 +19,7 @@ class LookupTest extends ApiTest
{
$this->expectException(NotFoundException::class);
(new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
(new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
@ -30,7 +30,7 @@ class LookupTest extends ApiTest
*/
public function testApiUsersLookupWithUserId()
{
$respone = (new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$respone = (new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'user_id' => static::OTHER_USER['id']
]);

View File

@ -18,7 +18,7 @@ class SearchTest extends ApiTest
*/
public function testApiUsersSearch()
{
$respone = (new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$respone = (new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run([
'q' => static::OTHER_USER['name']
]);
@ -35,7 +35,7 @@ class SearchTest extends ApiTest
*/
public function testApiUsersSearchWithXml()
{
$respone = (new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
$respone = (new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
'extension' => ICanCreateResponses::TYPE_XML
]))->run([
'q' => static::OTHER_USER['name']
@ -53,7 +53,7 @@ class SearchTest extends ApiTest
{
$this->expectException(BadRequestException::class);
(new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
(new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
}
}

View File

@ -17,7 +17,7 @@ class ShowTest extends ApiTest
*/
public function testApiUsersShow()
{
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))
->run();
$json = $this->toJson($response);
@ -37,7 +37,7 @@ class ShowTest extends ApiTest
*/
public function testApiUsersShowWithXml()
{
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], [
'extension' => ICanCreateResponses::TYPE_XML
]))->run();

View File

@ -2,8 +2,6 @@
namespace Friendica\Test\src\Module\Special;
use Friendica\App\Arguments;
use Friendica\App\Page;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI;
@ -14,7 +12,9 @@ class OptionsTest extends FixtureTest
{
public function testOptions()
{
$response = (new Options(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::OPTIONS]))->run();
$this->useHttpMethod(Router::OPTIONS);
$response = (new Options(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run();
self::assertEmpty((string)$response->getBody());
self::assertEquals(204, $response->getStatusCode());