Tests
This commit is contained in:
parent
72bc1238ba
commit
9ce43ad21d
@ -49,6 +49,8 @@ class DatabaseCacheTest extends CacheTest
|
|||||||
{
|
{
|
||||||
$logger = new NullLogger();
|
$logger = new NullLogger();
|
||||||
$profiler = Mockery::mock(Profiler::class);
|
$profiler = Mockery::mock(Profiler::class);
|
||||||
|
$profiler->shouldReceive('startRecording');
|
||||||
|
$profiler->shouldReceive('stopRecording');
|
||||||
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
||||||
|
|
||||||
// load real config to avoid mocking every config-entry which is related to the Database class
|
// load real config to avoid mocking every config-entry which is related to the Database class
|
||||||
|
@ -51,6 +51,8 @@ class DatabaseLockDriverTest extends LockTest
|
|||||||
{
|
{
|
||||||
$logger = new NullLogger();
|
$logger = new NullLogger();
|
||||||
$profiler = Mockery::mock(Profiler::class);
|
$profiler = Mockery::mock(Profiler::class);
|
||||||
|
$profiler->shouldReceive('startRecording');
|
||||||
|
$profiler->shouldReceive('stopRecording');
|
||||||
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
||||||
|
|
||||||
// load real config to avoid mocking every config-entry which is related to the Database class
|
// load real config to avoid mocking every config-entry which is related to the Database class
|
||||||
|
@ -69,6 +69,8 @@ class StorageManagerTest extends DatabaseTest
|
|||||||
$this->logger = new NullLogger();
|
$this->logger = new NullLogger();
|
||||||
|
|
||||||
$profiler = \Mockery::mock(Profiler::class);
|
$profiler = \Mockery::mock(Profiler::class);
|
||||||
|
$profiler->shouldReceive('startRecording');
|
||||||
|
$profiler->shouldReceive('stopRecording');
|
||||||
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
||||||
|
|
||||||
// load real config to avoid mocking every config-entry which is related to the Database class
|
// load real config to avoid mocking every config-entry which is related to the Database class
|
||||||
|
@ -27,6 +27,8 @@ class ProcessTest extends DatabaseTest
|
|||||||
$logger = new NullLogger();
|
$logger = new NullLogger();
|
||||||
|
|
||||||
$profiler = \Mockery::mock(Profiler::class);
|
$profiler = \Mockery::mock(Profiler::class);
|
||||||
|
$profiler->shouldReceive('startRecording');
|
||||||
|
$profiler->shouldReceive('stopRecording');
|
||||||
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
||||||
|
|
||||||
// load real config to avoid mocking every config-entry which is related to the Database class
|
// load real config to avoid mocking every config-entry which is related to the Database class
|
||||||
|
@ -51,6 +51,8 @@ class DatabaseStorageTest extends StorageTest
|
|||||||
{
|
{
|
||||||
$logger = new NullLogger();
|
$logger = new NullLogger();
|
||||||
$profiler = \Mockery::mock(Profiler::class);
|
$profiler = \Mockery::mock(Profiler::class);
|
||||||
|
$profiler->shouldReceive('startRecording');
|
||||||
|
$profiler->shouldReceive('stopRecording');
|
||||||
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
||||||
|
|
||||||
// load real config to avoid mocking every config-entry which is related to the Database class
|
// load real config to avoid mocking every config-entry which is related to the Database class
|
||||||
|
@ -52,6 +52,8 @@ class FilesystemStorageTest extends StorageTest
|
|||||||
{
|
{
|
||||||
$logger = new NullLogger();
|
$logger = new NullLogger();
|
||||||
$profiler = \Mockery::mock(Profiler::class);
|
$profiler = \Mockery::mock(Profiler::class);
|
||||||
|
$profiler->shouldReceive('startRecording');
|
||||||
|
$profiler->shouldReceive('stopRecording');
|
||||||
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
$profiler->shouldReceive('saveTimestamp')->withAnyArgs()->andReturn(true);
|
||||||
|
|
||||||
/** @var MockInterface|L10n $l10n */
|
/** @var MockInterface|L10n $l10n */
|
||||||
|
@ -59,6 +59,8 @@ class ProfilerLoggerTest extends MockedTest
|
|||||||
$logger = new ProfilerLogger($this->logger, $this->profiler);
|
$logger = new ProfilerLogger($this->logger, $this->profiler);
|
||||||
|
|
||||||
$this->logger->shouldReceive($function)->with($message, $context)->once();
|
$this->logger->shouldReceive($function)->with($message, $context)->once();
|
||||||
|
$this->profiler->shouldReceive('startRecording');
|
||||||
|
$this->profiler->shouldReceive('stopRecording');
|
||||||
$this->profiler->shouldReceive('saveTimestamp')->with(\Mockery::any(), 'file')->once();
|
$this->profiler->shouldReceive('saveTimestamp')->with(\Mockery::any(), 'file')->once();
|
||||||
$logger->$function($message, $context);
|
$logger->$function($message, $context);
|
||||||
}
|
}
|
||||||
@ -72,6 +74,8 @@ class ProfilerLoggerTest extends MockedTest
|
|||||||
$logger = new ProfilerLogger($this->logger, $this->profiler);
|
$logger = new ProfilerLogger($this->logger, $this->profiler);
|
||||||
|
|
||||||
$this->logger->shouldReceive('log')->with(LogLevel::WARNING, 'test', ['a' => 'context'])->once();
|
$this->logger->shouldReceive('log')->with(LogLevel::WARNING, 'test', ['a' => 'context'])->once();
|
||||||
|
$this->profiler->shouldReceive('startRecording');
|
||||||
|
$this->profiler->shouldReceive('stopRecording');
|
||||||
$this->profiler->shouldReceive('saveTimestamp')->with(\Mockery::any(), 'file')->once();
|
$this->profiler->shouldReceive('saveTimestamp')->with(\Mockery::any(), 'file')->once();
|
||||||
|
|
||||||
$logger->log(LogLevel::WARNING, 'test', ['a' => 'context']);
|
$logger->log(LogLevel::WARNING, 'test', ['a' => 'context']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user