<?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
{
],
'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' => [
*/
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);