mirror of
https://github.com/friendica/friendica
synced 2025-04-26 21:10:16 +00:00
Add feedback - avoid intermediate variables
This commit is contained in:
parent
adf0d7bc95
commit
301ac83ebf
42 changed files with 367 additions and 272 deletions
|
@ -19,8 +19,8 @@ class DestroyTest extends ApiTest
|
|||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
|
||||
$destroy = new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$destroy->run();
|
||||
(new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||
->run();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,8 +45,10 @@ class DestroyTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesDestroyWithId()
|
||||
{
|
||||
$destroy = new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$response = $destroy->run(['id' => 1]);
|
||||
$response = (new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||
->run([
|
||||
'id' => 1
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
|
|
@ -17,8 +17,10 @@ class MentionsTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesMentions()
|
||||
{
|
||||
$mentions = new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
$response = $mentions->run(['max_id' => 10]);
|
||||
$response = (new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run([
|
||||
'max_id' => 10
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -33,8 +35,10 @@ class MentionsTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesMentionsWithNegativePage()
|
||||
{
|
||||
$mentions = new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
$response = $mentions->run(['page' => -2]);
|
||||
$response = (new Mentions(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run([
|
||||
'page' => -2
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -63,8 +67,10 @@ class MentionsTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesMentionsWithRss()
|
||||
{
|
||||
$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]);
|
||||
$response = $mentions->run(['page' => -2]);
|
||||
$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]))
|
||||
->run([
|
||||
'page' => -2
|
||||
]);
|
||||
|
||||
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||
|
||||
|
|
|
@ -17,8 +17,10 @@ class NetworkPublicTimelineTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesNetworkpublicTimeline()
|
||||
{
|
||||
$networkPublicTimeline = new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
$response = $networkPublicTimeline->run(['max_id' => 10]);
|
||||
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run([
|
||||
'max_id' => 10
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -37,8 +39,10 @@ class NetworkPublicTimelineTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesNetworkpublicTimelineWithNegativePage()
|
||||
{
|
||||
$networkPublicTimeline = new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
$response = $networkPublicTimeline->run(['page' => -2]);
|
||||
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run([
|
||||
'page' => -2
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -71,8 +75,11 @@ class NetworkPublicTimelineTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesNetworkpublicTimelineWithRss()
|
||||
{
|
||||
$networkPublicTimeline = new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_RSS]);
|
||||
$response = $networkPublicTimeline->run(['page' => -2]);
|
||||
$response = (new NetworkPublicTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
|
||||
'extension' => ICanCreateResponses::TYPE_RSS
|
||||
]))->run([
|
||||
'page' => -2
|
||||
]);
|
||||
|
||||
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ class RetweetTest extends ApiTest
|
|||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
|
||||
$retweet = new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$retweet->run();
|
||||
(new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||
->run();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,8 +45,10 @@ class RetweetTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesRepeatWithId()
|
||||
{
|
||||
$retweet = new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$response = $retweet->run(['id' => 1]);
|
||||
$response = (new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||
->run([
|
||||
'id' => 1
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -60,8 +62,10 @@ class RetweetTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesRepeatWithSharedId()
|
||||
{
|
||||
$retweet = new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$response = $retweet->run(['id' => 5]);
|
||||
$response = (new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||
->run([
|
||||
'id' => 5
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@ class ShowTest extends ApiTest
|
|||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
|
||||
$show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
$show->run();
|
||||
|
||||
(new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,8 +31,10 @@ class ShowTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesShowWithId()
|
||||
{
|
||||
$show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
$response = $show->run(['id' => 1]);
|
||||
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run([
|
||||
'id' => 1
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -46,8 +49,11 @@ class ShowTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesShowWithConversation()
|
||||
{
|
||||
$show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
$response = $show->run(['id' => 1, 'conversation' => 1]);
|
||||
$response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run([
|
||||
'id' => 1,
|
||||
'conversation' => 1
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
|
|
@ -28,13 +28,13 @@ class UpdateTest extends ApiTest
|
|||
]
|
||||
];
|
||||
|
||||
$show = new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$response = $show->run([
|
||||
'status' => 'Status content #friendica',
|
||||
'in_reply_to_status_id' => 0,
|
||||
'lat' => 48,
|
||||
'long' => 7,
|
||||
]);
|
||||
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||
->run([
|
||||
'status' => 'Status content #friendica',
|
||||
'in_reply_to_status_id' => 0,
|
||||
'lat' => 48,
|
||||
'long' => 7,
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -50,10 +50,10 @@ class UpdateTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesUpdateWithHtml()
|
||||
{
|
||||
$show = new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$response = $show->run([
|
||||
'htmlstatus' => '<b>Status content</b>',
|
||||
]);
|
||||
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||
->run([
|
||||
'htmlstatus' => '<b>Status content</b>',
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
|
|
@ -17,14 +17,13 @@ class UserTimelineTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesUserTimeline()
|
||||
{
|
||||
$networkPublicTimeline = new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
|
||||
$response = $networkPublicTimeline->run([
|
||||
'user_id' => 42,
|
||||
'max_id' => 10,
|
||||
'exclude_replies' => true,
|
||||
'conversation_id' => 7,
|
||||
]);
|
||||
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run([
|
||||
'user_id' => 42,
|
||||
'max_id' => 10,
|
||||
'exclude_replies' => true,
|
||||
'conversation_id' => 7,
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -43,12 +42,11 @@ class UserTimelineTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesUserTimelineWithNegativePage()
|
||||
{
|
||||
$networkPublicTimeline = new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
|
||||
|
||||
$response = $networkPublicTimeline->run([
|
||||
'user_id' => 42,
|
||||
'page' => -2,
|
||||
]);
|
||||
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||
->run([
|
||||
'user_id' => 42,
|
||||
'page' => -2,
|
||||
]);
|
||||
|
||||
$json = $this->toJson($response);
|
||||
|
||||
|
@ -67,9 +65,9 @@ class UserTimelineTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusesUserTimelineWithRss()
|
||||
{
|
||||
$networkPublicTimeline = new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_RSS]);
|
||||
|
||||
$response = $networkPublicTimeline->run();
|
||||
$response = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
|
||||
'extension' => ICanCreateResponses::TYPE_RSS
|
||||
]))->run();
|
||||
|
||||
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue