]> git.mxchange.org Git - friendica.git/commitdiff
Fix tests (remove superfluous second parameter)
authornupplaPhil <admin@philipp.info>
Sat, 18 Jan 2020 12:48:29 +0000 (13:48 +0100)
committernupplaPhil <admin@philipp.info>
Sat, 18 Jan 2020 12:48:29 +0000 (13:48 +0100)
tests/Util/AppMockTrait.php
tests/src/Content/Text/BBCodeTest.php
tests/src/Core/InstallerTest.php
tests/src/Core/Lock/SemaphoreLockTest.php
tests/src/Core/SystemTest.php
tests/src/Network/CurlResultTest.php

index 7948f09f602efdac1ee11ca268dd243f19599881..f0231b280da79b5139041b29c2f6879c5a6f775d 100644 (file)
@@ -54,11 +54,11 @@ trait AppMockTrait
 
                $this->configMock = \Mockery::mock(Config\Cache\ConfigCache::class);
                $this->dice->shouldReceive('create')
-                          ->with(Config\Cache\ConfigCache::class, [])
+                          ->with(Config\Cache\ConfigCache::class)
                           ->andReturn($this->configMock);
                $this->mode = \Mockery::mock(App\Mode::class);
                $this->dice->shouldReceive('create')
-                          ->with(App\Mode::class, [])
+                          ->with(App\Mode::class)
                           ->andReturn($this->mode);
                $configModel= \Mockery::mock(\Friendica\Model\Config\Config::class);
                // Disable the adapter
@@ -66,48 +66,33 @@ trait AppMockTrait
 
                $config = new Config\JitConfiguration($this->configMock, $configModel);
                $this->dice->shouldReceive('create')
-                          ->with(Config\IConfiguration::class, [])
+                          ->with(Config\IConfiguration::class)
                           ->andReturn($config);
 
                // Mocking App and most used functions
                $this->app = \Mockery::mock(App::class);
                $this->dice->shouldReceive('create')
-                          ->with(App::class, [])
+                          ->with(App::class)
                           ->andReturn($this->app);
                $this->app
                        ->shouldReceive('getBasePath')
                        ->andReturn($root->url());
 
-               $this->app
-                       ->shouldReceive('getMode')
-                       ->andReturn($this->mode);
-
                $this->profilerMock = \Mockery::mock(Profiler::class);
                $this->profilerMock->shouldReceive('saveTimestamp');
                $this->dice->shouldReceive('create')
-                          ->with(Profiler::class, [])
+                          ->with(Profiler::class)
                           ->andReturn($this->profilerMock);
 
                $this->app
                        ->shouldReceive('getConfigCache')
                        ->andReturn($this->configMock);
-               $this->app
-                       ->shouldReceive('getConfig')
-                       ->andReturn($config);
                $this->app
                        ->shouldReceive('getTemplateEngine')
                        ->andReturn(new FriendicaSmartyEngine());
                $this->app
                        ->shouldReceive('getCurrentTheme')
                        ->andReturn('Smarty3');
-               $this->app
-                       ->shouldReceive('getProfiler')
-                       ->andReturn($this->profilerMock);
-               $this->app
-                       ->shouldReceive('getBaseUrl')
-                       ->andReturnUsing(function () {
-                               return $this->configMock->get('system', 'url');
-                       });
 
                DI::init($this->dice);
 
index 52d01401e64a8cb11c86c792c281216e9f69e913..ed33306edf85bb395504bf53293374d669a387f3 100644 (file)
@@ -43,13 +43,13 @@ class BBCodeTest extends MockedTest
                $l10nMock = \Mockery::mock(L10n::class);
                $l10nMock->shouldReceive('t')->withAnyArgs()->andReturnUsing(function ($args) { return $args; });
                $this->dice->shouldReceive('create')
-                          ->with(L10n::class, [])
+                          ->with(L10n::class)
                           ->andReturn($l10nMock);
 
                $baseUrlMock = \Mockery::mock(BaseURL::class);
                $baseUrlMock->shouldReceive('get')->withAnyArgs()->andReturn('friendica.local');
                $this->dice->shouldReceive('create')
-                          ->with(BaseURL::class, [])
+                          ->with(BaseURL::class)
                           ->andReturn($baseUrlMock);
        }
 
index dd7790e7399154492562bc6a3e1f3443e01c7f8a..370373850a54503a7250e7b34063a734c5d61b32 100644 (file)
@@ -34,7 +34,7 @@ class InstallerTest extends MockedTest
                $dice = $dice->addRules(include __DIR__ . '/../../../static/dependencies.config.php');
 
                $dice->shouldReceive('create')
-                          ->with(\Friendica\Core\L10n\L10n::class, [])
+                          ->with(\Friendica\Core\L10n\L10n::class)
                           ->andReturn($this->l10nMock);
 
                DI::init($dice);
index 089d891cab0dfebfcca32e2eb6187d2753f99634..6b4daf88741a8b3af8a087bde2bbfb8e5d6d9124 100644 (file)
@@ -19,14 +19,14 @@ class SemaphoreLockTest extends LockTest
 
                $app = \Mockery::mock(App::class);
                $app->shouldReceive('getHostname')->andReturn('friendica.local');
-               $dice->shouldReceive('create')->with(App::class, [])->andReturn($app);
+               $dice->shouldReceive('create')->with(App::class)->andReturn($app);
 
                $configMock = \Mockery::mock(JitConfiguration::class);
                $configMock
                        ->shouldReceive('get')
                        ->with('system', 'temppath', NULL, false)
                        ->andReturn('/tmp/');
-               $dice->shouldReceive('create')->with(IConfiguration::class, [])->andReturn($configMock);
+               $dice->shouldReceive('create')->with(IConfiguration::class)->andReturn($configMock);
 
                // @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
                DI::init($dice);
index 2f01df3446ae4b598b75f59add6b63b9b68eab0c..1b09eb46a8c11d8bd8c1e6c5a83db52f1232338e 100644 (file)
@@ -15,7 +15,7 @@ class SystemTest extends TestCase
                $baseUrl = \Mockery::mock(BaseURL::class);
                $baseUrl->shouldReceive('getHostname')->andReturn('friendica.local')->once();
                $dice = \Mockery::mock(Dice::class);
-               $dice->shouldReceive('create')->with(BaseURL::class, [])->andReturn($baseUrl);
+               $dice->shouldReceive('create')->with(BaseURL::class)->andReturn($baseUrl);
 
                DI::init($dice);
        }
index 294be6b0b2067f19d4f698771792ad8571b790e8..20287c9738e5719066df6e6643c2909d4226289a 100644 (file)
@@ -22,7 +22,7 @@ class CurlResultTest extends TestCase
 
                $logger = new NullLogger();
                $dice->shouldReceive('create')
-                          ->with(LoggerInterface::class, [])
+                          ->with(LoggerInterface::class)
                           ->andReturn($logger);
 
                DI::init($dice);