Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shagtv committed Feb 6, 2020
1 parent cd15380 commit f2b6b21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions src/Badoo/LiveProfiler/LiveProfiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function useXhprof()
{
if ($this->is_enabled) {
$this->Logger->warning('can\'t change profiler after profiling started');
return false;
return $this;
}

$this->start_callback = function () {
Expand All @@ -184,14 +184,14 @@ public function useXhprof()
return xhprof_disable();
};

return true;
return $this;
}

public function useXhprofSample()
{
if ($this->is_enabled) {
$this->Logger->warning('can\'t change profiler after profiling started');
return false;
return $this;
}

if (!ini_get('xhprof.sampling_interval')) {
Expand All @@ -211,7 +211,7 @@ public function useXhprofSample()
return $this->convertSampleDataToCommonFormat(xhprof_sample_disable());
};

return true;
return $this;
}

protected function convertSampleDataToCommonFormat(array $sampling_data)
Expand Down Expand Up @@ -259,7 +259,7 @@ public function useTidyWays()
{
if ($this->is_enabled) {
$this->Logger->warning('can\'t change profiler after profiling started');
return false;
return $this;
}

$this->start_callback = function () {
Expand All @@ -270,14 +270,14 @@ public function useTidyWays()
return tideways_xhprof_disable();
};

return true;
return $this;
}

public function useUprofiler()
{
if ($this->is_enabled) {
$this->Logger->warning('can\'t change profiler after profiling started');
return false;
return $this;
}

$this->start_callback = function () {
Expand All @@ -288,14 +288,14 @@ public function useUprofiler()
return uprofiler_disable();
};

return true;
return $this;
}

public function useSimpleProfiler()
{
if ($this->is_enabled) {
$this->Logger->warning('can\'t change profiler after profiling started');
return false;
return $this;
}

$this->start_callback = function () {
Expand All @@ -306,7 +306,7 @@ public function useSimpleProfiler()
return \Badoo\LiveProfiler\SimpleProfiler::getInstance()->disable();
};

return true;
return $this;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/Badoo/LiveProfiler/LiveProfilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testStart()
$ProfilerMock
->setDivider(1)
->setStartCallback(function () {
});
});

$result = $ProfilerMock->start();
self::assertTrue($result);
Expand Down Expand Up @@ -98,7 +98,7 @@ public function testStartTotal()
$ProfilerMock
->setTotalDivider(1)
->setStartCallback(function () {
});
});

$result = $ProfilerMock->start();
self::assertTrue($result);
Expand All @@ -124,8 +124,8 @@ public function testEnd()
$ProfilerMock
->setDataPacker($DataPacker)
->setEndCallback(function () {
return ['end result'];
});
return ['end result'];
});

$result = $ProfilerMock->end();
self::assertTrue($result);
Expand Down

0 comments on commit f2b6b21

Please sign in to comment.