From ddf6e20ba0ac8ca88384d025c31f5cd5d47c8a7d Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@afi-sa.fr>
Date: Wed, 3 Feb 2016 14:49:15 +0100
Subject: [PATCH] dev #37100 add helper to profile some code in unit tests

---
 .../modules/AbstractControllerTestCase.php       | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php
index e0824891d8e..0a03f2d15a8 100644
--- a/tests/application/modules/AbstractControllerTestCase.php
+++ b/tests/application/modules/AbstractControllerTestCase.php
@@ -307,6 +307,22 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe
         $this->fail("Flash messenger contains a popup");
     }
   }
+
+
+
+  public function xhprofile($closure) {
+    xhprof_enable();
+
+    $closure();
+
+    $xhprof_data = xhprof_disable();
+    require_once "xhprof/xhprof_lib/utils/xhprof_lib.php";
+    require_once "xhprof/xhprof_lib/utils/xhprof_runs.php";
+
+    $xhprof_runs = new XHProfRuns_Default();
+    $run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_testing");
+    var_dump('XHProfile data: ' . BASE_URL."/xhprof/xhprof_html/index.php?run={$run_id}&source=xhprof_testing");
+  }
 }
 
 ?>
\ No newline at end of file
-- 
GitLab