Add feedback - avoid intermediate variables
This commit is contained in:
parent
adf0d7bc95
commit
301ac83ebf
|
@ -17,8 +17,8 @@ class ActivitiesTest extends FixtureTest
|
||||||
{
|
{
|
||||||
$item = ['uid' => 0, 'uri-id' => 1];
|
$item = ['uid' => 0, 'uri-id' => 1];
|
||||||
|
|
||||||
$friendicaActivitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
|
$result = (new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser()))
|
||||||
$result = $friendicaActivitiesFac->createFromUriId($item['uri-id'], $item['uid']);
|
->createFromUriId($item['uri-id'], $item['uid']);
|
||||||
|
|
||||||
self::assertArrayHasKey('like', $result);
|
self::assertArrayHasKey('like', $result);
|
||||||
self::assertArrayHasKey('dislike', $result);
|
self::assertArrayHasKey('dislike', $result);
|
||||||
|
@ -36,8 +36,8 @@ class ActivitiesTest extends FixtureTest
|
||||||
{
|
{
|
||||||
$item = ['uid' => 0, 'uri-id' => 1];
|
$item = ['uid' => 0, 'uri-id' => 1];
|
||||||
|
|
||||||
$friendicaActivitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
|
$result = (new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser()))
|
||||||
$result = $friendicaActivitiesFac->createFromUriId($item['uri-id'], $item['uid'], 'xml');
|
->createFromUriId($item['uri-id'], $item['uid'], 'xml');
|
||||||
|
|
||||||
self::assertArrayHasKey('friendica:like', $result);
|
self::assertArrayHasKey('friendica:like', $result);
|
||||||
self::assertArrayHasKey('friendica:dislike', $result);
|
self::assertArrayHasKey('friendica:dislike', $result);
|
||||||
|
|
|
@ -20,9 +20,9 @@ class DirectMessageTest extends FixtureTest
|
||||||
$ids = DI::dba()->selectToArray('mail', ['id']);
|
$ids = DI::dba()->selectToArray('mail', ['id']);
|
||||||
$id = $ids[0]['id'];
|
$id = $ids[0]['id'];
|
||||||
|
|
||||||
$directMessageFactory = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$directMessage = (new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()))
|
||||||
$directMessageObj = $directMessageFactory->createFromMailId($id, ApiTest::SELF_USER['id']);
|
->createFromMailId($id, ApiTest::SELF_USER['id'])
|
||||||
$directMessage = $directMessageObj->toArray();
|
->toArray();
|
||||||
|
|
||||||
self::assertEquals('item_title' . "\n" . 'item_body', $directMessage['text']);
|
self::assertEquals('item_title' . "\n" . 'item_body', $directMessage['text']);
|
||||||
self::assertIsInt($directMessage['id']);
|
self::assertIsInt($directMessage['id']);
|
||||||
|
@ -43,9 +43,9 @@ class DirectMessageTest extends FixtureTest
|
||||||
$ids = DI::dba()->selectToArray('mail', ['id']);
|
$ids = DI::dba()->selectToArray('mail', ['id']);
|
||||||
$id = $ids[0]['id'];
|
$id = $ids[0]['id'];
|
||||||
|
|
||||||
$directMessageFactory = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$directMessage = (new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()))
|
||||||
$directMessageObj = $directMessageFactory->createFromMailId($id, ApiTest::SELF_USER['id'], 'html');
|
->createFromMailId($id, ApiTest::SELF_USER['id'], 'html')
|
||||||
$directMessage = $directMessageObj->toArray();
|
->toArray();
|
||||||
|
|
||||||
self::assertEquals('item_title', $directMessage['title']);
|
self::assertEquals('item_title', $directMessage['title']);
|
||||||
self::assertEquals('<strong>item_body</strong>', $directMessage['text']);
|
self::assertEquals('<strong>item_body</strong>', $directMessage['text']);
|
||||||
|
@ -62,9 +62,9 @@ class DirectMessageTest extends FixtureTest
|
||||||
$ids = DI::dba()->selectToArray('mail', ['id']);
|
$ids = DI::dba()->selectToArray('mail', ['id']);
|
||||||
$id = $ids[0]['id'];
|
$id = $ids[0]['id'];
|
||||||
|
|
||||||
$directMessageFactory = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$directMessage = (new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()))
|
||||||
$directMessageObj = $directMessageFactory->createFromMailId($id, ApiTest::SELF_USER['id'], 'plain');
|
->createFromMailId($id, ApiTest::SELF_USER['id'], 'plain')
|
||||||
$directMessage = $directMessageObj->toArray();
|
->toArray();
|
||||||
|
|
||||||
self::assertEquals('item_title', $directMessage['title']);
|
self::assertEquals('item_title', $directMessage['title']);
|
||||||
self::assertEquals('item_body', $directMessage['text']);
|
self::assertEquals('item_body', $directMessage['text']);
|
||||||
|
@ -84,9 +84,9 @@ class DirectMessageTest extends FixtureTest
|
||||||
$ids = DI::dba()->selectToArray('mail', ['id']);
|
$ids = DI::dba()->selectToArray('mail', ['id']);
|
||||||
$id = $ids[0]['id'];
|
$id = $ids[0]['id'];
|
||||||
|
|
||||||
$directMessageFactory = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$directMessage = (new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser()))
|
||||||
$directMessageObj = $directMessageFactory->createFromMailId($id, ApiTest::SELF_USER['id'], 'plain', $$GETUSEROBJECTS$$);
|
->createFromMailId($id, ApiTest::SELF_USER['id'], 'plain', $$GETUSEROBJECTS$$)
|
||||||
$directMessage = $directMessageObj->toArray();
|
->toArray();
|
||||||
|
|
||||||
self::assertTrue(!isset($directMessage['sender']));
|
self::assertTrue(!isset($directMessage['sender']));
|
||||||
self::assertTrue(!isset($directMessage['recipient']));
|
self::assertTrue(!isset($directMessage['recipient']));
|
||||||
|
|
|
@ -15,6 +15,24 @@ use Friendica\Test\src\Module\Api\ApiTest;
|
||||||
|
|
||||||
class StatusTest extends FixtureTest
|
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.
|
* Test the api_convert_item() function.
|
||||||
*
|
*
|
||||||
|
@ -22,16 +40,9 @@ class StatusTest extends FixtureTest
|
||||||
*/
|
*/
|
||||||
public function testApiConvertItem()
|
public function testApiConvertItem()
|
||||||
{
|
{
|
||||||
$hashTagFac = new Hashtag(DI::logger());
|
$status = $this->statusFactory
|
||||||
$mediaFac = new Media(DI::logger(), DI::baseUrl());
|
->createFromItemId(13, ApiTest::SELF_USER['id'])
|
||||||
$urlFac = new Url(DI::logger());
|
->toArray();
|
||||||
$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();
|
|
||||||
|
|
||||||
self::assertStringStartsWith('item_title', $status['text']);
|
self::assertStringStartsWith('item_title', $status['text']);
|
||||||
self::assertStringStartsWith('<h4>item_title</h4><br>perspiciatis impedit voluptatem', $status['friendica_html']);
|
self::assertStringStartsWith('<h4>item_title</h4><br>perspiciatis impedit voluptatem', $status['friendica_html']);
|
||||||
|
@ -90,16 +101,9 @@ class StatusTest extends FixtureTest
|
||||||
*/
|
*/
|
||||||
public function testApiGetEntititiesWithIncludeEntities()
|
public function testApiGetEntititiesWithIncludeEntities()
|
||||||
{
|
{
|
||||||
$hashTagFac = new Hashtag(DI::logger());
|
$status = $this->statusFactory
|
||||||
$mediaFac = new Media(DI::logger(), DI::baseUrl());
|
->createFromItemId(13, ApiTest::SELF_USER['id'], true)
|
||||||
$urlFac = new Url(DI::logger());
|
->toArray();
|
||||||
$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();
|
|
||||||
|
|
||||||
self::assertIsArray($status['entities']);
|
self::assertIsArray($status['entities']);
|
||||||
self::assertIsArray($status['extended_entities']);
|
self::assertIsArray($status['extended_entities']);
|
||||||
|
@ -114,19 +118,11 @@ class StatusTest extends FixtureTest
|
||||||
*/
|
*/
|
||||||
public function testApiFormatItems()
|
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']);
|
$posts = DI::dba()->selectToArray('post-view', ['uri-id']);
|
||||||
foreach ($posts as $item) {
|
foreach ($posts as $item) {
|
||||||
$statusObj = $statusFac->createFromUriId($item['uri-id'], ApiTest::SELF_USER['id']);
|
$status = $this->statusFactory
|
||||||
$status = $statusObj->toArray();
|
->createFromUriId($item['uri-id'], ApiTest::SELF_USER['id'])
|
||||||
|
->toArray();
|
||||||
|
|
||||||
self::assertIsInt($status['id']);
|
self::assertIsInt($status['id']);
|
||||||
self::assertIsString($status['text']);
|
self::assertIsString($status['text']);
|
||||||
|
|
|
@ -31,9 +31,9 @@ class UserTest extends FixtureTest
|
||||||
*/
|
*/
|
||||||
public function testApiGetUser()
|
public function testApiGetUser()
|
||||||
{
|
{
|
||||||
$userFactory = new User(DI::logger(), DI::twitterStatus());
|
$user = (new User(DI::logger(), DI::twitterStatus()))
|
||||||
$userObj = $userFactory->createFromUserId(ApiTest::SELF_USER['id']);
|
->createFromUserId(ApiTest::SELF_USER['id'])
|
||||||
$user = $userObj->toArray();
|
->toArray();
|
||||||
|
|
||||||
$this->assertSelfUser($user);
|
$this->assertSelfUser($user);
|
||||||
}
|
}
|
||||||
|
@ -114,9 +114,9 @@ class UserTest extends FixtureTest
|
||||||
*/
|
*/
|
||||||
public function testApiGetUserWithWrongGetId()
|
public function testApiGetUserWithWrongGetId()
|
||||||
{
|
{
|
||||||
$userFactory = new User(DI::logger(), DI::twitterStatus());
|
$user = (new User(DI::logger(), DI::twitterStatus()))
|
||||||
$userObj = $userFactory->createFromUserId(-1);
|
->createFromUserId(-1)
|
||||||
$user = $userObj->toArray();
|
->toArray();
|
||||||
|
|
||||||
self::assertEquals(0, $user['id']);
|
self::assertEquals(0, $user['id']);
|
||||||
self::assertEquals(0, $user['uid']);
|
self::assertEquals(0, $user['uid']);
|
||||||
|
|
|
@ -34,7 +34,8 @@ class SearchTest extends ApiTest
|
||||||
{
|
{
|
||||||
$directMessage = new DirectMessage(new NullLogger(), DI::dba(), DI::twitterUser());
|
$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);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -51,8 +52,10 @@ class SearchTest extends ApiTest
|
||||||
|
|
||||||
$directMessage = new DirectMessage(new NullLogger(), DI::dba(), DI::twitterUser());
|
$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 = (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']);
|
->run([
|
||||||
|
'searchstring' => 'item_body'
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -70,8 +73,10 @@ class SearchTest extends ApiTest
|
||||||
{
|
{
|
||||||
$directMessage = new DirectMessage(new NullLogger(), DI::dba(), DI::twitterUser());
|
$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 = (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']);
|
->run([
|
||||||
|
'searchstring' => 'test'
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -66,17 +66,20 @@ class NotificationTest extends ApiTest
|
||||||
</notes>
|
</notes>
|
||||||
XML;
|
XML;
|
||||||
|
|
||||||
$notification = new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
|
$response = (new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']))
|
||||||
$response = $notification->run();
|
->run();
|
||||||
|
|
||||||
self::assertXmlStringEqualsXmlString($assertXml, (string)$response->getBody());
|
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()
|
public function testWithJsonResult()
|
||||||
{
|
{
|
||||||
$notification = new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
|
$response = (new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
|
||||||
$response = $notification->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -88,6 +91,9 @@ XML;
|
||||||
self::assertIsString($note->msg);
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,10 @@ class DeleteTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
|
$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 = (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']);
|
->run([
|
||||||
|
'photo_id' => '709057080661a283a6aa598501504178'
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -63,8 +65,10 @@ class DeleteTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
|
$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 = (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']);
|
->run([
|
||||||
|
'photo_id' => '709057080661a283a6aa598501504178'
|
||||||
|
]);
|
||||||
|
|
||||||
$responseText = (string)$response->getBody();
|
$responseText = (string)$response->getBody();
|
||||||
|
|
||||||
|
|
|
@ -32,22 +32,28 @@ class DeleteTest extends ApiTest
|
||||||
public function testEmpty()
|
public function testEmpty()
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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()
|
public function testWrong()
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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()
|
public function testValidWithDelete()
|
||||||
{
|
{
|
||||||
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
|
$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 = (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']);
|
->run([
|
||||||
|
'album' => 'test_album']
|
||||||
|
);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -32,19 +32,27 @@ class UpdateTest extends ApiTest
|
||||||
public function testEmpty()
|
public function testEmpty()
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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()
|
public function testTooFewArgs()
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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()
|
public function testWrongUpdate()
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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()
|
public function testWithoutAuthenticatedUser()
|
||||||
|
@ -56,7 +64,11 @@ class UpdateTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->loadFixture(__DIR__ . '/../../../../../datasets/photo/photo.fixture.php', DI::dba());
|
$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);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ class ConfigTest extends ApiTest
|
||||||
{
|
{
|
||||||
DI::config()->set('system', 'ssl_policy', BaseURL::SSL_POLICY_FULL);
|
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 = (new Config(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$response = $config->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,13 @@ class VersionTest extends ApiTest
|
||||||
{
|
{
|
||||||
public function test()
|
public function test()
|
||||||
{
|
{
|
||||||
$version = new Version(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
|
$response = (new Version(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
|
||||||
$response = $version->run();
|
->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());
|
self::assertEquals('"0.9.7"', $response->getBody());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,21 +11,27 @@ class TestTest extends ApiTest
|
||||||
{
|
{
|
||||||
public function testJson()
|
public function testJson()
|
||||||
{
|
{
|
||||||
$test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
|
$response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
|
||||||
$response = $test->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$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);
|
self::assertEquals('ok', $json);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testXml()
|
public function testXml()
|
||||||
{
|
{
|
||||||
$test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
|
$response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']))
|
||||||
$response = $test->run();
|
->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');
|
self::assertxml($response->getBody(), 'ok');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ class VerifyCredentialsTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiAccountVerifyCredentials()
|
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 = (new VerifyCredentials(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$response = $verifyCredentials->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,15 @@ class RateLimitStatusTest extends ApiTest
|
||||||
{
|
{
|
||||||
public function testWithJson()
|
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 = (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();
|
->run();
|
||||||
|
|
||||||
$result = $this->toJson($response);
|
$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->remaining_hits);
|
||||||
self::assertEquals(150, $result->hourly_limit);
|
self::assertEquals(150, $result->hourly_limit);
|
||||||
self::assertIsInt($result->reset_time_in_seconds);
|
self::assertIsInt($result->reset_time_in_seconds);
|
||||||
|
@ -25,10 +28,13 @@ class RateLimitStatusTest extends ApiTest
|
||||||
|
|
||||||
public function testWithXml()
|
public function testWithXml()
|
||||||
{
|
{
|
||||||
$rateLimitStatus = new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
|
$response = (new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']))
|
||||||
$response = $rateLimitStatus->run();
|
->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');
|
self::assertXml($response->getBody(), 'hash');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,11 @@ class UpdateProfileTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiAccountUpdateProfile()
|
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 = (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']);
|
->run([
|
||||||
|
'name' => 'new_name',
|
||||||
|
'description' => 'new_description'
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ class ListsTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesFWithBlocks()
|
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 = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$response = $lists->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ class AllTest extends ApiTest
|
||||||
|
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ class ConversationTest extends ApiTest
|
||||||
{
|
{
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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([
|
->run([
|
||||||
'friendica_verbose' => true,
|
'friendica_verbose' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@ class DestroyTest extends ApiTest
|
||||||
public function testApiDirectMessagesDestroy()
|
public function testApiDirectMessagesDestroy()
|
||||||
{
|
{
|
||||||
$this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
|
$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()
|
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 = (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([
|
->run([
|
||||||
'friendica_verbose' => true,
|
'friendica_verbose' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -64,7 +65,10 @@ class DestroyTest extends ApiTest
|
||||||
public function testApiDirectMessagesDestroyWithId()
|
public function testApiDirectMessagesDestroyWithId()
|
||||||
{
|
{
|
||||||
$this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
|
$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()
|
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 = (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([
|
->run([
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
'friendica_parenturi' => 'parent_uri',
|
'friendica_parenturi' => 'parent_uri',
|
||||||
'friendica_verbose' => true,
|
'friendica_verbose' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -98,11 +102,11 @@ class DestroyTest extends ApiTest
|
||||||
$ids = DBA::selectToArray('mail', ['id']);
|
$ids = DBA::selectToArray('mail', ['id']);
|
||||||
$id = $ids[0]['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 = (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([
|
->run([
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'friendica_verbose' => true,
|
'friendica_verbose' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ class InboxTest extends ApiTest
|
||||||
|
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ class NewDMTest extends ApiTest
|
||||||
{
|
{
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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();
|
->run();
|
||||||
|
|
||||||
self::assertEmpty((string)$response->getBody());
|
self::assertEmpty((string)$response->getBody());
|
||||||
}
|
}
|
||||||
|
@ -51,11 +51,11 @@ class NewDMTest extends ApiTest
|
||||||
{
|
{
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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([
|
->run([
|
||||||
'text' => 'message_text',
|
'text' => 'message_text',
|
||||||
'user_id' => 43
|
'user_id' => 43
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -73,11 +73,11 @@ class NewDMTest extends ApiTest
|
||||||
|
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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([
|
->run([
|
||||||
'text' => 'message_text',
|
'text' => 'message_text',
|
||||||
'user_id' => 44
|
'user_id' => 44
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -97,12 +97,12 @@ class NewDMTest extends ApiTest
|
||||||
|
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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([
|
->run([
|
||||||
'text' => 'message_text',
|
'text' => 'message_text',
|
||||||
'user_id' => 44,
|
'user_id' => 44,
|
||||||
'title' => 'message_title',
|
'title' => 'message_title',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -123,12 +123,12 @@ class NewDMTest extends ApiTest
|
||||||
|
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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([
|
->run([
|
||||||
'text' => 'message_text',
|
'text' => 'message_text',
|
||||||
'user_id' => 44,
|
'user_id' => 44,
|
||||||
'title' => 'message_title',
|
'title' => 'message_title',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
self::assertXml((string)$response->getBody(), 'direct-messages');
|
self::assertXml((string)$response->getBody(), 'direct-messages');
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,10 @@ class SentTest extends ApiTest
|
||||||
{
|
{
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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([
|
->run([
|
||||||
'friendica_verbose' => true,
|
'friendica_verbose' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ class SentTest extends ApiTest
|
||||||
{
|
{
|
||||||
$directMessage = new DirectMessage(DI::logger(), DI::dba(), DI::twitterUser());
|
$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 = (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();
|
->run();
|
||||||
|
|
||||||
self::assertXml((string)$response->getBody(), 'direct-messages');
|
self::assertXml((string)$response->getBody(), 'direct-messages');
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ class CreateTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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]);
|
(new Create(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||||
$create->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,8 +31,10 @@ class CreateTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiFavoritesCreateDestroyWithCreateAction()
|
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 = (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]);
|
->run([
|
||||||
|
'id' => 3
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -46,8 +48,10 @@ class CreateTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiFavoritesCreateDestroyWithCreateActionAndRss()
|
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 = (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]);
|
->run([
|
||||||
|
'id' => 3
|
||||||
|
]);
|
||||||
|
|
||||||
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ class DestroyTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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]);
|
(new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||||
$destroy->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,8 +30,10 @@ class DestroyTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiFavoritesCreateDestroyWithDestroyAction()
|
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 = (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]);
|
->run([
|
||||||
|
'id' => 3
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@ class FavoritesTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiFavorites()
|
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 = (new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$response = $favorites->run([
|
->run([
|
||||||
'page' => -1,
|
'page' => -1,
|
||||||
'max_id' => 10,
|
'max_id' => 10,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -37,8 +37,9 @@ class FavoritesTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiFavoritesWithRss()
|
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 = (new Favorites(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
|
||||||
$response = $favorites->run();
|
'extension' => ICanCreateResponses::TYPE_RSS
|
||||||
|
]))->run();
|
||||||
|
|
||||||
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ class ListsTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesFWithFollowers()
|
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 = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$response = $lists->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ class ListsTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesFWithFriends()
|
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 = (new Lists(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$response = $lists->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ class IncomingTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiFriendshipsIncoming()
|
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 = (new Incoming(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$response = $lists->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ class StatusesTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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]);
|
(new Statuses(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$lists->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,8 +28,12 @@ class StatusesTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiListsStatusesWithListId()
|
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 = (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]);
|
->run([
|
||||||
|
'list_id' => 1,
|
||||||
|
'page' => -1,
|
||||||
|
'max_id' => 10
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -44,8 +48,10 @@ class StatusesTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiListsStatusesWithListIdAndRss()
|
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 = (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]);
|
->run([
|
||||||
|
'list_id' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
self::assertXml((string)$response->getBody());
|
self::assertXml((string)$response->getBody());
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,9 @@ class UploadTest extends ApiTest
|
||||||
public function testApiMediaUpload()
|
public function testApiMediaUpload()
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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);
|
$this->expectException(UnauthorizedException::class);
|
||||||
AuthTestConfig::$authenticated = false;
|
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'
|
'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);
|
$media = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ class SavedSearchesTest extends ApiTest
|
||||||
{
|
{
|
||||||
public function test()
|
public function test()
|
||||||
{
|
{
|
||||||
$savedSearch = new SavedSearches(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
|
$response = (new SavedSearches(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
|
||||||
$response = $savedSearch->run();
|
->run();
|
||||||
|
|
||||||
$result = $this->toJson($response);
|
$result = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ class DestroyTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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]);
|
(new Destroy(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||||
$destroy->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,8 +45,10 @@ class DestroyTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesDestroyWithId()
|
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 = (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]);
|
->run([
|
||||||
|
'id' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,10 @@ class MentionsTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesMentions()
|
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 = (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]);
|
->run([
|
||||||
|
'max_id' => 10
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -33,8 +35,10 @@ class MentionsTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesMentionsWithNegativePage()
|
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 = (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]);
|
->run([
|
||||||
|
'page' => -2
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -63,8 +67,10 @@ class MentionsTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesMentionsWithRss()
|
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 = (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]);
|
->run([
|
||||||
|
'page' => -2
|
||||||
|
]);
|
||||||
|
|
||||||
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,10 @@ class NetworkPublicTimelineTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesNetworkpublicTimeline()
|
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 = (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]);
|
->run([
|
||||||
|
'max_id' => 10
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -37,8 +39,10 @@ class NetworkPublicTimelineTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesNetworkpublicTimelineWithNegativePage()
|
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 = (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]);
|
->run([
|
||||||
|
'page' => -2
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -71,8 +75,11 @@ class NetworkPublicTimelineTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesNetworkpublicTimelineWithRss()
|
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 = (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]);
|
'extension' => ICanCreateResponses::TYPE_RSS
|
||||||
|
]))->run([
|
||||||
|
'page' => -2
|
||||||
|
]);
|
||||||
|
|
||||||
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ class RetweetTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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]);
|
(new Retweet(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||||
$retweet->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,8 +45,10 @@ class RetweetTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesRepeatWithId()
|
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 = (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]);
|
->run([
|
||||||
|
'id' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -60,8 +62,10 @@ class RetweetTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesRepeatWithSharedId()
|
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 = (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]);
|
->run([
|
||||||
|
'id' => 5
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,9 @@ class ShowTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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()
|
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 = (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]);
|
->run([
|
||||||
|
'id' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -46,8 +49,11 @@ class ShowTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesShowWithConversation()
|
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 = (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]);
|
->run([
|
||||||
|
'id' => 1,
|
||||||
|
'conversation' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$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 = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||||
$response = $show->run([
|
->run([
|
||||||
'status' => 'Status content #friendica',
|
'status' => 'Status content #friendica',
|
||||||
'in_reply_to_status_id' => 0,
|
'in_reply_to_status_id' => 0,
|
||||||
'lat' => 48,
|
'lat' => 48,
|
||||||
'long' => 7,
|
'long' => 7,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -50,10 +50,10 @@ class UpdateTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesUpdateWithHtml()
|
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 = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))
|
||||||
$response = $show->run([
|
->run([
|
||||||
'htmlstatus' => '<b>Status content</b>',
|
'htmlstatus' => '<b>Status content</b>',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,13 @@ class UserTimelineTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesUserTimeline()
|
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 = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
|
->run([
|
||||||
$response = $networkPublicTimeline->run([
|
'user_id' => 42,
|
||||||
'user_id' => 42,
|
'max_id' => 10,
|
||||||
'max_id' => 10,
|
'exclude_replies' => true,
|
||||||
'exclude_replies' => true,
|
'conversation_id' => 7,
|
||||||
'conversation_id' => 7,
|
]);
|
||||||
]);
|
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -43,12 +42,11 @@ class UserTimelineTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesUserTimelineWithNegativePage()
|
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 = (new UserTimeline(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
|
->run([
|
||||||
$response = $networkPublicTimeline->run([
|
'user_id' => 42,
|
||||||
'user_id' => 42,
|
'page' => -2,
|
||||||
'page' => -2,
|
]);
|
||||||
]);
|
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -67,9 +65,9 @@ class UserTimelineTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiStatusesUserTimelineWithRss()
|
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 = (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();
|
]))->run();
|
||||||
|
|
||||||
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
self::assertEquals(ICanCreateResponses::TYPE_RSS, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ class LookupTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->expectException(NotFoundException::class);
|
$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]);
|
(new Lookup(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$lookup->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,8 +30,10 @@ class LookupTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiUsersLookupWithUserId()
|
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 = (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']]);
|
->run([
|
||||||
|
'user_id' => static::OTHER_USER['id']
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($respone);
|
$json = $this->toJson($respone);
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,10 @@ class SearchTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiUsersSearch()
|
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 = (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']]);
|
->run([
|
||||||
|
'q' => static::OTHER_USER['name']
|
||||||
|
]);
|
||||||
|
|
||||||
$json = $this->toJson($respone);
|
$json = $this->toJson($respone);
|
||||||
|
|
||||||
|
@ -33,8 +35,11 @@ class SearchTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiUsersSearchWithXml()
|
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 = (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']]);
|
'extension' => ICanCreateResponses::TYPE_XML
|
||||||
|
]))->run([
|
||||||
|
'q' => static::OTHER_USER['name']
|
||||||
|
]);
|
||||||
|
|
||||||
self::assertXml((string)$respone->getBody(), 'users');
|
self::assertXml((string)$respone->getBody(), 'users');
|
||||||
}
|
}
|
||||||
|
@ -48,7 +53,7 @@ class SearchTest extends ApiTest
|
||||||
{
|
{
|
||||||
$this->expectException(BadRequestException::class);
|
$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]);
|
(new Search(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$search->run();
|
->run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ class ShowTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiUsersShow()
|
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 = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]))
|
||||||
$response = $show->run();
|
->run();
|
||||||
|
|
||||||
$json = $this->toJson($response);
|
$json = $this->toJson($response);
|
||||||
|
|
||||||
|
@ -37,8 +37,9 @@ class ShowTest extends ApiTest
|
||||||
*/
|
*/
|
||||||
public function testApiUsersShowWithXml()
|
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 = (new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], [
|
||||||
$response = $show->run();
|
'extension' => ICanCreateResponses::TYPE_XML
|
||||||
|
]))->run();
|
||||||
|
|
||||||
self::assertEquals(ICanCreateResponses::TYPE_XML, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
self::assertEquals(ICanCreateResponses::TYPE_XML, $response->getHeaderLine(ICanCreateResponses::X_HEADER));
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,8 @@ class NodeInfoTest extends FixtureTest
|
||||||
{
|
{
|
||||||
public function testNodeInfo110()
|
public function testNodeInfo110()
|
||||||
{
|
{
|
||||||
$response = new Response();
|
$response = (new NodeInfo110(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), DI::config(), []))
|
||||||
|
->run();
|
||||||
$nodeinfo = new NodeInfo110(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), $response, DI::config(), []);
|
|
||||||
$response = $nodeinfo->run();
|
|
||||||
|
|
||||||
self::assertJson($response->getBody());
|
self::assertJson($response->getBody());
|
||||||
self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
|
self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
|
||||||
|
@ -37,10 +35,8 @@ class NodeInfoTest extends FixtureTest
|
||||||
|
|
||||||
public function testNodeInfo120()
|
public function testNodeInfo120()
|
||||||
{
|
{
|
||||||
$response = new Response();
|
$response = (new NodeInfo120(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), DI::config(), []))
|
||||||
|
->run();
|
||||||
$nodeinfo = new NodeInfo120(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), $response, DI::config(), []);
|
|
||||||
$response = $nodeinfo->run();
|
|
||||||
|
|
||||||
self::assertJson($response->getBody());
|
self::assertJson($response->getBody());
|
||||||
self::assertEquals(['Content-type' => ['application/json; charset=utf-8'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
|
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()
|
public function testNodeInfo210()
|
||||||
{
|
{
|
||||||
$response = new Response();
|
$response = (new NodeInfo210(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), DI::config(), []))
|
||||||
|
->run();
|
||||||
$nodeinfo = new NodeInfo210(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), $response, DI::config(), []);
|
|
||||||
$response = $nodeinfo->run();
|
|
||||||
|
|
||||||
self::assertJson($response->getBody());
|
self::assertJson($response->getBody());
|
||||||
self::assertEquals(['Content-type' => ['application/json; charset=utf-8'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
|
self::assertEquals(['Content-type' => ['application/json; charset=utf-8'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user