Skip to content

Commit

Permalink
improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 16, 2021
1 parent 51ebd6e commit 1053e25
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if (empty($_GET['redirect'])) {
bdump('before redirect ' . date('H:i:s'));

header('Location: ' . (isset($_GET['ajax']) ? 'ajax.php' : 'redirect.php?&redirect=1'));
header('Location: ' . (isset($_GET['ajax']) ? 'ajax-fetch.php' : 'redirect.php?&redirect=1'));
exit;
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Tracy/Debugger.scream.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Debugger::enable();

@$x = &pi(); // E_NOTICE
@hex2bin('a'); // E_WARNING
@require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING (not working)
@require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING
// E_COMPILE_WARNING is handled in shutdownHandler() and does not know that @ was used
1 change: 1 addition & 0 deletions tests/Tracy/Debugger.shut-up.warnings.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ Debugger::enable();
@$x = &pi(); // E_NOTICE
@hex2bin('a'); // E_WARNING
@require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING
// E_COMPILE_WARNING is handled in shutdownHandler() and does not know that @ was used
11 changes: 8 additions & 3 deletions tests/Tracy/Debugger.warnings.console.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,21 @@ function third($arg1)
$x = &pi(); // E_NOTICE
hex2bin('a'); // E_WARNING
require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING
// E_COMPILE_WARNING is handled in shutdownHandler()
}


first(10, 'any string');
Assert::match(<<<'XX'
register_shutdown_function(function () {
Assert::match(<<<'XX'
Notice: Only variables should be assigned by reference in %a% on line %d%
Warning: hex2bin(): Hexadecimal input string must have an even length in %a% on line %d%
Warning: Unsupported declare 'foo' in %a% on line %d%
XX
, ob_get_clean());
, ob_get_clean());
});


first(10, 'any string');
4 changes: 1 addition & 3 deletions tests/Tracy/Debugger.warnings.html.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ Debugger::enable();

register_shutdown_function(function () {
$output = ob_get_clean();
Assert::match('
Warning: Unsupported declare \'foo\' in %a% on line %d%%A%', $output);

preg_match('#Tracy\.Debug\.init\((".*[^\\\\]")\)#', $output, $m);
$rawContent = json_decode($m[1]);
$panelContent = (string) DomQuery::fromHtml($rawContent)->find('#tracy-debug-panel-Tracy-errors')[0]['data-tracy-content'];
Expand Down Expand Up @@ -72,6 +69,7 @@ function third($arg1)
$x = &pi(); // E_NOTICE
hex2bin('a'); // E_WARNING
require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING
// E_COMPILE_WARNING is handled in shutdownHandler()
}


Expand Down
1 change: 1 addition & 0 deletions tests/Tracy/Debugger.warnings.production.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Debugger::enable();
$x = &pi(); // E_NOTICE
hex2bin('a'); // E_WARNING
require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING
// E_COMPILE_WARNING is handled in shutdownHandler()

0 comments on commit 1053e25

Please sign in to comment.