fix tests & remove superfluous parameter
This commit is contained in:
parent
4089e17f85
commit
b1ae58cdc5
3 changed files with 5 additions and 24 deletions
|
@ -107,11 +107,10 @@ class Module
|
|||
* Determines the current module based on the App arguments and the server variable
|
||||
*
|
||||
* @param Arguments $args The Friendica arguments
|
||||
* @param array $server The $_SERVER variable
|
||||
*
|
||||
* @return Module The module with the determined module
|
||||
*/
|
||||
public function determineModule(Arguments $args, array $server)
|
||||
public function determineModule(Arguments $args)
|
||||
{
|
||||
if ($args->getArgc() > 0) {
|
||||
$module = str_replace('.', '_', $args->get(0));
|
||||
|
|
|
@ -145,7 +145,7 @@ return [
|
|||
App\Module::class => [
|
||||
'instanceOf' => App\Module::class,
|
||||
'call' => [
|
||||
['determineModule', [$_SERVER], Dice::CHAIN_CALL],
|
||||
['determineModule', [], Dice::CHAIN_CALL],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
@ -45,7 +45,6 @@ class ModuleTest extends DatabaseTest
|
|||
'network/data/in',
|
||||
['network', 'data', 'in'],
|
||||
3),
|
||||
'server' => [],
|
||||
],
|
||||
'withStrikeAndPoint' => [
|
||||
'assert' => [
|
||||
|
@ -57,7 +56,6 @@ class ModuleTest extends DatabaseTest
|
|||
'with-strike.and-point/data/in',
|
||||
['with-strike.and-point', 'data', 'in'],
|
||||
3),
|
||||
'server' => [],
|
||||
],
|
||||
'withNothing' => [
|
||||
'assert' => [
|
||||
|
@ -66,7 +64,6 @@ class ModuleTest extends DatabaseTest
|
|||
'class' => App\Module::DEFAULT_CLASS,
|
||||
],
|
||||
'args' => new App\Arguments(),
|
||||
'server' => []
|
||||
],
|
||||
'withIndex' => [
|
||||
'assert' => [
|
||||
|
@ -75,21 +72,8 @@ class ModuleTest extends DatabaseTest
|
|||
'class' => App\Module::DEFAULT_CLASS,
|
||||
],
|
||||
'args' => new App\Arguments(),
|
||||
'server' => ['PHP_SELF' => 'index.php']
|
||||
],
|
||||
'withIndexButBackendMod' => [
|
||||
'assert' => [
|
||||
'isBackend' => false,
|
||||
'name' => App\Module::BACKEND_MODULES[0],
|
||||
'class' => App\Module::DEFAULT_CLASS,
|
||||
],
|
||||
'args' => new App\Arguments(App\Module::BACKEND_MODULES[0] . '/data/in',
|
||||
App\Module::BACKEND_MODULES[0] . '/data/in',
|
||||
[App\Module::BACKEND_MODULES[0], 'data', 'in'],
|
||||
3),
|
||||
'server' => ['PHP_SELF' => 'index.php']
|
||||
],
|
||||
'withNotIndexAndBackendMod' => [
|
||||
'withBackendMod' => [
|
||||
'assert' => [
|
||||
'isBackend' => true,
|
||||
'name' => App\Module::BACKEND_MODULES[0],
|
||||
|
@ -99,7 +83,6 @@ class ModuleTest extends DatabaseTest
|
|||
App\Module::BACKEND_MODULES[0] . '/data/in',
|
||||
[App\Module::BACKEND_MODULES[0], 'data', 'in'],
|
||||
3),
|
||||
'server' => ['PHP_SELF' => 'daemon.php']
|
||||
],
|
||||
'withFirefoxApp' => [
|
||||
'assert' => [
|
||||
|
@ -111,7 +94,6 @@ class ModuleTest extends DatabaseTest
|
|||
'users/sign_in',
|
||||
['users', 'sign_in'],
|
||||
3),
|
||||
'server' => ['PHP_SELF' => 'index.php'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -121,9 +103,9 @@ class ModuleTest extends DatabaseTest
|
|||
*
|
||||
* @dataProvider dataModuleName
|
||||
*/
|
||||
public function testModuleName(array $assert, App\Arguments $args, array $server)
|
||||
public function testModuleName(array $assert, App\Arguments $args)
|
||||
{
|
||||
$module = (new App\Module())->determineModule($args, $server);
|
||||
$module = (new App\Module())->determineModule($args);
|
||||
|
||||
$this->assertModule($assert, $module);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue