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()
$json = json_decode($response->getBody(), true);
self::assertEquals([
- 'type' => 'array',
+ 'type' => 'array',
'stats' => [],
], $json['cache']);
self::assertEquals([
- 'type' => 'array',
+ 'type' => 'array',
'stats' => [],
], $json['lock']);
}
$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, []))
$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, []))
$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);
$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']);
$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' => [
$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']);