Permalink
Browse files

Fix output buffering. Closes #23.

  • Loading branch information...
1 parent c78d546 commit 70eef79f073b94af6369fd38b4bcb557d5bc47b3 @NSinopoli NSinopoli committed Jan 14, 2012
Showing with 21 additions and 18 deletions.
  1. +6 −5 lib/VPU.php
  2. +1 −1 tests/PUTest.php
  3. +14 −12 ui/test.html
View
@@ -209,7 +209,7 @@ protected function _build_suite($suite) {
* @return string
*/
protected function _build_test($test) {
- if ( $test['variables_message'] && $test['status'] === 'failure' ) {
+ if ( $test['output'] && $test['status'] === 'failure' ) {
$test['expand'] = '-';
$test['display'] = 'show';
}
@@ -331,7 +331,7 @@ protected function _empty_file($filename) {
*/
protected function _format_test_results($test_results) {
$test_status = $this->_get_test_status($test_results['status'], $test_results['message']);
- $variables_message = ( isset($test_results['variables_message']) ) ? trim($test_results['variables_message']) : '';
+ $output = ( isset($test_results['output']) ) ? trim($test_results['output']) : '';
$trace_message = $this->_get_trace($test_results['trace']);
$test = array(
@@ -341,8 +341,8 @@ protected function _format_test_results($test_results) {
'name' => substr($test_results['test'], strpos($test_results['test'], '::') + 2),
'message' => $this->_get_message($test_results['message']) . 'Executed in ' . $test_results['time'] . ' seconds.',
'time' => $test_results['time'],
- 'variables_message' => $variables_message,
- 'variables_display' => ( $variables_message ) ? 'show' : 'hide',
+ 'output' => $output,
+ 'output_display' => ( $output ) ? 'show' : 'hide',
'trace_message' => $trace_message,
'trace_display' => ( $trace_message ) ? 'show' : 'hide'
);
@@ -602,10 +602,11 @@ protected function _parse_output($pu_output) {
$results = json_decode($results, true);
+ // For PHPUnit 3.5.x, which doesn't include test output in the JSON
$pu_output = explode('|||', $pu_output);
foreach ( $pu_output as $key => $data ) {
if ( $data ) {
- $results[$key]['variables_message'] = $data;
+ $results[$key]['output'] = $data;
}
}
View
@@ -1,6 +1,6 @@
<?php
-class PUTest extends PHPUnit_Framework_TestCase {
+class PUTest extends PHPUnit_Framework_TestCase {
public function test_this() {
$key = 'test';
$value = 'value';
View
@@ -1,17 +1,19 @@
- <div class="test <?php echo $test['status'];?>">
- <div class="light rounded"></div>
- <div class="name" title="Test Status: <?php echo ucfirst($test['status']);?>"><?php echo $test['name'];?></div>
+ <div class="test <?php echo $test['status'];?>">
+ <div class="light rounded"></div>
+ <div class="name" title="Test Status: <?php echo ucfirst($test['status']);?>"><?php echo $test['name'];?></div>
<div class="stats"><?php echo $test['message'];?></div>
<div class="expand button"><?php echo $test['expand'];?></div>
- <div class="more test <?php echo $test['display'];?>">
- <div class="variables rounded <?php echo $test['variables_display'];?>">
- <pre><?php echo $test['variables_message'];?></pre>
- </div>
- <div class="stacktrace rounded <?php echo $test['trace_display'];?>">
- <pre><?php echo $test['trace_message'];?></pre>
- </div>
- </div>
- </div>
+ <div class="more test <?php echo $test['display'];?>">
+ <div class="variables rounded <?php echo $test['output_display'];?>">
+ <strong>Debugging Output</strong>
+ <pre><?php echo $test['output'];?></pre>
+ </div>
+ <div class="stacktrace rounded <?php echo $test['trace_display'];?>">
+ <strong>Stack Trace</strong>
+ <pre><?php echo $test['trace_message'];?></pre>
+ </div>
+ </div>
+ </div>
<?php if ( $test['separator_display'] ) { ?>
<hr class="small" />
<?php } ?>

0 comments on commit 70eef79

Please sign in to comment.