Revert "Replace Module::init() with Constructors"

This commit is contained in:
Hypolite Petovan 2021-11-19 07:23:23 -05:00 committed by GitHub
parent 0b6e0566d7
commit 89d6c89b67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 921 additions and 1225 deletions

View file

@ -67,7 +67,7 @@ class NotificationTest extends ApiTest
</notes>
XML;
$notification = new Notification(DI::l10n(), ['extension' => 'xml']);
$notification = new Notification(['extension' => 'xml']);
$notification->rawContent();
self::assertXmlStringEqualsXmlString($assertXml, ApiResponseDouble::getOutput());
@ -75,7 +75,7 @@ XML;
public function testWithJsonResult()
{
$notification = new Notification(DI::l10n(),['parameter' => 'json']);
$notification = new Notification(['parameter' => 'json']);
$notification->rawContent();
$result = json_encode(ApiResponseDouble::getOutput());

View file

@ -21,7 +21,6 @@
namespace Friendica\Test\src\Module\Api\Friendica\Photo;
use Friendica\DI;
use Friendica\Module\Api\Friendica\Photo\Delete;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Test\src\Module\Api\ApiTest;
@ -31,7 +30,7 @@ class DeleteTest extends ApiTest
public function testEmpty()
{
$this->expectException(BadRequestException::class);
(new Delete(DI::l10n()))->rawContent();
(new Delete())->rawContent();
}
public function testWithoutAuthenticatedUser()
@ -42,7 +41,7 @@ class DeleteTest extends ApiTest
public function testWrong()
{
$this->expectException(BadRequestException::class);
(new Delete(DI::l10n(), ['photo_id' => 1]))->rawContent();
(new Delete(['photo_id' => 1]))->rawContent();
}
public function testWithCorrectPhotoId()

View file

@ -21,7 +21,6 @@
namespace Friendica\Test\src\Module\Api\Friendica\Photoalbum;
use Friendica\DI;
use Friendica\Module\Api\Friendica\Photoalbum\Delete;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Test\src\Module\Api\ApiTest;
@ -31,13 +30,13 @@ class DeleteTest extends ApiTest
public function testEmpty()
{
$this->expectException(BadRequestException::class);
(new Delete(DI::l10n()))->rawContent();
(new Delete())->rawContent();
}
public function testWrong()
{
$this->expectException(BadRequestException::class);
(new Delete(DI::l10n(), ['album' => 'album_name']))->rawContent();
(new Delete(['album' => 'album_name']))->rawContent();
}
public function testValid()

View file

@ -21,7 +21,6 @@
namespace Friendica\Test\src\Module\Api\Friendica\Photoalbum;
use Friendica\DI;
use Friendica\Module\Api\Friendica\Photoalbum\Update;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Test\src\Module\Api\ApiTest;
@ -31,19 +30,19 @@ class UpdateTest extends ApiTest
public function testEmpty()
{
$this->expectException(BadRequestException::class);
(new Update(DI::l10n()))->rawContent();
(new Update())->rawContent();
}
public function testTooFewArgs()
{
$this->expectException(BadRequestException::class);
(new Update(DI::l10n(), ['album' => 'album_name']))->rawContent();
(new Update(['album' => 'album_name']))->rawContent();
}
public function testWrongUpdate()
{
$this->expectException(BadRequestException::class);
(new Update(DI::l10n(), ['album' => 'album_name', 'album_new' => 'album_name']))->rawContent();
(new Update(['album' => 'album_name', 'album_new' => 'album_name']))->rawContent();
}
public function testWithoutAuthenticatedUser()

View file

@ -2,7 +2,6 @@
namespace Friendica\Test\src\Module\Api\GnuSocial\GnuSocial;
use Friendica\DI;
use Friendica\Module\Api\GNUSocial\GNUSocial\Version;
use Friendica\Test\src\Module\Api\ApiTest;
use Friendica\Test\Util\ApiResponseDouble;
@ -11,7 +10,7 @@ class VersionTest extends ApiTest
{
public function test()
{
$version = new Version(DI::l10n(), ['extension' => 'json']);
$version = new Version(['extension' => 'json']);
$version->rawContent();
$result = json_decode(ApiResponseDouble::getOutput());

View file

@ -2,7 +2,6 @@
namespace Friendica\Test\src\Module\Api\GnuSocial\Help;
use Friendica\DI;
use Friendica\Module\Api\GNUSocial\Help\Test;
use Friendica\Test\src\Module\Api\ApiTest;
use Friendica\Test\Util\ApiResponseDouble;
@ -11,7 +10,7 @@ class TestTest extends ApiTest
{
public function testJson()
{
$test = new Test(DI::l10n(), ['extension' => 'json']);
$test = new Test(['extension' => 'json']);
$test->rawContent();
self::assertEquals('"ok"', ApiResponseDouble::getOutput());
@ -19,7 +18,7 @@ class TestTest extends ApiTest
public function testXml()
{
$test = new Test(DI::l10n(), ['extension' => 'xml']);
$test = new Test(['extension' => 'xml']);
$test->rawContent();
self::assertxml(ApiResponseDouble::getOutput(), 'ok');

View file

@ -2,7 +2,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Account;
use Friendica\DI;
use Friendica\Module\Api\Twitter\Account\RateLimitStatus;
use Friendica\Test\src\Module\Api\ApiTest;
use Friendica\Test\Util\ApiResponseDouble;
@ -11,7 +10,7 @@ class RateLimitStatusTest extends ApiTest
{
public function testWithJson()
{
$rateLimitStatus = new RateLimitStatus(DI::l10n(), ['extension' => 'json']);
$rateLimitStatus = new RateLimitStatus(['extension' => 'json']);
$rateLimitStatus->rawContent();
$result = json_decode(ApiResponseDouble::getOutput());
@ -23,7 +22,7 @@ class RateLimitStatusTest extends ApiTest
public function testWithXml()
{
$rateLimitStatus = new RateLimitStatus(DI::l10n(),['extension' => 'xml']);
$rateLimitStatus = new RateLimitStatus(['extension' => 'xml']);
$rateLimitStatus->rawContent();
self::assertXml(ApiResponseDouble::getOutput(), 'hash');

View file

@ -2,7 +2,6 @@
namespace Friendica\Test\src\Module\Api\Twitter;
use Friendica\DI;
use Friendica\Module\Api\Twitter\SavedSearches;
use Friendica\Test\src\Module\Api\ApiTest;
use Friendica\Test\Util\ApiResponseDouble;
@ -11,7 +10,7 @@ class SavedSearchesTest extends ApiTest
{
public function test()
{
$savedSearch = new SavedSearches(DI::l10n(), ['extension' => 'json']);
$savedSearch = new SavedSearches(['extension' => 'json']);
$savedSearch->rawContent();
$result = json_decode(ApiResponseDouble::getOutput());