Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/PHPUnit/bootstrap.php')
-rw-r--r--tests/PHPUnit/bootstrap.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index fe0d757b4d..8e72bcd125 100644
--- a/tests/PHPUnit/bootstrap.php
+++ b/tests/PHPUnit/bootstrap.php
@@ -25,6 +25,32 @@ if (!defined('PIWIK_INCLUDE_SEARCH_PATH')) {
error_reporting(E_ALL | E_NOTICE);
@date_default_timezone_set('UTC');
+$useXhprof = false;
+if ($useXhprof) {
+ require_once PIWIK_INCLUDE_PATH . '/tests/lib/xhprof-0.9.2/xhprof_lib/utils/xhprof_runs.php';
+
+ if (!isset($profilerNamespace)) {
+ $firstLineOfGitHead = file(PIWIK_INCLUDE_PATH . '/.git/HEAD');
+ $firstLineOfGitHead = $firstLineOfGitHead[0];
+
+ $parts = explode("/", $firstLineOfGitHead);
+ $currentGitBranch = trim($parts[2]);
+
+ $profilerNamespace = "piwik.$currentGitBranch";
+ }
+
+ xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
+
+ register_shutdown_function(function () use($profilerNamespace) {
+ $xhprofData = xhprof_disable();
+
+ $xhprofRuns = new \XHProfRuns_Default();
+ $runId = $xhprofRuns->save_run($xhprofData, $profilerNamespace);
+
+ echo "\n\nPROFILER RUN URL: /tests/lib/xhprof-0.9.2/xhprof_html/?source=$profilerNamespace&run=$runId\n\n";
+ });
+}
+
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';