]> git.mxchange.org Git - friendica.git/commitdiff
Fix Legacy test
authorPhilipp <admin@philipp.info>
Sun, 14 Nov 2021 23:01:16 +0000 (00:01 +0100)
committerPhilipp <admin@philipp.info>
Sun, 14 Nov 2021 23:01:16 +0000 (00:01 +0100)
tests/datasets/legacy/legacy.php [new file with mode: 0644]
tests/src/App/ModuleTest.php

diff --git a/tests/datasets/legacy/legacy.php b/tests/datasets/legacy/legacy.php
new file mode 100644 (file)
index 0000000..4b0a76e
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+
+function legacy_init()
+{
+       // I don't do nothing
+}
index 65e0873c10bc23b779c4cef788448a0a95ddec85..8bcd81bc83f775d60f1eeea85de1d38bca525e03 100644 (file)
@@ -146,24 +146,28 @@ class ModuleTest extends DatabaseTest
                                'name'    => App\Module::DEFAULT,
                                'command' => App\Module::DEFAULT,
                                'privAdd' => false,
+                               'args'    => [],
                        ],
                        'legacy'  => [
                                'assert'  => LegacyModule::class,
                                'name'    => 'display',
                                'command' => 'display/test/it',
                                'privAdd' => false,
+                               'args'    => [__DIR__ . '/../../datasets/legacy/legacy.php'],
                        ],
                        'new'     => [
                                'assert'  => HostMeta::class,
                                'not_required',
                                'command' => '.well-known/host-meta',
                                'privAdd' => false,
+                               'args'    => [],
                        ],
                        '404'     => [
                                'assert'  => PageNotFound::class,
                                'name'    => 'invalid',
                                'command' => 'invalid',
                                'privAdd' => false,
+                               'args'    => [],
                        ]
                ];
        }
@@ -173,7 +177,7 @@ class ModuleTest extends DatabaseTest
         *
         * @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->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));
 
                $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);