Page MenuHomeDevCentral

No OneTemporary

diff --git a/composer.json b/composer.json
index 5a1dd2f..2150028 100644
--- a/composer.json
+++ b/composer.json
@@ -1,71 +1,71 @@
{
"name": "keruald/keruald",
"type": "library",
"description": "Modular libraries to build frameworks and applications",
"keywords": [
"framework",
"keruald"
],
"license": "BSD-2-Clause",
"homepage": "https://keruald.nasqueron.org",
"authors": [
{
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
},
{
"name": "Keruald contributors"
}
],
"provide": {
"psr/simple-cache-implementation": "1.0|2.0|3.0"
},
"require": {
"psr/simple-cache": "^1.0|^2.0|^3.0",
"ext-intl": "*"
},
"require-dev": {
"ext-mbstring": "*",
"ext-mysqli": "*",
"ext-xmlwriter": "*",
"nasqueron/codestyle": "^0.1.2",
"phan/phan": "^5.3.1",
"phpunit/phpunit": "^10.2",
"symfony/yaml": "^6.0.3",
"squizlabs/php_codesniffer": "^4.0.0"
},
"suggest": {
"ext-memcached": "*",
"ext-redis": "*"
},
"replace": {
"keruald/cache": "0.1.0",
"keruald/commands": "0.0.1",
"keruald/database": "0.5.2",
"keruald/github": "0.2.1",
- "keruald/omnitools": "0.15.0",
+ "keruald/omnitools": "0.15.1",
"keruald/report": "0.1.0"
},
"autoload": {
"psr-4": {
"Keruald\\Cache\\": "cache/src/",
"Keruald\\Cache\\Tests\\": "cache/tests/",
"Keruald\\Commands\\": "commands/src/",
"Keruald\\Commands\\Tests\\": "commands/tests/",
"Keruald\\Database\\": "database/src/",
"Keruald\\Database\\Tests\\": "database/tests/",
"Keruald\\GitHub\\": "github/src/",
"Keruald\\GitHub\\Tests\\": "github/tests/",
"Keruald\\OmniTools\\": "omnitools/src/",
"Keruald\\OmniTools\\Tests\\": "omnitools/tests/",
"Keruald\\Reporting\\": "report/src/",
"Keruald\\Reporting\\Tests\\": "report/tests/"
}
},
"scripts": {
"lint-src": "find */src -type f -name '*.php' | xargs -n1 php -l",
"lint-tests": "find */tests -type f -name '*.php' | xargs -n1 php -l",
"test": "vendor/bin/phpunit"
},
"minimum-stability": "dev"
}
diff --git a/omnitools/src/Debug/_register_to_global_space.php b/omnitools/src/Debug/_register_to_global_space.php
index e0ebd55..b90a17d 100644
--- a/omnitools/src/Debug/_register_to_global_space.php
+++ b/omnitools/src/Debug/_register_to_global_space.php
@@ -1,17 +1,21 @@
<?php
/* This code is intentionally left in the global namespace. */
use Keruald\OmniTools\Debug\Debugger;
+const SQL_ERROR = 65;
+const HACK_ERROR = 99;
+const GENERAL_ERROR = 117;
+
if (!function_exists("dprint_r")) {
function dprint_r ($variable) {
Debugger::printVariable($variable);
}
}
if (!function_exists("dieprint_r")) {
function dieprint_r ($variable) {
Debugger::printVariableAndDie($variable);
}
}
diff --git a/omnitools/tests/Debug/DebuggerTest.php b/omnitools/tests/Debug/DebuggerTest.php
index ae2e81a..fc6707d 100644
--- a/omnitools/tests/Debug/DebuggerTest.php
+++ b/omnitools/tests/Debug/DebuggerTest.php
@@ -1,55 +1,56 @@
<?php
declare(strict_types=1);
namespace Keruald\OmniTools\Tests\Debug;
use Keruald\OmniTools\Debug\Debugger;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class DebuggerTest extends TestCase {
///
/// Unit tests
///
public function testRegister () {
$this->assertTestSuiteStateIsValid();
Debugger::register();
$this->assertTrue(function_exists("dprint_r"));
+ $this->assertTrue(defined("SQL_ERROR"));
}
private function assertTestSuiteStateIsValid() : void {
$this->assertFalse(
function_exists("dprint_r"),
"Configure the test suite so dprint_r isn't in global space first."
);
}
///
/// Integration tests
///
#[DataProvider('provideDebuggerScripts')]
public function testDebuggerScript ($script, $message) : void {
$this->assertProgramMatchesOutput($script, $message);
}
private function assertProgramMatchesOutput(string $script, string $message = "") : void {
$filename = __DIR__ . "/testers/$script";
$expected = file_get_contents($filename . ".txt");
$actual = `php $filename.php`;
$this->assertSame($expected, $actual, $message);
}
public static function provideDebuggerScripts () : iterable {
yield ["dump_integer", "Can't dump a variable"];
yield ["dump_array", "Can't dump an array"];
yield ["dump_object", "Can't dump an object"];
yield ["check_die", "printVariableAndDie doesn't die"];
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, May 3, 05:49 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3677697
Default Alt Text
(4 KB)

Event Timeline