mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +01:00
Miscellaneous > variableDump() method > remove, because unnecessary
This commit is contained in:
@@ -296,34 +296,6 @@ class Miscellaneous
|
|||||||
return $effect;
|
return $effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays variable content as preformatted text (fixed-width font and preserves both spaces and line breaks)
|
|
||||||
*
|
|
||||||
* If xdebug php module is loaded, displays variable using var_dump(), otherwise <pre>var_dump()</pre>.
|
|
||||||
* You can pass as many variables as you wish.
|
|
||||||
*
|
|
||||||
* Pass each variable as argument of this function. Amount unlimited. Variables are loaded using the
|
|
||||||
* func_get_args() function (@see http://pl1.php.net/manual/en/function.func-get-args.php).
|
|
||||||
*/
|
|
||||||
public static function variableDump()
|
|
||||||
{
|
|
||||||
$xdebugLoaded = self::isPhpModuleLoaded('xdebug');
|
|
||||||
|
|
||||||
if (!$xdebugLoaded) {
|
|
||||||
echo '<pre>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$arguments = func_get_args();
|
|
||||||
|
|
||||||
foreach ($arguments as $argument) {
|
|
||||||
var_dump($argument);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$xdebugLoaded) {
|
|
||||||
echo '</pre>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information if given PHP module is compiled and loaded
|
* Returns information if given PHP module is compiled and loaded
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -156,33 +156,6 @@ class MiscellaneousTest extends BaseTestCase
|
|||||||
self::assertFalse(Miscellaneous::isPhpModuleLoaded('xyz123'));
|
self::assertFalse(Miscellaneous::isPhpModuleLoaded('xyz123'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testVariableDump()
|
|
||||||
{
|
|
||||||
$xdebugLoaded = Miscellaneous::isPhpModuleLoaded('xdebug');
|
|
||||||
|
|
||||||
$variable = 123;
|
|
||||||
$expected = "int(123)\n";
|
|
||||||
|
|
||||||
if ($xdebugLoaded) {
|
|
||||||
$libraryPath = realpath(sprintf('%s%s', __DIR__, '/../..'));
|
|
||||||
$filePath = sprintf('%s%s', $libraryPath, '/src/Utilities/Miscellaneous.php:');
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Attention. I have to use "\d+" at the end of $filePath, because number of line may be different if new
|
|
||||||
* method / function will be created.
|
|
||||||
*/
|
|
||||||
$filePathQuoted = sprintf('%s\d+\:', preg_quote($filePath, '/'));
|
|
||||||
|
|
||||||
$expectedPattern = sprintf("/%s\n%s/", $filePathQuoted, preg_quote($expected, '/'));
|
|
||||||
$this->expectOutputRegex($expectedPattern);
|
|
||||||
} else {
|
|
||||||
$expected = sprintf('<pre>%s</pre>', $expected);
|
|
||||||
$this->expectOutputString($expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
Miscellaneous::variableDump($variable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $string Empty value, e.g. ""
|
* @param mixed $string Empty value, e.g. ""
|
||||||
* @dataProvider provideEmptyValue
|
* @dataProvider provideEmptyValue
|
||||||
|
|||||||
Reference in New Issue
Block a user