Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fix tests
  • Loading branch information
LordSimal committed Nov 3, 2025
commit 1eac4cd1affa7f4fb5efdd116fe848a74a2ffcfe
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"require-dev": {
"cakephp/authorization": "^3.0",
"cakephp/cakephp-codesniffer": "^5.0",
"phpunit/phpunit": "^10.5.5 || ^11.1.3"
"phpunit/phpunit": "^10.5.32 || ^11.1.3"
},
"suggest": {
"ext-pdo_sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."
Expand Down
10 changes: 7 additions & 3 deletions tests/TestCase/ToolbarServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Cake\TestSuite\TestCase;
use DebugKit\Model\Entity\Request as RequestEntity;
use DebugKit\Panel\SqlLogPanel;
use DebugKit\TestApp\Panel\SimplePanel;
use DebugKit\ToolbarService;
use PHPUnit\Framework\Attributes\DataProvider;

Expand Down Expand Up @@ -528,9 +529,12 @@ public function testSaveDataSerializationError()
$bar->loadPanels();

// Create a panel with unserializable data
$panel = $bar->registry()->load('DebugKit.TestApp\Panel\SimplePanel');
/** @var SimplePanel $panel */
$panel = $bar->registry()->load('DebugKit.TestApp\Panel\SimplePanel', [
'className' => SimplePanel::class,
]);
// Mock the data() method to return something problematic
$panel->_data = ['closure' => fn () => 'test'];
$panel->setData(['closure' => fn() => 'test']);

$row = $bar->saveData($request, $response);
$this->assertNotEmpty($row, 'Should save data even with serialization errors');
Expand All @@ -544,7 +548,7 @@ public function testSaveDataSerializationError()
// Find the SimplePanel in the results
$simplePanel = null;
foreach ($result->panels as $p) {
if ($p->panel === 'SimplePanel') {
if ($p->panel === 'DebugKit.TestApp\Panel\SimplePanel') {
$simplePanel = $p;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
]);

Cache::setConfig([
'_cake_core_' => [
'_cake_translations_' => [
'engine' => 'File',
'prefix' => 'cake_core_',
'prefix' => 'cake_translations_',
'serialize' => true,
],
'_cake_model_' => [
Expand Down
4 changes: 4 additions & 0 deletions tests/test_app/Panel/SimplePanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@
*/
class SimplePanel extends DebugPanel
{
public function setData(array $data): void
{
$this->_data = $data;
}
}
Loading