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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ nbproject/*
.vscode
.DS_Store
.cache
.phpunit.cache
.project
.settings
.svn
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"require-dev": {
"cakephp/authorization": "3.x-dev",
"cakephp/cakephp-codesniffer": "5.x-dev",
"phpunit/phpunit": "^9.5.19"
"phpunit/phpunit": "^10.1.0"
},
"autoload": {
"psr-4": {
Expand Down
15 changes: 11 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="./tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
colors="true"
processIsolation="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
bootstrap="./tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
>
<testsuites>
<testsuite name="debug-kit">
<directory>tests/TestCase</directory>
</testsuite>
</testsuites>

<extensions>
<extension class="Cake\TestSuite\Fixture\PHPUnitExtension"/>
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
</extensions>

<coverage>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
</source>

<php>
<ini name="memory_limit" value="-1"/>
Expand Down
2 changes: 1 addition & 1 deletion src/ToolbarService.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function registry(): PanelRegistry
*/
public function isEnabled(): bool
{
if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) {
if (defined('PHPUNIT_COMPOSER_INSTALL') && !$GLOBALS['FORCE_DEBUGKIT_TOOLBAR']) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course they break my hacks 😆

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just re-introduced a new hack 😁

return false;
}
$enabled = (bool)Configure::read('debug')
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/Log/DebugLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function testLogIgnoreReflectionDisabled($sql)
$this->assertCount(1, $logger->queries());
}

public function schemaQueryProvider()
public static function schemaQueryProvider()
{
return [
// MySQL
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/Middleware/DebugKitMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public function setUp(): void
$connection = ConnectionManager::get('test');
$this->skipIf($connection->getDriver() instanceof Sqlite, 'Schema insertion/removal breaks SQLite');
$this->oldConfig = Configure::read('DebugKit');
$this->restore = $GLOBALS['__PHPUNIT_BOOTSTRAP'];
unset($GLOBALS['__PHPUNIT_BOOTSTRAP']);
$this->restore = $GLOBALS['FORCE_DEBUGKIT_TOOLBAR'];
$GLOBALS['FORCE_DEBUGKIT_TOOLBAR'] = true;
}

/**
Expand All @@ -69,7 +69,7 @@ public function tearDown(): void
parent::tearDown();

Configure::write('DebugKit', $this->oldConfig);
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $this->restore;
$GLOBALS['FORCE_DEBUGKIT_TOOLBAR'] = $this->restore;
}

protected function handler()
Expand Down Expand Up @@ -125,7 +125,7 @@ public function testInvokeSaveData()
$this->assertNotNull($result->panels[11]->summary);
$this->assertSame('Sql Log', $result->panels[11]->title);

$timeStamp = filemtime(Plugin::path('DebugKit') . 'webroot' . DS . 'js' . DS . 'main.js');
$timeStamp = filectime(Plugin::path('DebugKit') . 'webroot' . DS . 'js' . DS . 'main.js');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be inject-iframe.js here and keep using filemtime.

Line was previously incorrectly updated when .js file was renamed. And ToolbarService::getToolbarUrl‎ is using filemtime.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that but for some reason its not working... haven't looked too deep into it though.


$expected = '<html><title>test</title><body><p>some text</p>' .
'<script id="__debug_kit_script" data-id="' . $result->id . '" ' .
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Panel/PackagesPanelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function setUp(): void
*
* @return array
*/
public function packagesProvider()
public static function packagesProvider()
{
return [
'requirements' => ['packages'],
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/ToolbarServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public function setUp(): void

$connection = ConnectionManager::get('test');
$this->skipIf($connection->getDriver() instanceof Sqlite, 'Schema insertion/removal breaks SQLite');
$this->restore = $GLOBALS['__PHPUNIT_BOOTSTRAP'];
unset($GLOBALS['__PHPUNIT_BOOTSTRAP']);
$this->restore = $GLOBALS['FORCE_DEBUGKIT_TOOLBAR'];
$GLOBALS['FORCE_DEBUGKIT_TOOLBAR'] = true;
}

/**
Expand All @@ -71,7 +71,7 @@ public function tearDown(): void
{
parent::tearDown();
putenv('HTTP_HOST=');
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $this->restore;
$GLOBALS['FORCE_DEBUGKIT_TOOLBAR'] = $this->restore;
}

/**
Expand Down Expand Up @@ -417,7 +417,7 @@ public function testIsEnabledProductionEnv($domain, $isEnabled)
$this->assertTrue($bar->isEnabled(), 'When forced should always be on.');
}

public function domainsProvider()
public static function domainsProvider()
{
return [
['localhost', true],
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/View/Helper/CredentialsHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function testFilter($in, $out)
*
* @return array input, expected output
*/
public function credentialsProvider()
public static function credentialsProvider()
{
return [
[null, null],
Expand Down