Tests
This commit is contained in:
parent
c89533a70b
commit
72bc1238ba
|
@ -87,6 +87,12 @@ class Profiler implements ContainerInterface
|
||||||
$this->reset();
|
$this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start a profiler recording
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function startRecording(string $value)
|
public function startRecording(string $value)
|
||||||
{
|
{
|
||||||
if (!$this->enabled) {
|
if (!$this->enabled) {
|
||||||
|
@ -96,6 +102,12 @@ class Profiler implements ContainerInterface
|
||||||
$this->timestamps[] = ['value' => $value, 'stamp' => microtime(true), 'credit' => 0];
|
$this->timestamps[] = ['value' => $value, 'stamp' => microtime(true), 'credit' => 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop a profiler recording
|
||||||
|
*
|
||||||
|
* @param string $callstack
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function stopRecording(string $callstack = '')
|
public function stopRecording(string $callstack = '')
|
||||||
{
|
{
|
||||||
if (!$this->enabled || empty($this->timestamps)) {
|
if (!$this->enabled || empty($this->timestamps)) {
|
||||||
|
|
|
@ -101,6 +101,8 @@ trait AppMockTrait
|
||||||
->andReturn($root->url());
|
->andReturn($root->url());
|
||||||
|
|
||||||
$this->profilerMock = \Mockery::mock(Profiler::class);
|
$this->profilerMock = \Mockery::mock(Profiler::class);
|
||||||
|
$this->profilerMock->shouldReceive('startRecording');
|
||||||
|
$this->profilerMock->shouldReceive('stopRecording');
|
||||||
$this->profilerMock->shouldReceive('saveTimestamp');
|
$this->profilerMock->shouldReceive('saveTimestamp');
|
||||||
$this->dice->shouldReceive('create')
|
$this->dice->shouldReceive('create')
|
||||||
->with(Profiler::class)
|
->with(Profiler::class)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user