diff --git a/src/Debug/Debugger.php b/src/Debug/Debugger.php new file mode 100644 --- /dev/null +++ b/src/Debug/Debugger.php @@ -0,0 +1,32 @@ + block + * + * @param mixed $variable the variable to dump + */ + public static function printVariable ($variable) : void { + echo "
";
+        print_r($variable);
+        echo "
"; + } + + public static function printVariableAndDie ($variable) : void { + static::printVariable($variable); + die; + } + + /// + /// Comfort debug helper to register debug method in global space + /// + + public static function register () : void { + require_once '_register_to_global_space.php'; + } + +} diff --git a/src/Debug/_register_to_global_space.php b/src/Debug/_register_to_global_space.php new file mode 100644 --- /dev/null +++ b/src/Debug/_register_to_global_space.php @@ -0,0 +1,17 @@ +assertTestSuiteStateIsValid(); + + Debugger::register(); + + $this->assertTrue(function_exists("dprint_r")); + } + + private function assertTestSuiteStateIsValid() : void { + $this->assertFalse( + function_exists("dprint_r"), + "Configure the test suite so dprint_r isn't in global space first." + ); + } + +}