Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/Command/BenchmarkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
* functionally similar to Apache AB
*
* @since DebugKit 1.0
* @todo Print/export time detail information
* @todo Export/graphing of data to .dot format for graphviz visualization
* @todo Make calculated results round to leading significant digit position of std dev.
*/
class BenchmarkCommand extends Command
{
Expand Down
7 changes: 3 additions & 4 deletions src/View/Helper/SimpleGraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ class SimpleGraphHelper extends Helper
public function bar($value, $offset, $options = [])
{
$settings = array_merge($this->_defaultSettings, $options);
/** @var int $max */
/** @var int $width */
/** @var string $valueType */
extract($settings);
$max = $settings['max'];
$width = $settings['width'];
$valueType = $settings['valueType'];

$graphValue = $value / $max * $width;
$graphValue = max(round($graphValue), 1);
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/DebugSqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
namespace DebugKit\Test\TestCase;

use Cake\Database\Driver\Mysql;
use Cake\Database\Driver\Postgres;
use Cake\Datasource\ConnectionManager;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
Expand Down Expand Up @@ -59,7 +59,7 @@ public function testSqlText()
###########################

EXPECTED;
$fieldName = $this->connection->getDriver() instanceof Mysql ? '`panels__id`' : '"panels__id"';
$fieldName = $this->connection->getDriver() instanceof Postgres ? '"panels__id"' : 'panels__id';
$expected = sprintf($expectedText, str_replace(ROOT, '', __FILE__), __LINE__ - 11, $fieldName);
$this->assertEquals($expected, $result);
}
Expand All @@ -86,7 +86,7 @@ public function testSqlHtml()
</pre>
</div>
EXPECTED;
$fieldName = $this->connection->getDriver() instanceof Mysql ? '`panels__id`' : '"panels__id"';
$fieldName = $this->connection->getDriver() instanceof Postgres ? '"panels__id"' : 'panels__id';
$expected = sprintf($expectedHtml, str_replace(ROOT, '', __FILE__), __LINE__ - 15, $fieldName);
$this->assertEquals(str_replace("\r", '', $expected), str_replace("\r", '', $result));
}
Expand Down
8 changes: 7 additions & 1 deletion tests/TestCase/Panel/VariablesPanelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ public function testShutdown()
});
$this->assertRegExp('/^\[stream\] Resource id #\d+$/', $output['content']['resource']);
$this->assertIsArray($output['content']['unserializableDebugInfo']);

if (version_compare(PHP_VERSION, '7.4.0', '>=')) {
$expectedErrorMessage = "Unserializable object - stdClass. Error: Serialization of 'PDO' is not allowed";
} else {
$expectedErrorMessage = 'Unserializable object - stdClass. Error: You cannot serialize or unserialize PDO instances';
}
$this->assertStringStartsWith(
'Unserializable object - stdClass. Error: You cannot serialize or unserialize PDO instances',
$expectedErrorMessage,
$output['content']['unserializableDebugInfo']['unserializable']
);
$this->assertStringStartsWith(
Expand Down
6 changes: 1 addition & 5 deletions tests/TestCase/ToolbarServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,7 @@ public function testInjectScriptsStreamBodies()

$result = $bar->injectScripts($row, $response);
$this->assertInstanceOf('Cake\Http\Response', $result);
if (version_compare(PHP_VERSION, '5.6.0', '>=')) {
$this->assertEquals('I am a teapot!', $response->getBody());
} else {
$this->assertInstanceOf('Closure', $response->getBody());
}
$this->assertEquals('I am a teapot!', $response->getBody());
}

/**
Expand Down