helpers.php 282 B

123456789101112
  1. <?php
  2. /**
  3. * Calculate the percentage of success for a test
  4. *
  5. * @param array $suiteResults
  6. * @return float Percent
  7. */
  8. function percent($suiteResults) {
  9. $sum = $suiteResults['pass'] + $suiteResults['fail'];
  10. return round($suiteResults['pass'] * 100 / max($sum, 1), 2);
  11. }