]> git.mxchange.org Git - friendica.git/commitdiff
Fix tests
authorPhilipp <admin@philipp.info>
Wed, 17 Nov 2021 21:21:03 +0000 (22:21 +0100)
committerPhilipp <admin@philipp.info>
Wed, 17 Nov 2021 21:21:03 +0000 (22:21 +0100)
tests/src/App/ModuleControllerTest.php
tests/src/Module/Api/Friendica/NotificationTest.php
tests/src/Module/Api/Friendica/Photo/DeleteTest.php
tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php
tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php
tests/src/Module/Api/GnuSocial/GnuSocial/VersionTest.php
tests/src/Module/Api/GnuSocial/Help/TestTest.php
tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php
tests/src/Module/Api/Twitter/SavedSearchesTest.php

index 13ef16a6d4f7a0f22ea4ceace0da068cfec1edb8..4e3983adde40b90d8b2e2ef4e1e3b739ba55d338 100644 (file)
@@ -54,7 +54,7 @@ class ModuleControllerTest extends DatabaseTest
                self::assertModule([
                        'isBackend' => false,
                        'name'      => App\ModuleController::DEFAULT,
-                       'class'     => new $defaultClass(),
+                       'class'     => null,
                ], $module);
        }
 
@@ -146,28 +146,28 @@ class ModuleControllerTest extends DatabaseTest
                                'name'    => App\ModuleController::DEFAULT,
                                'command' => App\ModuleController::DEFAULT,
                                'privAdd' => false,
-                               'args'    => [],
+                               'args'    => [Mockery::mock(L10n::class)],
                        ],
                        'legacy'  => [
                                'assert'  => LegacyModule::class,
                                'name'    => 'display',
                                'command' => 'display/test/it',
                                'privAdd' => false,
-                               'args'    => [__DIR__ . '/../../datasets/legacy/legacy.php'],
+                               'args'    => [Mockery::mock(L10n::class), __DIR__ . '/../../datasets/legacy/legacy.php'],
                        ],
                        'new'     => [
                                'assert'  => HostMeta::class,
                                'not_required',
                                'command' => '.well-known/host-meta',
                                'privAdd' => false,
-                               'args'    => [],
+                               'args'    => [Mockery::mock(L10n::class)],
                        ],
                        '404'     => [
                                'assert'  => PageNotFound::class,
                                'name'    => 'invalid',
                                'command' => 'invalid',
                                'privAdd' => false,
-                               'args'    => [],
+                               'args'    => [Mockery::mock(L10n::class)],
                        ]
                ];
        }
index 7f1fd701fab9b8d20422e51aa2a072528a5418e1..125e7d63d0e03700ba1c1248e0144c554296be27 100644 (file)
@@ -67,7 +67,7 @@ class NotificationTest extends ApiTest
 </notes>
 XML;
 
-               $notification = new Notification(['extension' => 'xml']);
+               $notification = new Notification(DI::l10n(), ['extension' => 'xml']);
                $notification->rawContent();
 
                self::assertXmlStringEqualsXmlString($assertXml, ApiResponseDouble::getOutput());
@@ -75,7 +75,7 @@ XML;
 
        public function testWithJsonResult()
        {
-               $notification = new Notification(['parameter' => 'json']);
+               $notification = new Notification(DI::l10n(),['parameter' => 'json']);
                $notification->rawContent();
 
                $result = json_encode(ApiResponseDouble::getOutput());
index 5581c9cc2e6be05fd7fbfe4d94c41a380a4ac254..0958110115d14d2eaf72bb1d66cb77dcda049ddb 100644 (file)
@@ -21,6 +21,7 @@
 
 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;
@@ -30,7 +31,7 @@ class DeleteTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               (new Delete())->rawContent();
+               (new Delete(DI::l10n()))->rawContent();
        }
 
        public function testWithoutAuthenticatedUser()
@@ -41,7 +42,7 @@ class DeleteTest extends ApiTest
        public function testWrong()
        {
                $this->expectException(BadRequestException::class);
-               (new Delete(['photo_id' => 1]))->rawContent();
+               (new Delete(DI::l10n(), ['photo_id' => 1]))->rawContent();
        }
 
        public function testWithCorrectPhotoId()
index 6ee3c5e7b5bcd474f9f341e961bb60914c554230..aabd7e581c95b9336ad24e572c3402ac092d3386 100644 (file)
@@ -21,6 +21,7 @@
 
 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;
@@ -30,13 +31,13 @@ class DeleteTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               (new Delete())->rawContent();
+               (new Delete(DI::l10n()))->rawContent();
        }
 
        public function testWrong()
        {
                $this->expectException(BadRequestException::class);
-               (new Delete(['album' => 'album_name']))->rawContent();
+               (new Delete(DI::l10n(), ['album' => 'album_name']))->rawContent();
        }
 
        public function testValid()
index c7d65cb16bcdfe4050719684bb68845ce766562e..51414302fa52e3f38b4faf0d0956a489f1d6acde 100644 (file)
@@ -21,6 +21,7 @@
 
 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;
@@ -30,19 +31,19 @@ class UpdateTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               (new Update())->rawContent();
+               (new Update(DI::l10n()))->rawContent();
        }
 
        public function testTooFewArgs()
        {
                $this->expectException(BadRequestException::class);
-               (new Update(['album' => 'album_name']))->rawContent();
+               (new Update(DI::l10n(), ['album' => 'album_name']))->rawContent();
        }
 
        public function testWrongUpdate()
        {
                $this->expectException(BadRequestException::class);
-               (new Update(['album' => 'album_name', 'album_new' => 'album_name']))->rawContent();
+               (new Update(DI::l10n(), ['album' => 'album_name', 'album_new' => 'album_name']))->rawContent();
        }
 
        public function testWithoutAuthenticatedUser()
index a819a7a1e6c3c26949a0a6bbe5c7a24c1cefe353..448f6ce1453c91bf5ba77d0d2ab3b413a0e80ab3 100644 (file)
@@ -2,6 +2,7 @@
 
 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;
@@ -10,7 +11,7 @@ class VersionTest extends ApiTest
 {
        public function test()
        {
-               $version = new Version(['extension' => 'json']);
+               $version = new Version(DI::l10n(), ['extension' => 'json']);
                $version->rawContent();
 
                $result = json_decode(ApiResponseDouble::getOutput());
index c624ca0326fcd8b2aea79285c0cbc58bd816dab1..40d8e9750e1e79eea305ccd267d879aacb3edba4 100644 (file)
@@ -2,6 +2,7 @@
 
 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;
@@ -10,7 +11,7 @@ class TestTest extends ApiTest
 {
        public function testJson()
        {
-               $test = new Test(['extension' => 'json']);
+               $test = new Test(DI::l10n(), ['extension' => 'json']);
                $test->rawContent();
 
                self::assertEquals('"ok"', ApiResponseDouble::getOutput());
@@ -18,7 +19,7 @@ class TestTest extends ApiTest
 
        public function testXml()
        {
-               $test = new Test(['extension' => 'xml']);
+               $test = new Test(DI::l10n(), ['extension' => 'xml']);
                $test->rawContent();
 
                self::assertxml(ApiResponseDouble::getOutput(), 'ok');
index 3a84324af53774d52b8dc9360bd8f06941895d50..93d76933ba6c40ee0c8cfbc00ae06b76c5d882c8 100644 (file)
@@ -2,6 +2,7 @@
 
 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;
@@ -10,7 +11,7 @@ class RateLimitStatusTest extends ApiTest
 {
        public function testWithJson()
        {
-               $rateLimitStatus = new RateLimitStatus(['extension' => 'json']);
+               $rateLimitStatus = new RateLimitStatus(DI::l10n(), ['extension' => 'json']);
                $rateLimitStatus->rawContent();
 
                $result = json_decode(ApiResponseDouble::getOutput());
@@ -22,7 +23,7 @@ class RateLimitStatusTest extends ApiTest
 
        public function testWithXml()
        {
-               $rateLimitStatus = new RateLimitStatus(['extension' => 'xml']);
+               $rateLimitStatus = new RateLimitStatus(DI::l10n(),['extension' => 'xml']);
                $rateLimitStatus->rawContent();
 
                self::assertXml(ApiResponseDouble::getOutput(), 'hash');
index fc0f80467bda5064cd0e324d1c40373ba5a3bce3..8e066d4bad93ed70cf826b20646936da38d29f18 100644 (file)
@@ -2,6 +2,7 @@
 
 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;
@@ -10,7 +11,7 @@ class SavedSearchesTest extends ApiTest
 {
        public function test()
        {
-               $savedSearch = new SavedSearches(['extension' => 'json']);
+               $savedSearch = new SavedSearches(DI::l10n(), ['extension' => 'json']);
                $savedSearch->rawContent();
 
                $result = json_decode(ApiResponseDouble::getOutput());