]> git.mxchange.org Git - friendica.git/commitdiff
Mak PHPCS happy
authorPhilipp <admin@philipp.info>
Sun, 27 Apr 2025 00:08:01 +0000 (02:08 +0200)
committerPhilipp <admin@philipp.info>
Sun, 27 Apr 2025 19:26:52 +0000 (21:26 +0200)
tests/LockTestCase.php
tests/src/Core/Lock/APCuCacheLockTest.php
tests/src/Core/Lock/ArrayCacheLockTest.php
tests/src/Core/Lock/MemcacheCacheLockTest.php
tests/src/Core/Lock/MemcachedCacheLockTest.php
tests/src/Core/Lock/RedisCacheLockTest.php
tests/src/Core/Lock/SemaphoreLockTest.php
tests/src/Module/StatsCachingTest.php

index 1b80e575ef7120edaee0db9b79807e8151b1c2bc..92abf0ca7b7b03bbdc9c43faec44fb683cd12c79 100644 (file)
@@ -7,10 +7,7 @@
 
 namespace Friendica\Test;
 
-use Friendica\Core\Cache\Capability\ICanCache;
-use Friendica\Core\Cache\Capability\ICanCacheInMemory;
 use Friendica\Core\Lock\Capability\ICanLock;
-use Friendica\Core\Lock\Type\CacheLock;
 
 abstract class LockTestCase extends MockedTestCase
 {
index 42a1fc72d534f45f003a0cd04c7ba44dc7dc1fc4..3b6c7904b43995ea363a68c89df6385389560cc2 100644 (file)
@@ -28,7 +28,7 @@ class APCuCacheLockTest extends CacheLockTestCase
                }
 
                $this->cache = new APCuCache('localhost');
-               $this->lock = new CacheLock($this->cache);
+               $this->lock  = new CacheLock($this->cache);
 
                parent::setUp();
        }
index 2aac8e829338a92249c04ae53e8b39ade99261de..07cd88dd1cf3ebbf59b86e662d160895b18b99a4 100644 (file)
@@ -20,7 +20,7 @@ class ArrayCacheLockTest extends CacheLockTestCase
        protected function setUp(): void
        {
                $this->cache = new ArrayCache('localhost');
-               $this->lock = new CacheLock($this->cache);
+               $this->lock  = new CacheLock($this->cache);
 
                parent::setUp();
        }
index c1dec663f117727cada479fa7aa170ec85ab1037..8915e6d37cf71245a28d5216b391750be52d0ec1 100644 (file)
@@ -42,7 +42,7 @@ class MemcacheCacheLockTest extends CacheLockTestCase
 
                try {
                        $this->cache = new MemcacheCache($host, $configMock);
-                       $this->lock = new CacheLock($this->cache);
+                       $this->lock  = new CacheLock($this->cache);
                } catch (Exception $e) {
                        static::markTestSkipped('Memcache is not available');
                }
index 773e664108502ab51fe29cb93375fcbdfd370307..522f60c64a9d32cbcfd56a896f531549500c4aba 100644 (file)
@@ -13,7 +13,6 @@ use Friendica\Core\Cache\Type\MemcachedCache;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\Lock\Type\CacheLock;
 use Friendica\Test\CacheLockTestCase;
-use Friendica\Test\LockTestCase;
 use Mockery;
 use Psr\Log\NullLogger;
 
@@ -42,7 +41,7 @@ class MemcachedCacheLockTest extends CacheLockTestCase
 
                try {
                        $this->cache = new MemcachedCache($host, $configMock, $logger);
-                       $this->lock = new CacheLock($this->cache);
+                       $this->lock  = new CacheLock($this->cache);
                } catch (Exception $e) {
                        static::markTestSkipped('Memcached is not available');
                }
index 3cb4fba43685c1053ffef12d6cc2105f5663b8a1..1136b80c4b93caab05d68b67bbbd2fedac35d5ac 100644 (file)
@@ -13,7 +13,6 @@ use Friendica\Core\Cache\Type\RedisCache;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\Lock\Type\CacheLock;
 use Friendica\Test\CacheLockTestCase;
-use Friendica\Test\LockTestCase;
 use Mockery;
 
 /**
@@ -49,7 +48,7 @@ class RedisCacheLockTest extends CacheLockTestCase
 
                try {
                        $this->cache = new RedisCache($host, $configMock);
-                       $this->lock = new CacheLock($this->cache);
+                       $this->lock  = new CacheLock($this->cache);
                } catch (Exception $e) {
                        static::markTestSkipped('Redis is not available. Error: ' . $e->getMessage());
                }
index 1ddb2dade753bddfff0f8387aac602244c0e36d8..30152ac427775b81e4e163e02df8bc92f4423ab5 100644 (file)
@@ -32,7 +32,7 @@ class SemaphoreLockTest extends LockTestCase
                $dice->shouldReceive('create')->with(App::class)->andReturn($app);
 
                $configCache = new Cache(['system' => ['temppath' => '/tmp']]);
-               $configMock = new ReadOnlyFileConfig($configCache);
+               $configMock  = new ReadOnlyFileConfig($configCache);
                $dice->shouldReceive('create')->with(IManageConfigValues::class)->andReturn($configMock);
 
                // @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
index 78554929e2abc05ec3915a97bd4d4770c0bfb6ba..58226769a95ca2eea4298d07e7ff853958f8d85a 100644 (file)
@@ -38,9 +38,9 @@ class StatsCachingTest extends FixtureTestCase
                parent::setUp();
 
                $this->httpExceptionMock = \Mockery::mock(HTTPException::class);
-               $this->config = \Mockery::mock(IManageConfigValues::class);
-               $this->cache = new ArrayCache('localhost');
-               $this->lock = new CacheLock($this->cache);
+               $this->config            = \Mockery::mock(IManageConfigValues::class);
+               $this->cache             = new ArrayCache('localhost');
+               $this->lock              = new CacheLock($this->cache);
        }
 
        public function testStatsCachingNotAllowed()
@@ -72,11 +72,11 @@ class StatsCachingTest extends FixtureTestCase
                $json = json_decode($response->getBody(), true);
 
                self::assertEquals([
-                       'type' => 'array',
+                       'type'  => 'array',
                        'stats' => [],
                ], $json['cache']);
                self::assertEquals([
-                       'type' => 'array',
+                       'type'  => 'array',
                        'stats' => [],
                ], $json['lock']);
        }
@@ -89,7 +89,7 @@ class StatsCachingTest extends FixtureTestCase
                $this->config->shouldReceive('get')->with('system', 'stats_key')->twice()->andReturn('12345');
 
                $this->cache = new DatabaseCache('localhost', DI::dba());
-               $this->lock = new DatabaseLock(DI::dba());
+               $this->lock  = new DatabaseLock(DI::dba());
                PHPMockery::mock("Friendica\\Module", "function_exists")->with('opcache_get_status')->once()->andReturn(false);
 
                $response = (new StatsCaching(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], $this->config, $this->cache, $this->lock, []))
@@ -113,7 +113,7 @@ class StatsCachingTest extends FixtureTestCase
                $this->config->shouldReceive('get')->with('system', 'stats_key')->twice()->andReturn('12345');
 
                $this->cache = new DatabaseCache('localhost', DI::dba());
-               $this->lock = new DatabaseLock(DI::dba());
+               $this->lock  = new DatabaseLock(DI::dba());
                PHPMockery::mock("Friendica\\Module", "function_exists")->with('opcache_get_status')->once()->andReturn(false);
 
                $response = (new StatsCaching(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], $this->config, $this->cache, $this->lock, []))
@@ -137,7 +137,7 @@ class StatsCachingTest extends FixtureTestCase
                $this->config->shouldReceive('get')->with('system', 'stats_key')->twice()->andReturn('12345');
 
                $this->cache = new DatabaseCache('localhost', DI::dba());
-               $this->lock = new DatabaseLock(DI::dba());
+               $this->lock  = new DatabaseLock(DI::dba());
                PHPMockery::mock("Friendica\\Module", "function_exists")->with('opcache_get_status')->once()->andReturn(true);
                PHPMockery::mock("Friendica\\Module", "opcache_get_status")->with(false)->once()->andReturn(false);
 
@@ -150,10 +150,10 @@ class StatsCachingTest extends FixtureTestCase
                $json = json_decode($response->getBody(), true);
 
                self::assertEquals([
-                       'enabled' => false,
-                       'hit_rate' => null,
-                       'used_memory' => null,
-                       'free_memory' => null,
+                       'enabled'            => false,
+                       'hit_rate'           => null,
+                       'used_memory'        => null,
+                       'free_memory'        => null,
                        'num_cached_scripts' => null,
                ], $json['opcache']);
                self::assertEquals(['type' => 'database'], $json['cache']);
@@ -168,12 +168,12 @@ class StatsCachingTest extends FixtureTestCase
                $this->config->shouldReceive('get')->with('system', 'stats_key')->twice()->andReturn('12345');
 
                $this->cache = new DatabaseCache('localhost', DI::dba());
-               $this->lock = new DatabaseLock(DI::dba());
+               $this->lock  = new DatabaseLock(DI::dba());
                PHPMockery::mock("Friendica\\Module", "function_exists")->with('opcache_get_status')->once()->andReturn(true);
                PHPMockery::mock("Friendica\\Module", "opcache_get_status")->with(false)->once()->andReturn([
-                       'opcache_enabled' => true,
+                       'opcache_enabled'    => true,
                        'opcache_statistics' => [
-                               'opcache_hit_rate' => 1,
+                               'opcache_hit_rate'   => 1,
                                'num_cached_scripts' => 2,
                        ],
                        'memory_usage' => [
@@ -191,10 +191,10 @@ class StatsCachingTest extends FixtureTestCase
                $json = json_decode($response->getBody(), true);
 
                self::assertEquals([
-                       'enabled' => true,
-                       'hit_rate' => 1,
-                       'used_memory' => 3,
-                       'free_memory' => 4,
+                       'enabled'            => true,
+                       'hit_rate'           => 1,
+                       'used_memory'        => 3,
+                       'free_memory'        => 4,
                        'num_cached_scripts' => 2,
                ], $json['opcache']);
                self::assertEquals(['type' => 'database'], $json['cache']);