Fix Legacy test
This commit is contained in:
parent
d32f8e5285
commit
8bf61848f9
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function legacy_init()
|
||||||
|
{
|
||||||
|
// I don't do nothing
|
||||||
|
}
|
|
@ -146,24 +146,28 @@ class ModuleTest extends DatabaseTest
|
||||||
'name' => App\Module::DEFAULT,
|
'name' => App\Module::DEFAULT,
|
||||||
'command' => App\Module::DEFAULT,
|
'command' => App\Module::DEFAULT,
|
||||||
'privAdd' => false,
|
'privAdd' => false,
|
||||||
|
'args' => [],
|
||||||
],
|
],
|
||||||
'legacy' => [
|
'legacy' => [
|
||||||
'assert' => LegacyModule::class,
|
'assert' => LegacyModule::class,
|
||||||
'name' => 'display',
|
'name' => 'display',
|
||||||
'command' => 'display/test/it',
|
'command' => 'display/test/it',
|
||||||
'privAdd' => false,
|
'privAdd' => false,
|
||||||
|
'args' => [__DIR__ . '/../../datasets/legacy/legacy.php'],
|
||||||
],
|
],
|
||||||
'new' => [
|
'new' => [
|
||||||
'assert' => HostMeta::class,
|
'assert' => HostMeta::class,
|
||||||
'not_required',
|
'not_required',
|
||||||
'command' => '.well-known/host-meta',
|
'command' => '.well-known/host-meta',
|
||||||
'privAdd' => false,
|
'privAdd' => false,
|
||||||
|
'args' => [],
|
||||||
],
|
],
|
||||||
'404' => [
|
'404' => [
|
||||||
'assert' => PageNotFound::class,
|
'assert' => PageNotFound::class,
|
||||||
'name' => 'invalid',
|
'name' => 'invalid',
|
||||||
'command' => 'invalid',
|
'command' => 'invalid',
|
||||||
'privAdd' => false,
|
'privAdd' => false,
|
||||||
|
'args' => [],
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -173,7 +177,7 @@ class ModuleTest extends DatabaseTest
|
||||||
*
|
*
|
||||||
* @dataProvider dataModuleClass
|
* @dataProvider dataModuleClass
|
||||||
*/
|
*/
|
||||||
public function testModuleClass($assert, string $name, string $command, bool $privAdd)
|
public function testModuleClass($assert, string $name, string $command, bool $privAdd, array $args)
|
||||||
{
|
{
|
||||||
$config = Mockery::mock(IManageConfigValues::class);
|
$config = Mockery::mock(IManageConfigValues::class);
|
||||||
$config->shouldReceive('get')->with('config', 'private_addons', false)->andReturn($privAdd)->atMost()->once();
|
$config->shouldReceive('get')->with('config', 'private_addons', false)->andReturn($privAdd)->atMost()->once();
|
||||||
|
@ -193,7 +197,8 @@ class ModuleTest extends DatabaseTest
|
||||||
$router = (new App\Router([], __DIR__ . '/../../../static/routes.config.php', $l10n, $cache, $lock));
|
$router = (new App\Router([], __DIR__ . '/../../../static/routes.config.php', $l10n, $cache, $lock));
|
||||||
|
|
||||||
$dice = Mockery::mock(Dice::class);
|
$dice = Mockery::mock(Dice::class);
|
||||||
$dice->shouldReceive('create')->andReturn(new $assert());
|
|
||||||
|
$dice->shouldReceive('create')->andReturn(new $assert(...$args));
|
||||||
|
|
||||||
$module = (new App\Module($name))->determineClass(new App\Arguments('', $command), $router, $config, $dice);
|
$module = (new App\Module($name))->determineClass(new App\Arguments('', $command), $router, $config, $dice);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user