mirror of
https://github.com/friendica/friendica
synced 2025-04-26 21:10:16 +00:00
Introduce FixtureTest::useHttpMethod for manually overwrite the HTTP Method argument
This commit is contained in:
parent
4e67bfed8d
commit
5e85939502
36 changed files with 175 additions and 82 deletions
|
@ -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
|
||||
]);
|
||||
|
|
|
@ -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
|
||||
]);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
]);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>',
|
||||
]);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue