]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/App/ModuleTest.php
Replaced most "api_get_user" calls with newer BaseApi calls
[friendica.git] / tests / src / App / ModuleTest.php
index a24608eb02e18b47754d4aa43f354c998e50ef4c..c5d4e11faa3f98d43b5aeb91a831bae545f35a4a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
 namespace Friendica\Test\src\App;
 
 use Friendica\App;
-use Friendica\Core\Cache\ICache;
-use Friendica\Core\Config\IConfig;
+use Friendica\Core\Cache\Capability\ICanCache;
+use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\L10n;
+use Friendica\Core\Lock\Capability\ICanLock;
 use Friendica\LegacyModule;
 use Friendica\Module\HTTPException\PageNotFound;
 use Friendica\Module\WellKnown\HostMeta;
 use Friendica\Test\DatabaseTest;
+use Mockery;
 
 class ModuleTest extends DatabaseTest
 {
@@ -142,10 +144,8 @@ class ModuleTest extends DatabaseTest
                        ],
                        'legacy'  => [
                                'assert'  => LegacyModule::class,
-                               // API is one of the last modules to switch from legacy to new BaseModule
-                               // so this should be a stable test case until we completely switch ;-)
-                               'name'    => 'api',
-                               'command' => 'api/test/it',
+                               'name'    => 'display',
+                               'command' => 'display/test/it',
                                'privAdd' => false,
                        ],
                        'new'     => [
@@ -170,18 +170,22 @@ class ModuleTest extends DatabaseTest
         */
        public function testModuleClass($assert, string $name, string $command, bool $privAdd)
        {
-               $config = \Mockery::mock(IConfig::class);
+               $config = Mockery::mock(IManageConfigValues::class);
                $config->shouldReceive('get')->with('config', 'private_addons', false)->andReturn($privAdd)->atMost()->once();
 
-               $l10n = \Mockery::mock(L10n::class);
+               $l10n = Mockery::mock(L10n::class);
                $l10n->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
 
-               $cache = \Mockery::mock(ICache::class);
+               $cache = Mockery::mock(ICanCache::class);
                $cache->shouldReceive('get')->with('routerDispatchData')->andReturn('')->atMost()->once();
                $cache->shouldReceive('get')->with('lastRoutesFileModifiedTime')->andReturn('')->atMost()->once();
                $cache->shouldReceive('set')->withAnyArgs()->andReturn(false)->atMost()->twice();
 
-               $router = (new App\Router([], __DIR__ . '/../../../static/routes.config.php', $l10n, $cache));
+               $lock = Mockery::mock(ICanLock::class);
+               $lock->shouldReceive('acquire')->andReturn(true);
+               $lock->shouldReceive('isLocked')->andReturn(false);
+
+               $router = (new App\Router([], __DIR__ . '/../../../static/routes.config.php', $l10n, $cache, $lock));
 
                $module = (new App\Module($name))->determineClass(new App\Arguments('', $command), $router, $config);