Mak PHPCS happy

This commit is contained in:
Philipp 2025-04-27 02:08:01 +02:00
parent 03cfa2d066
commit 7b39b3b9c0
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
8 changed files with 25 additions and 30 deletions

View 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']);