Skip to content

Commit af37242

Browse files
committed
add phpunit markup script
1 parent cc1cf35 commit af37242

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ $ docker exec -it "$container" bash
109109

110110
For `/path/to/tests/`, you usually want `./test/functional/` but you can select a specific file to save time when troubleshooting specific tests.
111111

112+
Note: To enhance the stack traces in `phpunit`'s output, pipe the output to `./test/phpunit-markup.php`.
113+
112114
### code coverage
113115

114116
`phpunit` has code coverage built in.

test/phpunit-markup.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env php
2+
<?php while ($line = fgets(STDIN)) {
3+
$line = rtrim($line, "\n");
4+
if (preg_match('/\s*^(\/.*):(\d+)$/', $line, $matches)) {
5+
[$path, $lineNumber] = [$matches[1], intval($matches[2]) - 1];
6+
$src_line = trim(file($path)[$lineNumber]);
7+
echo "$line \033[36m$src_line\033[0m\n";
8+
} else {
9+
echo "$line\n";
10+
}
11+
}

0 commit comments

Comments
 (0)