Skip to content

Commit 1cc588e

Browse files
committed
refactor: internal cleanup and tooling alignment
1 parent 792e921 commit 1cc588e

File tree

3 files changed

+11
-25
lines changed

3 files changed

+11
-25
lines changed

app/Config/Toolbar.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of CodeIgniter 4 framework.
5-
*
6-
* (c) CodeIgniter Foundation <[email protected]>
7-
*
8-
* For the full copyright and license information, please view
9-
* the LICENSE file that was distributed with this source code.
10-
*/
11-
123
namespace Config;
134

145
use CodeIgniter\Config\BaseConfig;
@@ -144,12 +135,12 @@ class Toolbar extends BaseConfig
144135
* (such as infinite loops or "Maximum call stack size exceeded").
145136
*
146137
* Any request containing one of the following headers is treated as a
147-
* client-managed or partial request, and the Debug Toolbar injection is skipped.s
138+
* client-managed or partial request, and the Debug Toolbar injection is skipped.
148139
*
149140
* @var list<string>
150141
*/
151142
public array $disableOnHeaders = [
152-
'HX-Request', // HTMX partial requests
153-
'X-Up-Version', // Unpoly partial requests
143+
'HX-Request', // HTMX partial requests
144+
'X-Up-Version', // Unpoly partial requests
154145
];
155146
}

system/Boot.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ public static function bootTest(Paths $paths): void
145145
static::loadEnvironmentBootstrap($paths, false);
146146

147147
static::loadCommonFunctionsMock();
148-
149148
static::loadCommonFunctions();
149+
150150
static::loadAutoloader();
151151
static::setExceptionHandler();
152152
static::initializeKint();
@@ -262,6 +262,11 @@ protected static function loadCommonFunctions(): void
262262
require_once SYSTEMPATH . 'Common.php';
263263
}
264264

265+
protected static function loadCommonFunctionsMock(): void
266+
{
267+
require_once SYSTEMPATH . 'Test/Mock/MockCommon.php';
268+
}
269+
265270
/**
266271
* The autoloader allows all the pieces to work together in the framework.
267272
* We have to load it here, though, so that the config files can use the
@@ -391,12 +396,4 @@ protected static function runCommand(Console $console): int
391396

392397
return is_int($exit) ? $exit : EXIT_SUCCESS;
393398
}
394-
395-
protected static function loadCommonFunctionsMock(): void
396-
{
397-
// Require system/Test/Mock/MockCommon.php
398-
if (is_file(SYSTEMPATH . 'Test/Mock/MockCommon.php')) {
399-
require_once SYSTEMPATH . 'Test/Mock/MockCommon.php';
400-
}
401-
}
402399
}

tests/system/Debug/ToolbarTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ final class ToolbarTest extends CIUnitTestCase
3333
private ToolbarConfig $config;
3434
private ?IncomingRequest $request = null;
3535
private ?ResponseInterface $response = null;
36-
private bool $originalIsCli;
3736

3837
protected function setUp(): void
3938
{
4039
parent::setUp();
4140
Services::reset();
4241

43-
$this->originalIsCli = is_cli();
4442
is_cli(false);
4543

4644
$this->config = new ToolbarConfig();
@@ -56,8 +54,8 @@ protected function setUp(): void
5654

5755
protected function tearDown(): void
5856
{
59-
// Restore original is_cli state
60-
is_cli($this->originalIsCli);
57+
// Restore is_cli state
58+
is_cli();
6159

6260
parent::tearDown();
6361
}

0 commit comments

Comments
 (0)