You are here

function DrupalReporter::paintGroupEnd in SimpleTest 6

Same name and namespace in other branches
  1. 5 drupal_reporter.php \DrupalReporter::paintGroupEnd()

Paints the end of a group test. Will paint the page footer if the stack of tests has unwound.

@access public

Parameters

string $test_name Name of test that is ending.:

integer $progress Number of test cases ending.:

1 call to DrupalReporter::paintGroupEnd()
DrupalReporter::paintCaseEnd in ./drupal_reporter.php

File

./drupal_reporter.php, line 148

Class

DrupalReporter
Minimal drupal displayer. Accumulates output to $_output. Based on HtmlReporter by Marcus Baker

Code

function paintGroupEnd($test_name) {
  array_pop($this->_test_stack);
  $ok = $this
    ->getFailCount() + $this
    ->getExceptionCount() == 0;
  $class = $ok ? "simpletest-pass" : "simpletest-fail";
  $parent_weight = $this
    ->getParentWeight() - 0.5;

  /* Exception for the top groups, no subgrouping for singles */
  if ($this->_output_stack_id == 2 && $this->_output_stack[$this->_output_stack_id]['size'] == 1) {
    $this
      ->writeContent(format_plural($this
      ->getTestCaseProgress(), '1 test case complete: ', '@count test cases complete: '), -10);
    $parent_weight = $this
      ->getParentWeight() - 0.5;
    $this
      ->writeContent('<strong>' . $this
      ->getPassCount() . '</strong> passes, <strong>' . $this
      ->getFailCount() . '</strong> fails and <strong>' . $this
      ->getExceptionCount() . '</strong> exceptions.', $parent_weight, $class);
    array_pop($this->form_depth);
  }
  else {
    $collapsed = $ok ? TRUE : FALSE;
    if ($this
      ->getTestCaseProgress()) {
      $this
        ->writeContent(format_plural($this
        ->getTestCaseProgress(), '1 test case complete: ', '@count test cases complete: '), -10);
      $use_grouping = FALSE;
    }
    else {
      $use_grouping = TRUE;
    }
    $write = array(
      '#collapsible' => $use_grouping,
      '#collapsed' => $collapsed,
    );
    $this
      ->writeToLastField($this->form, $write, $this->form_depth);
    $this
      ->writeContent('<strong>' . $this
      ->getPassCount() . '</strong> passes, <strong>' . $this
      ->getFailCount() . '</strong> fails and <strong>' . $this
      ->getExceptionCount() . '</strong> exceptions.', $parent_weight, $class);
    if (count($this->test_stack) != 0) {
      $this
        ->writeContent(theme('table', array(), $this->test_stack));
      $this->test_stack = array();
    }
    array_pop($this->form_depth);
  }
  $this->_progress += array_pop($this->_progress_stack);
  $this->_exceptions += array_pop($this->_exceptions_stack);
  $this->_fails += array_pop($this->_fails_stack);
  $this->_passes += array_pop($this->_passes_stack);
}