]> git.mxchange.org Git - friendica.git/commitdiff
Fixing tests
authorPhilipp Holzer <admin@philipp.info>
Sun, 17 Feb 2019 20:41:45 +0000 (21:41 +0100)
committerPhilipp Holzer <admin@philipp.info>
Sun, 17 Feb 2019 20:41:45 +0000 (21:41 +0100)
18 files changed:
tests/Util/AppMockTrait.php
tests/Util/DBStructureMockTrait.php
tests/src/App/ModeTest.php
tests/src/BaseObjectTest.php
tests/src/Core/Cache/CacheTest.php
tests/src/Core/Cache/MemcacheCacheDriverTest.php
tests/src/Core/Cache/MemcachedCacheDriverTest.php
tests/src/Core/Cache/RedisCacheDriverTest.php
tests/src/Core/Config/ConfigurationTest.php
tests/src/Core/Config/PConfigurationTest.php
tests/src/Core/Console/AutomaticInstallationConsoleTest.php
tests/src/Core/Console/ConfigConsoleTest.php
tests/src/Core/Console/ConsoleTest.php
tests/src/Core/Lock/LockTest.php
tests/src/Core/Lock/MemcacheCacheLockDriverTest.php
tests/src/Core/Lock/MemcachedCacheLockDriverTest.php
tests/src/Core/Lock/RedisCacheLockDriverTest.php
tests/src/Core/Lock/SemaphoreLockDriverTest.php

index 66b95b04e84605023a02c6a316b9fd4eebbc310b..817570dd58c948cd4418e3217e4a660f3d6d1ac2 100644 (file)
@@ -6,6 +6,7 @@ use Friendica\App;
 use Friendica\BaseObject;
 use Friendica\Core\Config;
 use Friendica\Render\FriendicaSmartyEngine;
+use Friendica\Util\Profiler;
 use Mockery\MockInterface;
 use org\bovigo\vfs\vfsStreamDirectory;
 
@@ -22,70 +23,81 @@ trait AppMockTrait
        /**
         * @var MockInterface|Config\Configuration The mocked Config Cache
         */
-       protected $configCache;
+       protected $configMock;
+
+       /**
+        * @var MockInterface|Profiler The mocked profiler
+        */
+       protected $profilerMock;
 
        /**
         * Mock the App
         *
         * @param vfsStreamDirectory $root The root directory
-        * @param MockInterface|Config\Configuration $config The config cache
         */
-       public function mockApp($root, Config\Configuration $config)
+       public function mockApp($root)
        {
-               $this->configCache = $config;
+               $this->configMock = \Mockery::mock(Config\Cache\IConfigCache::class);
+               $configAdapterMock = \Mockery::mock(Config\Adapter\IConfigAdapter::class);
+               // Disable the adapter
+               $configAdapterMock->shouldReceive('isConnected')->andReturn(false);
+
+               $config = new Config\Configuration($this->configMock, $configAdapterMock);
+               // Initialize empty Config
+               Config::init($config);
+
                // Mocking App and most used functions
                $this->app = \Mockery::mock(App::class);
                $this->app
                        ->shouldReceive('getBasePath')
                        ->andReturn($root->url());
 
-               $config
+               $this->configMock
+                       ->shouldReceive('has')
+                       ->andReturn(true);
+               $this->configMock
                        ->shouldReceive('get')
                        ->with('database', 'hostname')
                        ->andReturn(getenv('MYSQL_HOST'));
-               $config
+               $this->configMock
                        ->shouldReceive('get')
                        ->with('database', 'username')
                        ->andReturn(getenv('MYSQL_USERNAME'));
-               $config
+               $this->configMock
                        ->shouldReceive('get')
                        ->with('database', 'password')
                        ->andReturn(getenv('MYSQL_PASSWORD'));
-               $config
+               $this->configMock
                        ->shouldReceive('get')
                        ->with('database', 'database')
                        ->andReturn(getenv('MYSQL_DATABASE'));
-               $config
+               $this->configMock
                        ->shouldReceive('get')
                        ->with('config', 'hostname')
                        ->andReturn('localhost');
-               $config
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'theme', NULL, false)
+                       ->with('system', 'theme')
                        ->andReturn('system_theme');
-               $config
-                       ->shouldReceive('getConfig')
-                       ->andReturn($config);
+
+               $this->profilerMock = \Mockery::mock(Profiler::class);
+               $this->profilerMock->shouldReceive('saveTimestamp');
 
                $this->app
                        ->shouldReceive('getConfigCache')
-                       ->andReturn($config);
-
+                       ->andReturn($this->configMock);
                $this->app
                        ->shouldReceive('getTemplateEngine')
                        ->andReturn(new FriendicaSmartyEngine());
                $this->app
                        ->shouldReceive('getCurrentTheme')
                        ->andReturn('Smarty3');
-               $this->app
-                       ->shouldReceive('saveTimestamp')
-                       ->andReturn(true);
                $this->app
                        ->shouldReceive('getBaseUrl')
                        ->andReturn('http://friendica.local');
-
-               // Initialize empty Config
-               Config::init($config);
+               $this->app
+                       ->shouldReceive('getProfiler')
+                       ->andReturn($this->profilerMock);
 
                BaseObject::setApp($this->app);
        }
index 87c120d3f22337d0e5c8b83ee96ebaa681bb537d..92ec412cb7ed4bec698c49c768248b2efe9d67a1 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Friendica\Test\Util;
 
+use Friendica\Database\DBStructure;
 use Mockery\MockInterface;
 
 /**
@@ -16,6 +17,7 @@ trait DBStructureMockTrait
 
        /**
         * Mocking DBStructure::update()
+        * @see DBStructure::update();
         *
         * @param array $args The arguments for the update call
         * @param bool $return True, if the connect was successful, otherwise false
index 5a5c4c87e66e6146968cc7be61f7bd2159bf2388..9059e8bebf4ad6b6d1ec29812dcc239a9e774f7e 100644 (file)
@@ -90,7 +90,7 @@ class ModeTest extends MockedTest
                $this->mockConnected(true, 1);
                $this->mockFetchFirst('SHOW TABLES LIKE \'config\'', true, 1);
 
-               $config = \Mockery::mock('Friendica\Core\Config\Configuration');
+               $config = \Mockery::mock(Config\Configuration::class);
                $config
                        ->shouldReceive('get')
                        ->with('system', 'maintenance', null, false)
@@ -118,7 +118,7 @@ class ModeTest extends MockedTest
                $this->mockConnected(true, 1);
                $this->mockFetchFirst('SHOW TABLES LIKE \'config\'', true, 1);
 
-               $config = \Mockery::mock('Friendica\Core\Config\Configuration');
+               $config = \Mockery::mock(Config\Configuration::class);
                $config
                        ->shouldReceive('get')
                        ->with('system', 'maintenance', null, false)
index 39741eb9e1e4beef83473a35b954b014dd8d8841..3341503915f4738e68cad7d74e6cfaab641e72e6 100644 (file)
@@ -31,8 +31,7 @@ class BaseObjectTest extends TestCase
        {
                $baseObject = new BaseObject();
                $this->setUpVfsDir();
-               $configMock = \Mockery::mock('Friendica\Core\Config\Configuration');
-               $this->mockApp($this->root, $configMock);
+               $this->mockApp($this->root);
 
                $this->assertNull($baseObject->setApp($this->app));
                $this->assertEquals($this->app, $baseObject->getApp());
index 961ac9e1b464b3186badb82f7d47718ecd5c5371..ef97f5a172214ea16ed325ca79b7ff8cb5f2d027 100644 (file)
@@ -67,8 +67,7 @@ abstract class CacheTest extends MockedTest
        protected function setUp()
        {
                $this->setUpVfsDir();
-               $configMock = \Mockery::mock('Friendica\Core\Config\Configuration');
-               $this->mockApp($this->root, $configMock);
+               $this->mockApp($this->root);
                $this->app
                        ->shouldReceive('getHostname')
                        ->andReturn('friendica.local');
index 5017b6967e2b29a483c5d983e430fb961cd8c917..f9df9eaba089b996ab62ed108908801451f9f486 100644 (file)
@@ -12,14 +12,14 @@ class MemcacheCacheDriverTest extends MemoryCacheTest
 {
        protected function getInstance()
        {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'memcache_host', NULL, false)
+                       ->with('system', 'memcache_host')
                        ->andReturn('localhost');
 
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'memcache_port', NULL, false)
+                       ->with('system', 'memcache_port')
                        ->andReturn(11211);
 
                $this->cache = CacheDriverFactory::create('memcache');
index 7c6835359323dae6b0282adcd8385c5207c3a712..4e16ef947f7fadd4373d19432cca98e6f267eb1a 100644 (file)
@@ -12,9 +12,9 @@ class MemcachedCacheDriverTest extends MemoryCacheTest
 {
        protected function getInstance()
        {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'memcached_hosts', NULL, false)
+                       ->with('system', 'memcached_hosts')
                        ->andReturn([0 => 'localhost, 11211']);
 
                $this->cache = CacheDriverFactory::create('memcached');
index d36e6b826e843fb8eb6e00ae51e27880ffdd47f8..20fe7eb53f299fcaa8e7fb9dc3611fc2d916b805 100644 (file)
@@ -12,14 +12,14 @@ class RedisCacheDriverTest extends MemoryCacheTest
 {
        protected function getInstance()
        {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'redis_host', NULL, false)
+                       ->with('system', 'redis_host')
                        ->andReturn('localhost');
 
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'redis_port', NULL, false)
+                       ->with('system', 'redis_port')
                        ->andReturn(null);
 
                $this->cache = CacheDriverFactory::create('redis');
index 0437f1e7adcfc382a3207088e6625f36c1f26e22..2e4fcd4f58db9d90a8bcb0671eb24cb9a1469e9d 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Friendica\Test\Core\Config;
 
+use Friendica\Core\Config\Adapter\IConfigAdapter;
 use Friendica\Core\Config\Cache\ConfigCache;
 use Friendica\Core\Config\Cache\IConfigCache;
 use Friendica\Core\Config\Configuration;
@@ -29,7 +30,7 @@ class ConfigurationTest extends MockedTest
        public function testSetUp()
        {
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(false)->once();
 
                $configuration = new Configuration($configCache, $configAdapter);
@@ -43,7 +44,7 @@ class ConfigurationTest extends MockedTest
        public function testCacheLoad()
        {
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(3);
                // constructor loading
                $configAdapter->shouldReceive('load')->andReturn([])->once();
@@ -64,7 +65,7 @@ class ConfigurationTest extends MockedTest
        public function testCacheLoadDouble()
        {
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(5);
                // constructor loading
                $configAdapter->shouldReceive('load')->andReturn([])->once();
@@ -93,7 +94,7 @@ class ConfigurationTest extends MockedTest
        public function testSetGetWithoutDB($data)
        {
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(3);
 
                $configuration = new Configuration($configCache, $configAdapter);
@@ -111,7 +112,7 @@ class ConfigurationTest extends MockedTest
        public function testSetGetWithDB($data)
        {
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(3);
                // constructor loading
                $configAdapter->shouldReceive('load')->andReturn([])->once();
@@ -132,7 +133,7 @@ class ConfigurationTest extends MockedTest
        public function testGetWrongWithoutDB()
        {
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(4);
 
                $configuration = new Configuration($configCache, $configAdapter);
@@ -157,7 +158,7 @@ class ConfigurationTest extends MockedTest
        public function testGetWithRefresh($data)
        {
                $configCache = new ConfigCache(['test' => ['it' => 'now']]);
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(4);
                // constructor loading
                $configAdapter->shouldReceive('load')->andReturn([])->once();
@@ -188,7 +189,7 @@ class ConfigurationTest extends MockedTest
        public function testGetWithoutLoaded($data)
        {
                $configCache = new ConfigCache(['test' => ['it' => 'now']]);
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(4);
                // constructor loading
                $configAdapter->shouldReceive('load')->andReturn([])->once();
@@ -223,7 +224,7 @@ class ConfigurationTest extends MockedTest
        public function testDeleteWithoutDB($data)
        {
                $configCache = new ConfigCache(['test' => ['it' => $data]]);
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(4);
 
                $configuration = new Configuration($configCache, $configAdapter);
@@ -244,7 +245,7 @@ class ConfigurationTest extends MockedTest
        public function testDeleteWithDB()
        {
                $configCache = new ConfigCache(['test' => ['it' => 'now', 'quarter' => 'true']]);
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IConfigAdapter');
+               $configAdapter = \Mockery::mock(IConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(6);
                // constructor loading
                $configAdapter->shouldReceive('load')->andReturn([])->once();
index 8ecc9bdf379f092ff38ba0a3f87103ae71cf3bf9..0259944147a1c7670b15ab18cc3468fc1041eaca 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Friendica\Test\Core\Config;
 
+use Friendica\Core\Config\Adapter\IPConfigAdapter;
 use Friendica\Core\Config\Cache\ConfigCache;
 use Friendica\Core\Config\PConfiguration;
 use Friendica\Test\MockedTest;
@@ -29,7 +30,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->twice();
                // expected loading
                $configAdapter->shouldReceive('load')
@@ -51,7 +52,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(4);
                // expected loading
                $configAdapter->shouldReceive('load')->with($uid, 'testing')->andReturn(['testing' => ['test' => 'it']])->once();
@@ -77,7 +78,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(2);
 
                $configuration = new PConfiguration($configCache, $configAdapter);
@@ -95,7 +96,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(2);
                $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(true)->once();
                $configAdapter->shouldReceive('set')->with($uid, 'test', 'it', $data)->andReturn(true)->once();
@@ -114,7 +115,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(3);
 
                $configuration = new PConfiguration($configCache, $configAdapter);
@@ -137,7 +138,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(4);
                $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(false)->once();
                $configAdapter->shouldReceive('get')->with($uid, 'test', 'it')->andReturn('now')->once();
@@ -168,7 +169,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(3);
 
                $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(false)->once();
@@ -199,7 +200,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(false)->times(4);
 
                $configuration = new PConfiguration($configCache, $configAdapter);
@@ -218,7 +219,7 @@ class PConfigurationTest extends MockedTest
        {
                $uid = 234;
                $configCache = new ConfigCache();
-               $configAdapter = \Mockery::mock('Friendica\Core\Config\Adapter\IPConfigAdapter');
+               $configAdapter = \Mockery::mock(IPConfigAdapter::class);
                $configAdapter->shouldReceive('isConnected')->andReturn(true)->times(6);
                $configAdapter->shouldReceive('set')->with($uid, 'test', 'it', 'now')->andReturn(false)->once();
                $configAdapter->shouldReceive('isLoaded')->with($uid, 'test', 'it')->andReturn(true)->once();
index ce3dac02cc89daaaa9a5b07907ceb93381ee57ce..73b6835fb5cce41a46731c4a800079a978beab1d 100644 (file)
@@ -52,9 +52,9 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
                $this->db_user = getenv('MYSQL_USERNAME') . getenv('MYSQL_USER');
                $this->db_pass = getenv('MYSQL_PASSWORD');
 
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('config', 'php_path', NULL, false)
+                       ->with('config', 'php_path')
                        ->andReturn(false);
 
                $this->mockL10nT();
index 5b7d14906c7693a8fe6c30c2ea0c613182e2f62d..579b28e026b4a94ff1623c5e4710a65472d27c00 100644 (file)
@@ -32,14 +32,14 @@ class ConfigConsoleTest extends ConsoleTest
        }
 
        function testSetGetKeyValue() {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('set')
                        ->with('config', 'test', 'now')
                        ->andReturn(true)
                        ->once();
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('config', 'test', NULL, false)
+                       ->with('config', 'test')
                        ->andReturn('now')
                        ->twice();
 
@@ -50,9 +50,9 @@ class ConfigConsoleTest extends ConsoleTest
                $txt = $this->dumpExecute($console);
                $this->assertEquals("config.test <= now\n", $txt);
 
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('config', 'test', null, false)
+                       ->with('config', 'test')
                        ->andReturn('now')
                        ->once();
 
@@ -62,9 +62,9 @@ class ConfigConsoleTest extends ConsoleTest
                $txt = $this->dumpExecute($console);
                $this->assertEquals("config.test => now\n", $txt);
 
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('config', 'test', null, false)
+                       ->with('config', 'test')
                        ->andReturn(null)
                        ->once();
 
@@ -77,9 +77,9 @@ class ConfigConsoleTest extends ConsoleTest
 
        function testSetArrayValue() {
                $testArray = [1, 2, 3];
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('config', 'test', null, false)
+                       ->with('config', 'test')
                        ->andReturn($testArray)
                        ->once();
 
@@ -105,9 +105,9 @@ class ConfigConsoleTest extends ConsoleTest
        }
 
        function testVerbose() {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('test', 'it', null, false)
+                       ->with('test', 'it')
                        ->andReturn('now')
                        ->once();
                $console = new Config($this->consoleArgv);
@@ -133,14 +133,14 @@ CONF;
        }
 
        function testUnableToSet() {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('set')
                        ->with('test', 'it', 'now')
                        ->andReturn(false)
                        ->once();
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('test', 'it', NULL, false)
+                       ->with('test', 'it')
                        ->andReturn(NULL)
                        ->once();
                $console = new Config();
index f733175d3434bd0cc0d47f06f727225b2997c2b7..4f7acc9c4229f62223b42cbdfca7121e46bffc81 100644 (file)
@@ -3,12 +3,10 @@
 namespace Friendica\Test\src\Core\Console;
 
 use Asika\SimpleConsole\Console;
-use Friendica\Core\Config\Configuration;
 use Friendica\Test\MockedTest;
 use Friendica\Test\Util\AppMockTrait;
 use Friendica\Test\Util\Intercept;
 use Friendica\Test\Util\VFSTrait;
-use Friendica\Util\Profiler;
 
 abstract class ConsoleTest extends MockedTest
 {
@@ -31,10 +29,7 @@ abstract class ConsoleTest extends MockedTest
                Intercept::setUp();
 
                $this->setUpVfsDir();
-               $configMock = \Mockery::mock(Configuration::class);
-               $this->mockApp($this->root, $configMock);
-               $profileMock = \Mockery::mock(Profiler::class);
-               $this->app->shouldReceive('getProfiler')->andReturn($profileMock);
+               $this->mockApp($this->root);
        }
 
        /**
index c1378aa16430538158afc941a12e4fb790b1d1ee..6dc170e51429bdfc659e8979b5e36cdc0e239d86 100644 (file)
@@ -27,8 +27,7 @@ abstract class LockTest extends MockedTest
        {
                // Reusable App object
                $this->setUpVfsDir();
-               $configMock = \Mockery::mock('Friendica\Core\Config\Configuration');
-               $this->mockApp($this->root, $configMock);
+               $this->mockApp($this->root);
                $this->app
                        ->shouldReceive('getHostname')
                        ->andReturn('friendica.local');
index 0e118c5dd76ef5badf98182685dd85ed30c4ae80..ad20f5bfdb79dbe31ee29ed282b8836af0084f14 100644 (file)
@@ -13,14 +13,14 @@ class MemcacheCacheLockDriverTest extends LockTest
 {
        protected function getInstance()
        {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'memcache_host', NULL, false)
+                       ->with('system', 'memcache_host')
                        ->andReturn('localhost');
 
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'memcache_port', NULL, false)
+                       ->with('system', 'memcache_port')
                        ->andReturn(11211);
 
                return new CacheLockDriver(CacheDriverFactory::create('memcache'));
index fe490a38cf2faa574eeb54b65860d347c9b6fa79..a5bdeaedb8a940492420ae8066b52f4bea062a43 100644 (file)
@@ -13,9 +13,9 @@ class MemcachedCacheLockDriverTest extends LockTest
 {
        protected function getInstance()
        {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'memcached_hosts', NULL, false)
+                       ->with('system', 'memcached_hosts')
                        ->andReturn([0 => 'localhost, 11211']);
 
                return new CacheLockDriver(CacheDriverFactory::create('memcached'));
index f5d0a648fba29a4bf415ac02e19b19726ee5d211..5f047bc66418124e5005bb0560a25311d62f8f18 100644 (file)
@@ -13,14 +13,14 @@ class RedisCacheLockDriverTest extends LockTest
 {
        protected function getInstance()
        {
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'redis_host', NULL, false)
+                       ->with('system', 'redis_host')
                        ->andReturn('localhost');
 
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'redis_port', NULL, false)
+                       ->with('system', 'redis_port')
                        ->andReturn(null);
 
                return new CacheLockDriver(CacheDriverFactory::create('redis'));
index bf422f2f8890f86c3b91e80fa9cafc20386345bc..a37fbffbed24c86a7076fd060216e50b751a84cd 100644 (file)
@@ -12,9 +12,9 @@ class SemaphoreLockDriverTest extends LockTest
 
                $this->app->shouldReceive('getHostname')->andReturn('friendica.local');
 
-               $this->configCache
+               $this->configMock
                        ->shouldReceive('get')
-                       ->with('system', 'temppath', NULL, false)
+                       ->with('system', 'temppath')
                        ->andReturn('/tmp/');
        }