mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Inherit ApiResponse
from Response
This commit is contained in:
parent
561aba18e3
commit
537b74f307
46 changed files with 326 additions and 277 deletions
|
@ -23,9 +23,7 @@ namespace Friendica\Test\src\Module\Api\Friendica;
|
|||
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Api\Friendica\Notification;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
use Friendica\Test\src\Module\Api\ApiTest;
|
||||
use Friendica\Test\Util\ApiResponseDouble;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
|
@ -67,19 +65,17 @@ class NotificationTest extends ApiTest
|
|||
</notes>
|
||||
XML;
|
||||
|
||||
$notification = new Notification(DI::l10n(), ['extension' => 'xml']);
|
||||
$notification->rawContent();
|
||||
$notification = new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
|
||||
$response = $notification->run();
|
||||
|
||||
self::assertXmlStringEqualsXmlString($assertXml, ApiResponseDouble::getOutput());
|
||||
self::assertXmlStringEqualsXmlString($assertXml, $response->getContent());
|
||||
}
|
||||
|
||||
public function testWithJsonResult()
|
||||
{
|
||||
$notification = new Notification(DI::l10n(),['parameter' => 'json']);
|
||||
$notification->rawContent();
|
||||
$notification = new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
|
||||
$response = $notification->run();
|
||||
|
||||
$result = json_encode(ApiResponseDouble::getOutput());
|
||||
|
||||
self::assertJson($result);
|
||||
self::assertJson($response->getContent());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class DeleteTest extends ApiTest
|
|||
public function testEmpty()
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
(new Delete(DI::l10n()))->rawContent();
|
||||
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run();
|
||||
}
|
||||
|
||||
public function testWithoutAuthenticatedUser()
|
||||
|
@ -42,7 +42,7 @@ class DeleteTest extends ApiTest
|
|||
public function testWrong()
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
(new Delete(DI::l10n(), ['photo_id' => 1]))->rawContent();
|
||||
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['photo_id' => 1]);
|
||||
}
|
||||
|
||||
public function testWithCorrectPhotoId()
|
||||
|
|
|
@ -31,13 +31,14 @@ class DeleteTest extends ApiTest
|
|||
public function testEmpty()
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
(new Delete(DI::l10n()))->rawContent();
|
||||
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run();
|
||||
|
||||
}
|
||||
|
||||
public function testWrong()
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
(new Delete(DI::l10n(), ['album' => 'album_name']))->rawContent();
|
||||
(new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['album' => 'album_name']);
|
||||
}
|
||||
|
||||
public function testValid()
|
||||
|
|
|
@ -31,19 +31,19 @@ class UpdateTest extends ApiTest
|
|||
public function testEmpty()
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
(new Update(DI::l10n()))->rawContent();
|
||||
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run();
|
||||
}
|
||||
|
||||
public function testTooFewArgs()
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
(new Update(DI::l10n(), ['album' => 'album_name']))->rawContent();
|
||||
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['album' => 'album_name']);
|
||||
}
|
||||
|
||||
public function testWrongUpdate()
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
(new Update(DI::l10n(), ['album' => 'album_name', 'album_new' => 'album_name']))->rawContent();
|
||||
(new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['album' => 'album_name', 'album_new' => 'album_name']);
|
||||
}
|
||||
|
||||
public function testWithoutAuthenticatedUser()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue