Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added filters method to Report to render all filters and updated html…

… and console strategies to use it
  • Loading branch information...
commit 944fd8f2492134c737d32f99015c90841b704a6a 1 parent b67d957
@indiefan indiefan authored gwoo committed
View
6 libraries/lithium/console/command/Test.php
@@ -99,10 +99,8 @@ public function run() {
$this->hr();
$this->out($report->render('stats', $report->stats()));
- foreach ($report->results['filters'] as $filter => $data) {
- $filterClass = explode("\\", $filter);
- $filterClass = array_pop($filterClass);
- $this->out($report->render(strtolower($filterClass), array("analysis" => $data)));
+ if ($filterResults = $report->filters("\n")) {
+ $this->out($filterResults);
}
$this->hr();
View
17 libraries/lithium/test/Report.php
@@ -213,6 +213,23 @@ public function render($template, $data = array()) {
return ob_get_clean();
});
}
+
+ /**
+ * Loops through and renders each filter that currently has stored results
+ *
+ * @param string $separator Optional separator string to join the templates on
+ * @return string|boolean
+ */
+ public function filters($separator = null) {
+ $output = false;
+ foreach ($this->results['filters'] as $filter => $analysis) {
+ $filterClass = explode("\\", $filter);
+ $filterClass = array_pop($filterClass);
+ $output .= $separator . $this->render(strtolower($filterClass), compact('analysis'));
+ }
+
+ return $output;
+ }
}
?>
View
6 libraries/lithium/test/templates/html/layout.html.php
@@ -56,11 +56,7 @@ function($class) use ($request) {
<?php
echo $report->render("stats", $report->stats());
- foreach ($report->results['filters'] as $filter => $data) {
- $filterClass = explode("\\", $filter);
- $filterClass = array_pop($filterClass);
- echo $report->render(strtolower($filterClass), array("analysis" => $data));
- }
+ echo $report->filters();
?>
</div>
</article>
Please sign in to comment.
Something went wrong with that request. Please try again.