Skip to content

Commit 1eac4cd

Browse files
committed
fix tests
1 parent d9b6368 commit 1eac4cd

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"require-dev": {
3737
"cakephp/authorization": "^3.0",
3838
"cakephp/cakephp-codesniffer": "^5.0",
39-
"phpunit/phpunit": "^10.5.5 || ^11.1.3"
39+
"phpunit/phpunit": "^10.5.32 || ^11.1.3"
4040
},
4141
"suggest": {
4242
"ext-pdo_sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."

tests/TestCase/ToolbarServiceTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Cake\TestSuite\TestCase;
2727
use DebugKit\Model\Entity\Request as RequestEntity;
2828
use DebugKit\Panel\SqlLogPanel;
29+
use DebugKit\TestApp\Panel\SimplePanel;
2930
use DebugKit\ToolbarService;
3031
use PHPUnit\Framework\Attributes\DataProvider;
3132

@@ -528,9 +529,12 @@ public function testSaveDataSerializationError()
528529
$bar->loadPanels();
529530

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

535539
$row = $bar->saveData($request, $response);
536540
$this->assertNotEmpty($row, 'Should save data even with serialization errors');
@@ -544,7 +548,7 @@ public function testSaveDataSerializationError()
544548
// Find the SimplePanel in the results
545549
$simplePanel = null;
546550
foreach ($result->panels as $p) {
547-
if ($p->panel === 'SimplePanel') {
551+
if ($p->panel === 'DebugKit.TestApp\Panel\SimplePanel') {
548552
$simplePanel = $p;
549553
break;
550554
}

tests/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@
7171
]);
7272

7373
Cache::setConfig([
74-
'_cake_core_' => [
74+
'_cake_translations_' => [
7575
'engine' => 'File',
76-
'prefix' => 'cake_core_',
76+
'prefix' => 'cake_translations_',
7777
'serialize' => true,
7878
],
7979
'_cake_model_' => [

tests/test_app/Panel/SimplePanel.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@
2222
*/
2323
class SimplePanel extends DebugPanel
2424
{
25+
public function setData(array $data): void
26+
{
27+
$this->_data = $data;
28+
}
2529
}

0 commit comments

Comments
 (0)