diff --git a/tests/src/Factory/Api/Twitter/ActivitiesTest.php b/tests/src/Factory/Api/Twitter/ActivitiesTest.php
index 43f976e353..b468bdd1e7 100644
--- a/tests/src/Factory/Api/Twitter/ActivitiesTest.php
+++ b/tests/src/Factory/Api/Twitter/ActivitiesTest.php
@@ -17,8 +17,8 @@ class ActivitiesTest extends FixtureTest
{
$item = ['uid' => 0, 'uri-id' => 1];
- $friendicaActivitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
- $result = $friendicaActivitiesFac->createFromUriId($item['uri-id'], $item['uid']);
+ $result = (new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser()))
+ ->createFromUriId($item['uri-id'], $item['uid']);
self::assertArrayHasKey('like', $result);
self::assertArrayHasKey('dislike', $result);
@@ -36,8 +36,8 @@ class ActivitiesTest extends FixtureTest
{
$item = ['uid' => 0, 'uri-id' => 1];
- $friendicaActivitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
- $result = $friendicaActivitiesFac->createFromUriId($item['uri-id'], $item['uid'], 'xml');
+ $result = (new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser()))
+ ->createFromUriId($item['uri-id'], $item['uid'], 'xml');
self::assertArrayHasKey('friendica:like', $result);
self::assertArrayHasKey('friendica:dislike', $result);
diff --git a/tests/src/Factory/Api/Twitter/DirectMessageTest.php b/tests/src/Factory/Api/Twitter/DirectMessageTest.php
index 9cc7560708..8ba821c760 100644
--- a/tests/src/Factory/Api/Twitter/DirectMessageTest.php
+++ b/tests/src/Factory/Api/Twitter/DirectMessageTest.php
@@ -20,9 +20,9 @@ class DirectMessageTest extends FixtureTest
$ids = DI::dba()->selectToArray('mail', ['id']);
$id = $ids[0]['id'];
- $directMessageFactory = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $directMessageObj = $directMessageFactory->createFromMailId($id, ApiTest::SELF_USER['id']);
- $directMessage = $directMessageObj->toArray();
+ $directMessage = (new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()))
+ ->createFromMailId($id, ApiTest::SELF_USER['id'])
+ ->toArray();
self::assertEquals('item_title' . "\n" . 'item_body', $directMessage['text']);
self::assertIsInt($directMessage['id']);
@@ -43,9 +43,9 @@ class DirectMessageTest extends FixtureTest
$ids = DI::dba()->selectToArray('mail', ['id']);
$id = $ids[0]['id'];
- $directMessageFactory = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $directMessageObj = $directMessageFactory->createFromMailId($id, ApiTest::SELF_USER['id'], 'html');
- $directMessage = $directMessageObj->toArray();
+ $directMessage = (new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()))
+ ->createFromMailId($id, ApiTest::SELF_USER['id'], 'html')
+ ->toArray();
self::assertEquals('item_title', $directMessage['title']);
self::assertEquals('item_body', $directMessage['text']);
@@ -62,9 +62,9 @@ class DirectMessageTest extends FixtureTest
$ids = DI::dba()->selectToArray('mail', ['id']);
$id = $ids[0]['id'];
- $directMessageFactory = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $directMessageObj = $directMessageFactory->createFromMailId($id, ApiTest::SELF_USER['id'], 'plain');
- $directMessage = $directMessageObj->toArray();
+ $directMessage = (new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()))
+ ->createFromMailId($id, ApiTest::SELF_USER['id'], 'plain')
+ ->toArray();
self::assertEquals('item_title', $directMessage['title']);
self::assertEquals('item_body', $directMessage['text']);
@@ -84,9 +84,9 @@ class DirectMessageTest extends FixtureTest
$ids = DI::dba()->selectToArray('mail', ['id']);
$id = $ids[0]['id'];
- $directMessageFactory = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $directMessageObj = $directMessageFactory->createFromMailId($id, ApiTest::SELF_USER['id'], 'plain', $$GETUSEROBJECTS$$);
- $directMessage = $directMessageObj->toArray();
+ $directMessage = (new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()))
+ ->createFromMailId($id, ApiTest::SELF_USER['id'], 'plain', $$GETUSEROBJECTS$$)
+ ->toArray();
self::assertTrue(!isset($directMessage['sender']));
self::assertTrue(!isset($directMessage['recipient']));
diff --git a/tests/src/Factory/Api/Twitter/StatusTest.php b/tests/src/Factory/Api/Twitter/StatusTest.php
index 1073867ee2..a2d9d7171c 100644
--- a/tests/src/Factory/Api/Twitter/StatusTest.php
+++ b/tests/src/Factory/Api/Twitter/StatusTest.php
@@ -15,6 +15,24 @@ use Friendica\Test\src\Module\Api\ApiTest;
class StatusTest extends FixtureTest
{
+ protected $statusFactory;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+
+ $this->statusFactory = new Status(
+ DI::logger(),
+ DI::dba(),
+ DI::twitterUser(),
+ new Hashtag(DI::logger()),
+ new Media(DI::logger(), DI::baseUrl()),
+ new Url(DI::logger()),
+ new Mention(DI::logger(), DI::baseUrl()),
+ new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser()),
+ new Attachment(DI::logger()));
+ }
+
/**
* Test the api_convert_item() function.
*
@@ -22,16 +40,9 @@ class StatusTest extends FixtureTest
*/
public function testApiConvertItem()
{
- $hashTagFac = new Hashtag(DI::logger());
- $mediaFac = new Media(DI::logger(), DI::baseUrl());
- $urlFac = new Url(DI::logger());
- $mentionFac = new Mention(DI::logger(), DI::baseUrl());
- $activitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
- $attachmentFac = new Attachment(DI::logger());
-
- $statusFac = new Status(DI::logger(), DI::dba(), DI::twitterUser(), $hashTagFac, $mediaFac, $urlFac, $mentionFac, $activitiesFac, $attachmentFac);
- $statusObj = $statusFac->createFromItemId(13, ApiTest::SELF_USER['id']);
- $status = $statusObj->toArray();
+ $status = $this->statusFactory
+ ->createFromItemId(13, ApiTest::SELF_USER['id'])
+ ->toArray();
self::assertStringStartsWith('item_title', $status['text']);
self::assertStringStartsWith('
item_title
perspiciatis impedit voluptatem', $status['friendica_html']);
@@ -90,16 +101,9 @@ class StatusTest extends FixtureTest
*/
public function testApiGetEntititiesWithIncludeEntities()
{
- $hashTagFac = new Hashtag(DI::logger());
- $mediaFac = new Media(DI::logger(), DI::baseUrl());
- $urlFac = new Url(DI::logger());
- $mentionFac = new Mention(DI::logger(), DI::baseUrl());
- $activitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
- $attachmentFac = new Attachment(DI::logger());
-
- $statusFac = new Status(DI::logger(), DI::dba(), DI::twitterUser(), $hashTagFac, $mediaFac, $urlFac, $mentionFac, $activitiesFac, $attachmentFac);
- $statusObj = $statusFac->createFromItemId(13, ApiTest::SELF_USER['id'], true);
- $status = $statusObj->toArray();
+ $status = $this->statusFactory
+ ->createFromItemId(13, ApiTest::SELF_USER['id'], true)
+ ->toArray();
self::assertIsArray($status['entities']);
self::assertIsArray($status['extended_entities']);
@@ -114,19 +118,11 @@ class StatusTest extends FixtureTest
*/
public function testApiFormatItems()
{
- $hashTagFac = new Hashtag(DI::logger());
- $mediaFac = new Media(DI::logger(), DI::baseUrl());
- $urlFac = new Url(DI::logger());
- $mentionFac = new Mention(DI::logger(), DI::baseUrl());
- $activitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
- $attachmentFac = new Attachment(DI::logger());
-
- $statusFac = new Status(DI::logger(), DI::dba(), DI::twitterUser(), $hashTagFac, $mediaFac, $urlFac, $mentionFac, $activitiesFac, $attachmentFac);
-
$posts = DI::dba()->selectToArray('post-view', ['uri-id']);
foreach ($posts as $item) {
- $statusObj = $statusFac->createFromUriId($item['uri-id'], ApiTest::SELF_USER['id']);
- $status = $statusObj->toArray();
+ $status = $this->statusFactory
+ ->createFromUriId($item['uri-id'], ApiTest::SELF_USER['id'])
+ ->toArray();
self::assertIsInt($status['id']);
self::assertIsString($status['text']);
diff --git a/tests/src/Factory/Api/Twitter/UserTest.php b/tests/src/Factory/Api/Twitter/UserTest.php
index a39055a91b..9a279ee7fe 100644
--- a/tests/src/Factory/Api/Twitter/UserTest.php
+++ b/tests/src/Factory/Api/Twitter/UserTest.php
@@ -31,9 +31,9 @@ class UserTest extends FixtureTest
*/
public function testApiGetUser()
{
- $userFactory = new User(DI::logger(), DI::twitterStatus());
- $userObj = $userFactory->createFromUserId(ApiTest::SELF_USER['id']);
- $user = $userObj->toArray();
+ $user = (new User(DI::logger(), DI::twitterStatus()))
+ ->createFromUserId(ApiTest::SELF_USER['id'])
+ ->toArray();
$this->assertSelfUser($user);
}
@@ -114,9 +114,9 @@ class UserTest extends FixtureTest
*/
public function testApiGetUserWithWrongGetId()
{
- $userFactory = new User(DI::logger(), DI::twitterStatus());
- $userObj = $userFactory->createFromUserId(-1);
- $user = $userObj->toArray();
+ $user = (new User(DI::logger(), DI::twitterStatus()))
+ ->createFromUserId(-1)
+ ->toArray();
self::assertEquals(0, $user['id']);
self::assertEquals(0, $user['uid']);
diff --git a/tests/src/Module/Api/Friendica/DirectMessages/SearchTest.php b/tests/src/Module/Api/Friendica/DirectMessages/SearchTest.php
index 9fe8f7ca70..af12be2c1b 100644
--- a/tests/src/Module/Api/Friendica/DirectMessages/SearchTest.php
+++ b/tests/src/Module/Api/Friendica/DirectMessages/SearchTest.php
@@ -34,7 +34,8 @@ 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]))->run();
+ $response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
$json = $this->toJson($response);
@@ -51,8 +52,10 @@ class SearchTest extends ApiTest
$directMessage = new DirectMessage(new NullLogger(), DI::dba(), DI::twitterUser());
- $search = new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $search->run(['searchstring' => 'item_body']);
+ $response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run([
+ 'searchstring' => 'item_body'
+ ]);
$json = $this->toJson($response);
@@ -70,8 +73,10 @@ class SearchTest extends ApiTest
{
$directMessage = new DirectMessage(new NullLogger(), DI::dba(), DI::twitterUser());
- $search = new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $search->run(['searchstring' => 'test']);
+ $response = (new Search($directMessage, DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run([
+ 'searchstring' => 'test'
+ ]);
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Friendica/NotificationTest.php b/tests/src/Module/Api/Friendica/NotificationTest.php
index f05387bd88..bd0edf046f 100644
--- a/tests/src/Module/Api/Friendica/NotificationTest.php
+++ b/tests/src/Module/Api/Friendica/NotificationTest.php
@@ -66,17 +66,20 @@ class NotificationTest extends ApiTest
XML;
- $notification = new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
- $response = $notification->run();
+ $response = (new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']))
+ ->run();
self::assertXmlStringEqualsXmlString($assertXml, (string)$response->getBody());
- self::assertEquals(['Content-type' => ['text/xml'], ICanCreateResponses::X_HEADER => ['xml']], $response->getHeaders());
+ self::assertEquals([
+ 'Content-type' => ['text/xml'],
+ ICanCreateResponses::X_HEADER => ['xml']
+ ], $response->getHeaders());
}
public function testWithJsonResult()
{
- $notification = new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
- $response = $notification->run();
+ $response = (new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
+ ->run();
$json = $this->toJson($response);
@@ -88,6 +91,9 @@ XML;
self::assertIsString($note->msg);
}
- self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
+ self::assertEquals([
+ 'Content-type' => ['application/json'],
+ ICanCreateResponses::X_HEADER => ['json']
+ ], $response->getHeaders());
}
}
diff --git a/tests/src/Module/Api/Friendica/Photo/DeleteTest.php b/tests/src/Module/Api/Friendica/Photo/DeleteTest.php
index 05808d56c4..2f8bdb8fd9 100644
--- a/tests/src/Module/Api/Friendica/Photo/DeleteTest.php
+++ b/tests/src/Module/Api/Friendica/Photo/DeleteTest.php
@@ -50,8 +50,10 @@ class DeleteTest extends ApiTest
{
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
- $delete = new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
- $response = $delete->run(['photo_id' => '709057080661a283a6aa598501504178']);
+ $response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'photo_id' => '709057080661a283a6aa598501504178'
+ ]);
$json = $this->toJson($response);
@@ -63,8 +65,10 @@ class DeleteTest extends ApiTest
{
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
- $delete = new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
- $response = $delete->run(['photo_id' => '709057080661a283a6aa598501504178']);
+ $response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'photo_id' => '709057080661a283a6aa598501504178'
+ ]);
$responseText = (string)$response->getBody();
diff --git a/tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php b/tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php
index 230ba70c89..b4c6df2d54 100644
--- a/tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php
+++ b/tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php
@@ -32,22 +32,28 @@ class DeleteTest extends ApiTest
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(), ['REQUEST_METHOD' => Router::POST]))
+ ->run();
}
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(['album' => 'album_name']);
+ (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'album' => 'album_name'
+ ]);
}
public function testValidWithDelete()
{
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
- $delete = new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
- $response = $delete->run(['album' => 'test_album']);
+ $response = (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'album' => 'test_album']
+ );
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php b/tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php
index fa4638e370..e370ba3f91 100644
--- a/tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php
+++ b/tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php
@@ -32,19 +32,27 @@ class UpdateTest extends ApiTest
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]))->run();
+ (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->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]))->run(['album' => 'album_name']);
+ (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'album' => 'album_name'
+ ]);
}
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]))->run(['album' => 'album_name', 'album_new' => 'album_name']);
+ (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'album' => 'album_name',
+ 'album_new' => 'album_name'
+ ]);
}
public function testWithoutAuthenticatedUser()
@@ -56,7 +64,11 @@ 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]))->run(['album' => 'test_album', 'album_new' => 'test_album_2']);
+ $response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'album' => 'test_album',
+ 'album_new' => 'test_album_2'
+ ]);
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php b/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php
index b1874d8386..07e43479d2 100644
--- a/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php
+++ b/tests/src/Module/Api/GnuSocial/GnuSocial/ConfigTest.php
@@ -17,8 +17,8 @@ class ConfigTest extends ApiTest
{
DI::config()->set('system', 'ssl_policy', BaseURL::SSL_POLICY_FULL);
- $config = new Config(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $config->run();
+ $response = (new Config(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/GnuSocial/GnuSocial/VersionTest.php b/tests/src/Module/Api/GnuSocial/GnuSocial/VersionTest.php
index 0f65318319..7d98e365c1 100644
--- a/tests/src/Module/Api/GnuSocial/GnuSocial/VersionTest.php
+++ b/tests/src/Module/Api/GnuSocial/GnuSocial/VersionTest.php
@@ -11,10 +11,13 @@ class VersionTest extends ApiTest
{
public function test()
{
- $version = new Version(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
- $response = $version->run();
+ $response = (new Version(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
+ ->run();
- self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
+ self::assertEquals([
+ 'Content-type' => ['application/json'],
+ ICanCreateResponses::X_HEADER => ['json']
+ ], $response->getHeaders());
self::assertEquals('"0.9.7"', $response->getBody());
}
}
diff --git a/tests/src/Module/Api/GnuSocial/Help/TestTest.php b/tests/src/Module/Api/GnuSocial/Help/TestTest.php
index 858c9b6cdc..4c9e0c169e 100644
--- a/tests/src/Module/Api/GnuSocial/Help/TestTest.php
+++ b/tests/src/Module/Api/GnuSocial/Help/TestTest.php
@@ -11,21 +11,27 @@ class TestTest extends ApiTest
{
public function testJson()
{
- $test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
- $response = $test->run();
+ $response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
+ ->run();
$json = $this->toJson($response);
- self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
+ self::assertEquals([
+ 'Content-type' => ['application/json'],
+ ICanCreateResponses::X_HEADER => ['json']
+ ], $response->getHeaders());
self::assertEquals('ok', $json);
}
public function testXml()
{
- $test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
- $response = $test->run();
+ $response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']))
+ ->run();
- self::assertEquals(['Content-type' => ['text/xml'], ICanCreateResponses::X_HEADER => ['xml']], $response->getHeaders());
+ self::assertEquals([
+ 'Content-type' => ['text/xml'],
+ ICanCreateResponses::X_HEADER => ['xml']
+ ], $response->getHeaders());
self::assertxml($response->getBody(), 'ok');
}
}
diff --git a/tests/src/Module/Api/Mastodon/Accounts/VerifyCredentialsTest.php b/tests/src/Module/Api/Mastodon/Accounts/VerifyCredentialsTest.php
index 51d76696f6..5942aa1d27 100644
--- a/tests/src/Module/Api/Mastodon/Accounts/VerifyCredentialsTest.php
+++ b/tests/src/Module/Api/Mastodon/Accounts/VerifyCredentialsTest.php
@@ -16,8 +16,8 @@ class VerifyCredentialsTest extends ApiTest
*/
public function testApiAccountVerifyCredentials()
{
- $verifyCredentials = new VerifyCredentials(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $verifyCredentials->run();
+ $response = (new VerifyCredentials(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php b/tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php
index a76b5d87e0..9b29d314be 100644
--- a/tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php
+++ b/tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php
@@ -12,12 +12,15 @@ class RateLimitStatusTest extends ApiTest
{
public function testWithJson()
{
- $rateLimitStatus = new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']);
- $response = $rateLimitStatus->run();
+ $response = (new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
+ ->run();
$result = $this->toJson($response);
- self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
+ self::assertEquals([
+ 'Content-type' => ['application/json'],
+ ICanCreateResponses::X_HEADER => ['json']
+ ], $response->getHeaders());
self::assertEquals(150, $result->remaining_hits);
self::assertEquals(150, $result->hourly_limit);
self::assertIsInt($result->reset_time_in_seconds);
@@ -25,10 +28,13 @@ class RateLimitStatusTest extends ApiTest
public function testWithXml()
{
- $rateLimitStatus = new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
- $response = $rateLimitStatus->run();
+ $response = (new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']))
+ ->run();
- self::assertEquals(['Content-type' => ['text/xml'], ICanCreateResponses::X_HEADER => ['xml']], $response->getHeaders());
+ self::assertEquals([
+ 'Content-type' => ['text/xml'],
+ ICanCreateResponses::X_HEADER => ['xml']
+ ], $response->getHeaders());
self::assertXml($response->getBody(), 'hash');
}
}
diff --git a/tests/src/Module/Api/Twitter/Account/UpdateProfileTest.php b/tests/src/Module/Api/Twitter/Account/UpdateProfileTest.php
index e06e8d4848..76cb27c919 100644
--- a/tests/src/Module/Api/Twitter/Account/UpdateProfileTest.php
+++ b/tests/src/Module/Api/Twitter/Account/UpdateProfileTest.php
@@ -14,8 +14,11 @@ class UpdateProfileTest extends ApiTest
*/
public function testApiAccountUpdateProfile()
{
- $updateProfile = new UpdateProfile(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST], ['extension' => 'json']);
- $response = $updateProfile->run(['name' => 'new_name', 'description' => 'new_description']);
+ $response = (new UpdateProfile(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST], ['extension' => 'json']))
+ ->run([
+ 'name' => 'new_name',
+ 'description' => 'new_description'
+ ]);
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/Blocks/ListsTest.php b/tests/src/Module/Api/Twitter/Blocks/ListsTest.php
index a37b59f036..77c45ada83 100644
--- a/tests/src/Module/Api/Twitter/Blocks/ListsTest.php
+++ b/tests/src/Module/Api/Twitter/Blocks/ListsTest.php
@@ -14,8 +14,8 @@ class ListsTest extends ApiTest
*/
public function testApiStatusesFWithBlocks()
{
- $lists = new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $lists->run();
+ $response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/DirectMessages/AllTest.php b/tests/src/Module/Api/Twitter/DirectMessages/AllTest.php
index 52021c71b9..63290368aa 100644
--- a/tests/src/Module/Api/Twitter/DirectMessages/AllTest.php
+++ b/tests/src/Module/Api/Twitter/DirectMessages/AllTest.php
@@ -21,8 +21,8 @@ class AllTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $destroy = 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 = $destroy->run();
+ $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']))
+ ->run();
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/DirectMessages/ConversationTest.php b/tests/src/Module/Api/Twitter/DirectMessages/ConversationTest.php
index 815d5eb577..5667b72768 100644
--- a/tests/src/Module/Api/Twitter/DirectMessages/ConversationTest.php
+++ b/tests/src/Module/Api/Twitter/DirectMessages/ConversationTest.php
@@ -19,10 +19,10 @@ class ConversationTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $sent = 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 = $sent->run([
- 'friendica_verbose' => true,
- ]);
+ $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']))
+ ->run([
+ 'friendica_verbose' => true,
+ ]);
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/DirectMessages/DestroyTest.php b/tests/src/Module/Api/Twitter/DirectMessages/DestroyTest.php
index f1ab18d5c4..b743227789 100644
--- a/tests/src/Module/Api/Twitter/DirectMessages/DestroyTest.php
+++ b/tests/src/Module/Api/Twitter/DirectMessages/DestroyTest.php
@@ -18,7 +18,8 @@ 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']))->run();
+ (new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
+ ->run();
}
/**
@@ -28,10 +29,10 @@ class DestroyTest extends ApiTest
*/
public function testApiDirectMessagesDestroyWithVerbose()
{
- $destroy = 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 = $destroy->run([
- 'friendica_verbose' => true,
- ]);
+ $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']))
+ ->run([
+ 'friendica_verbose' => true,
+ ]);
$json = $this->toJson($response);
@@ -64,7 +65,10 @@ 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']))->run(['id' => 1]);
+ (new Destroy(DI::dba(), DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
+ ->run([
+ 'id' => 1
+ ]);
}
/**
@@ -74,12 +78,12 @@ class DestroyTest extends ApiTest
*/
public function testApiDirectMessagesDestroyWithIdAndVerbose()
{
- $destroy = 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 = $destroy->run([
- 'id' => 1,
- 'friendica_parenturi' => 'parent_uri',
- 'friendica_verbose' => true,
- ]);
+ $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']))
+ ->run([
+ 'id' => 1,
+ 'friendica_parenturi' => 'parent_uri',
+ 'friendica_verbose' => true,
+ ]);
$json = $this->toJson($response);
@@ -98,11 +102,11 @@ class DestroyTest extends ApiTest
$ids = DBA::selectToArray('mail', ['id']);
$id = $ids[0]['id'];
- $destroy = 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 = $destroy->run([
- 'id' => $id,
- 'friendica_verbose' => true,
- ]);
+ $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']))
+ ->run([
+ 'id' => $id,
+ 'friendica_verbose' => true,
+ ]);
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php b/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php
index 42c0b59785..beb61ee968 100644
--- a/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php
+++ b/tests/src/Module/Api/Twitter/DirectMessages/InboxTest.php
@@ -21,8 +21,8 @@ class InboxTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $destroy = 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 = $destroy->run();
+ $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']))
+ ->run();
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/DirectMessages/NewDMTest.php b/tests/src/Module/Api/Twitter/DirectMessages/NewDMTest.php
index d9bcc87ed1..3cae992fa2 100644
--- a/tests/src/Module/Api/Twitter/DirectMessages/NewDMTest.php
+++ b/tests/src/Module/Api/Twitter/DirectMessages/NewDMTest.php
@@ -19,8 +19,8 @@ class NewDMTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $newDm = 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 = $newDm->run();
+ $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']))
+ ->run();
self::assertEmpty((string)$response->getBody());
}
@@ -51,11 +51,11 @@ class NewDMTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $newDm = 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 = $newDm->run([
- 'text' => 'message_text',
- 'user_id' => 43
- ]);
+ $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']))
+ ->run([
+ 'text' => 'message_text',
+ 'user_id' => 43
+ ]);
$json = $this->toJson($response);
@@ -73,11 +73,11 @@ class NewDMTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $newDm = 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 = $newDm->run([
- 'text' => 'message_text',
- 'user_id' => 44
- ]);
+ $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']))
+ ->run([
+ 'text' => 'message_text',
+ 'user_id' => 44
+ ]);
$json = $this->toJson($response);
@@ -97,12 +97,12 @@ class NewDMTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $newDm = 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 = $newDm->run([
- 'text' => 'message_text',
- 'user_id' => 44,
- 'title' => 'message_title',
- ]);
+ $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']))
+ ->run([
+ 'text' => 'message_text',
+ 'user_id' => 44,
+ 'title' => 'message_title',
+ ]);
$json = $this->toJson($response);
@@ -123,12 +123,12 @@ class NewDMTest extends ApiTest
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $newDm = 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 = $newDm->run([
- 'text' => 'message_text',
- 'user_id' => 44,
- 'title' => 'message_title',
- ]);
+ $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']))
+ ->run([
+ 'text' => 'message_text',
+ 'user_id' => 44,
+ 'title' => 'message_title',
+ ]);
self::assertXml((string)$response->getBody(), 'direct-messages');
}
diff --git a/tests/src/Module/Api/Twitter/DirectMessages/SentTest.php b/tests/src/Module/Api/Twitter/DirectMessages/SentTest.php
index 3343716622..ccea4fd539 100644
--- a/tests/src/Module/Api/Twitter/DirectMessages/SentTest.php
+++ b/tests/src/Module/Api/Twitter/DirectMessages/SentTest.php
@@ -19,10 +19,10 @@ class SentTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $sent = 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 = $sent->run([
- 'friendica_verbose' => true,
- ]);
+ $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']))
+ ->run([
+ 'friendica_verbose' => true,
+ ]);
$json = $this->toJson($response);
@@ -39,8 +39,8 @@ class SentTest extends ApiTest
{
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
- $sent = 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 = $sent->run();
+ $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']))
+ ->run();
self::assertXml((string)$response->getBody(), 'direct-messages');
}
diff --git a/tests/src/Module/Api/Twitter/Favorites/CreateTest.php b/tests/src/Module/Api/Twitter/Favorites/CreateTest.php
index 00a99643bf..1055dd9d1a 100644
--- a/tests/src/Module/Api/Twitter/Favorites/CreateTest.php
+++ b/tests/src/Module/Api/Twitter/Favorites/CreateTest.php
@@ -20,8 +20,8 @@ class CreateTest extends ApiTest
{
$this->expectException(BadRequestException::class);
- $create = new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
- $create->run();
+ (new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run();
}
/**
@@ -31,8 +31,10 @@ class CreateTest extends ApiTest
*/
public function testApiFavoritesCreateDestroyWithCreateAction()
{
- $create = new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
- $response = $create->run(['id' => 3]);
+ $response = (new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'id' => 3
+ ]);
$json = $this->toJson($response);
@@ -46,8 +48,10 @@ class CreateTest extends ApiTest
*/
public function testApiFavoritesCreateDestroyWithCreateActionAndRss()
{
- $create = 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 = $create->run(['id' => 3]);
+ $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]))
+ ->run([
+ 'id' => 3
+ ]);
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
diff --git a/tests/src/Module/Api/Twitter/Favorites/DestroyTest.php b/tests/src/Module/Api/Twitter/Favorites/DestroyTest.php
index 3d8ce8a212..65113f5568 100644
--- a/tests/src/Module/Api/Twitter/Favorites/DestroyTest.php
+++ b/tests/src/Module/Api/Twitter/Favorites/DestroyTest.php
@@ -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();
}
/**
@@ -30,8 +30,10 @@ class DestroyTest extends ApiTest
*/
public function testApiFavoritesCreateDestroyWithDestroyAction()
{
- $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' => 3]);
+ $response = (new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'id' => 3
+ ]);
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/FavoritesTest.php b/tests/src/Module/Api/Twitter/FavoritesTest.php
index dd95d73f90..1f0faa971a 100644
--- a/tests/src/Module/Api/Twitter/FavoritesTest.php
+++ b/tests/src/Module/Api/Twitter/FavoritesTest.php
@@ -17,11 +17,11 @@ class FavoritesTest extends ApiTest
*/
public function testApiFavorites()
{
- $favorites = new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $favorites->run([
- 'page' => -1,
- 'max_id' => 10,
- ]);
+ $response = (new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run([
+ 'page' => -1,
+ 'max_id' => 10,
+ ]);
$json = $this->toJson($response);
@@ -37,8 +37,9 @@ class FavoritesTest extends ApiTest
*/
public function testApiFavoritesWithRss()
{
- $favorites = new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_RSS]);
- $response = $favorites->run();
+ $response = (new Favorites(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));
diff --git a/tests/src/Module/Api/Twitter/Followers/ListsTest.php b/tests/src/Module/Api/Twitter/Followers/ListsTest.php
index 7ea3863eaf..e9946bb735 100644
--- a/tests/src/Module/Api/Twitter/Followers/ListsTest.php
+++ b/tests/src/Module/Api/Twitter/Followers/ListsTest.php
@@ -14,8 +14,8 @@ class ListsTest extends ApiTest
*/
public function testApiStatusesFWithFollowers()
{
- $lists = new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $lists->run();
+ $response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/Friends/ListsTest.php b/tests/src/Module/Api/Twitter/Friends/ListsTest.php
index 7cb5bd10a7..3628f5c963 100644
--- a/tests/src/Module/Api/Twitter/Friends/ListsTest.php
+++ b/tests/src/Module/Api/Twitter/Friends/ListsTest.php
@@ -16,8 +16,8 @@ class ListsTest extends ApiTest
*/
public function testApiStatusesFWithFriends()
{
- $lists = new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $lists->run();
+ $response = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/Friendships/IncomingTest.php b/tests/src/Module/Api/Twitter/Friendships/IncomingTest.php
index c1309e1f0a..d8e5cc3da0 100644
--- a/tests/src/Module/Api/Twitter/Friendships/IncomingTest.php
+++ b/tests/src/Module/Api/Twitter/Friendships/IncomingTest.php
@@ -16,8 +16,8 @@ class IncomingTest extends ApiTest
*/
public function testApiFriendshipsIncoming()
{
- $lists = new Incoming(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $lists->run();
+ $response = (new Incoming(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/Lists/StatusesTest.php b/tests/src/Module/Api/Twitter/Lists/StatusesTest.php
index 3f47fcaca6..66ebf8bbd7 100644
--- a/tests/src/Module/Api/Twitter/Lists/StatusesTest.php
+++ b/tests/src/Module/Api/Twitter/Lists/StatusesTest.php
@@ -19,8 +19,8 @@ class StatusesTest extends ApiTest
{
$this->expectException(BadRequestException::class);
- $lists = new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $lists->run();
+ (new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
}
/**
@@ -28,8 +28,12 @@ class StatusesTest extends ApiTest
*/
public function testApiListsStatusesWithListId()
{
- $lists = new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $lists->run(['list_id' => 1, 'page' => -1, 'max_id' => 10]);
+ $response = (new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run([
+ 'list_id' => 1,
+ 'page' => -1,
+ 'max_id' => 10
+ ]);
$json = $this->toJson($response);
@@ -44,8 +48,10 @@ class StatusesTest extends ApiTest
*/
public function testApiListsStatusesWithListIdAndRss()
{
- $lists = new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'rss']);
- $response = $lists->run(['list_id' => 1]);
+ $response = (new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'rss']))
+ ->run([
+ 'list_id' => 1
+ ]);
self::assertXml((string)$response->getBody());
}
diff --git a/tests/src/Module/Api/Twitter/Media/UploadTest.php b/tests/src/Module/Api/Twitter/Media/UploadTest.php
index 4b0ffada12..b3516c3079 100644
--- a/tests/src/Module/Api/Twitter/Media/UploadTest.php
+++ b/tests/src/Module/Api/Twitter/Media/UploadTest.php
@@ -19,8 +19,9 @@ class UploadTest extends ApiTest
public function testApiMediaUpload()
{
$this->expectException(BadRequestException::class);
- $upload = new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
- $upload->run();
+
+ (new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run();
}
/**
@@ -32,7 +33,9 @@ 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]))->run();
+
+ (new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run();
}
/**
@@ -49,7 +52,9 @@ class UploadTest extends ApiTest
'tmp_name' => 'tmp_name'
]
];
- (new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run();
+
+ (new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run();
}
/**
@@ -71,7 +76,8 @@ 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]))->run();
+ $response = (new Upload(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run();
$media = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/SavedSearchesTest.php b/tests/src/Module/Api/Twitter/SavedSearchesTest.php
index 5735f8eef0..667caf98ca 100644
--- a/tests/src/Module/Api/Twitter/SavedSearchesTest.php
+++ b/tests/src/Module/Api/Twitter/SavedSearchesTest.php
@@ -11,8 +11,8 @@ class SavedSearchesTest extends ApiTest
{
public function test()
{
- $savedSearch = new SavedSearches(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
- $response = $savedSearch->run();
+ $response = (new SavedSearches(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
+ ->run();
$result = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/Statuses/DestroyTest.php b/tests/src/Module/Api/Twitter/Statuses/DestroyTest.php
index 9b2110eb6b..0480ba8c2b 100644
--- a/tests/src/Module/Api/Twitter/Statuses/DestroyTest.php
+++ b/tests/src/Module/Api/Twitter/Statuses/DestroyTest.php
@@ -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);
diff --git a/tests/src/Module/Api/Twitter/Statuses/MentionsTest.php b/tests/src/Module/Api/Twitter/Statuses/MentionsTest.php
index 364af4a569..d92f26f72b 100644
--- a/tests/src/Module/Api/Twitter/Statuses/MentionsTest.php
+++ b/tests/src/Module/Api/Twitter/Statuses/MentionsTest.php
@@ -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));
diff --git a/tests/src/Module/Api/Twitter/Statuses/NetworkPublicTimelineTest.php b/tests/src/Module/Api/Twitter/Statuses/NetworkPublicTimelineTest.php
index 7d75cdd7d7..a5217fb715 100644
--- a/tests/src/Module/Api/Twitter/Statuses/NetworkPublicTimelineTest.php
+++ b/tests/src/Module/Api/Twitter/Statuses/NetworkPublicTimelineTest.php
@@ -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));
diff --git a/tests/src/Module/Api/Twitter/Statuses/RetweetTest.php b/tests/src/Module/Api/Twitter/Statuses/RetweetTest.php
index 1b527ccc9f..1d93c02969 100644
--- a/tests/src/Module/Api/Twitter/Statuses/RetweetTest.php
+++ b/tests/src/Module/Api/Twitter/Statuses/RetweetTest.php
@@ -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);
diff --git a/tests/src/Module/Api/Twitter/Statuses/ShowTest.php b/tests/src/Module/Api/Twitter/Statuses/ShowTest.php
index c2d87a95f4..f9d302f0ef 100644
--- a/tests/src/Module/Api/Twitter/Statuses/ShowTest.php
+++ b/tests/src/Module/Api/Twitter/Statuses/ShowTest.php
@@ -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);
diff --git a/tests/src/Module/Api/Twitter/Statuses/UpdateTest.php b/tests/src/Module/Api/Twitter/Statuses/UpdateTest.php
index 1d181dd523..f3f6b5a929 100644
--- a/tests/src/Module/Api/Twitter/Statuses/UpdateTest.php
+++ b/tests/src/Module/Api/Twitter/Statuses/UpdateTest.php
@@ -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' => 'Status content',
- ]);
+ $response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
+ ->run([
+ 'htmlstatus' => 'Status content',
+ ]);
$json = $this->toJson($response);
diff --git a/tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php b/tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php
index fc2565e31c..eb06133f36 100644
--- a/tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php
+++ b/tests/src/Module/Api/Twitter/Statuses/UserTimelineTest.php
@@ -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));
diff --git a/tests/src/Module/Api/Twitter/Users/LookupTest.php b/tests/src/Module/Api/Twitter/Users/LookupTest.php
index e54d20dcfb..2c5739e828 100644
--- a/tests/src/Module/Api/Twitter/Users/LookupTest.php
+++ b/tests/src/Module/Api/Twitter/Users/LookupTest.php
@@ -19,8 +19,8 @@ class LookupTest extends ApiTest
{
$this->expectException(NotFoundException::class);
- $lookup = new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $lookup->run();
+ (new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
}
/**
@@ -30,8 +30,10 @@ class LookupTest extends ApiTest
*/
public function testApiUsersLookupWithUserId()
{
- $lookup = new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $respone = $lookup->run(['user_id' => static::OTHER_USER['id']]);
+ $respone = (new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run([
+ 'user_id' => static::OTHER_USER['id']
+ ]);
$json = $this->toJson($respone);
diff --git a/tests/src/Module/Api/Twitter/Users/SearchTest.php b/tests/src/Module/Api/Twitter/Users/SearchTest.php
index 4fee774dac..c88999e459 100644
--- a/tests/src/Module/Api/Twitter/Users/SearchTest.php
+++ b/tests/src/Module/Api/Twitter/Users/SearchTest.php
@@ -18,8 +18,10 @@ class SearchTest extends ApiTest
*/
public function testApiUsersSearch()
{
- $search = new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $respone = $search->run(['q' => static::OTHER_USER['name']]);
+ $respone = (new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run([
+ 'q' => static::OTHER_USER['name']
+ ]);
$json = $this->toJson($respone);
@@ -33,8 +35,11 @@ class SearchTest extends ApiTest
*/
public function testApiUsersSearchWithXml()
{
- $search = new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_XML]);
- $respone = $search->run(['q' => static::OTHER_USER['name']]);
+ $respone = (new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
+ 'extension' => ICanCreateResponses::TYPE_XML
+ ]))->run([
+ 'q' => static::OTHER_USER['name']
+ ]);
self::assertXml((string)$respone->getBody(), 'users');
}
@@ -48,7 +53,7 @@ class SearchTest extends ApiTest
{
$this->expectException(BadRequestException::class);
- $search = new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $search->run();
+ (new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
}
}
diff --git a/tests/src/Module/Api/Twitter/Users/ShowTest.php b/tests/src/Module/Api/Twitter/Users/ShowTest.php
index 975bf6d8f1..dd63c3e519 100644
--- a/tests/src/Module/Api/Twitter/Users/ShowTest.php
+++ b/tests/src/Module/Api/Twitter/Users/ShowTest.php
@@ -17,8 +17,8 @@ class ShowTest extends ApiTest
*/
public function testApiUsersShow()
{
- $show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]);
- $response = $show->run();
+ $response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
+ ->run();
$json = $this->toJson($response);
@@ -37,8 +37,9 @@ class ShowTest extends ApiTest
*/
public function testApiUsersShowWithXml()
{
- $show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_XML]);
- $response = $show->run();
+ $response = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
+ 'extension' => ICanCreateResponses::TYPE_XML
+ ]))->run();
self::assertEquals(ICanCreateResponses::TYPE_XML, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
diff --git a/tests/src/Module/NodeInfoTest.php b/tests/src/Module/NodeInfoTest.php
index 53a2926f9f..b80057e174 100644
--- a/tests/src/Module/NodeInfoTest.php
+++ b/tests/src/Module/NodeInfoTest.php
@@ -14,10 +14,8 @@ class NodeInfoTest extends FixtureTest
{
public function testNodeInfo110()
{
- $response = new Response();
-
- $nodeinfo = new NodeInfo110(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), $response, DI::config(), []);
- $response = $nodeinfo->run();
+ $response = (new NodeInfo110(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), DI::config(), []))
+ ->run();
self::assertJson($response->getBody());
self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
@@ -37,10 +35,8 @@ class NodeInfoTest extends FixtureTest
public function testNodeInfo120()
{
- $response = new Response();
-
- $nodeinfo = new NodeInfo120(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), $response, DI::config(), []);
- $response = $nodeinfo->run();
+ $response = (new NodeInfo120(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), DI::config(), []))
+ ->run();
self::assertJson($response->getBody());
self::assertEquals(['Content-type' => ['application/json; charset=utf-8'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
@@ -59,10 +55,8 @@ class NodeInfoTest extends FixtureTest
public function testNodeInfo210()
{
- $response = new Response();
-
- $nodeinfo = new NodeInfo210(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), $response, DI::config(), []);
- $response = $nodeinfo->run();
+ $response = (new NodeInfo210(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), DI::config(), []))
+ ->run();
self::assertJson($response->getBody());
self::assertEquals(['Content-type' => ['application/json; charset=utf-8'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());