diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-07 21:44:15 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-07 21:44:15 +0400 |
commit | a54c7abc8be56f37a03c557a6c58ac6221efa983 (patch) | |
tree | d07cf11190a45b66d462db871a6a86938e04680b /plugins/ExampleUI | |
parent | 5d334538cdd3e3bc1112612903b7f5593c51b7e8 (diff) |
Fix ui tests.
Diffstat (limited to 'plugins/ExampleUI')
-rw-r--r-- | plugins/ExampleUI/API.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/plugins/ExampleUI/API.php b/plugins/ExampleUI/API.php index 968f393ec6..7e60434c8e 100644 --- a/plugins/ExampleUI/API.php +++ b/plugins/ExampleUI/API.php @@ -23,6 +23,8 @@ use Piwik\DataTable; */ class API { + public static $disableRandomness = false; + private static $instance = null; /** @@ -43,8 +45,14 @@ class API $period = new Range($period, 'last30'); foreach ($period->getSubperiods() as $subPeriod) { - $server1 = mt_rand(50, 90); - $server2 = mt_rand(40, 110); + if (self::$disableRandomness) { + $server1 = 50; + $server2 = 40; + } else { + $server1 = mt_rand(50, 90); + $server2 = mt_rand(40, 110); + } + $value = array('server1' => $server1, 'server2' => $server2); $temperatures[$subPeriod->getLocalizedShortString()] = $value; @@ -61,7 +69,9 @@ class API ); $temperatureValues = array_slice(range(50, 90), 0, count($xAxis)); - shuffle($temperatureValues); + if (!self::$disableRandomness) { + shuffle($temperatureValues); + } $temperatures = array(); foreach ($xAxis as $i => $xAxisLabel) { @@ -101,4 +111,4 @@ class API return $planetsDataTable; } -} +}
\ No newline at end of file |