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/MockLocationProvider.php')
-rwxr-xr-xtests/PHPUnit/MockLocationProvider.php81
1 files changed, 39 insertions, 42 deletions
diff --git a/tests/PHPUnit/MockLocationProvider.php b/tests/PHPUnit/MockLocationProvider.php
index c8cbf12363..68c1c43502 100755
--- a/tests/PHPUnit/MockLocationProvider.php
+++ b/tests/PHPUnit/MockLocationProvider.php
@@ -8,46 +8,43 @@
class MockLocationProvider extends Piwik_UserCountry_LocationProvider
{
- public static $locations = array();
- private $currentLocation = 0;
- private $ipToLocations = array();
-
- public function getLocation( $info )
- {
- $ip = $info['ip'];
-
- if (isset($this->ipToLocations[$ip]))
- {
- $result = $this->ipToLocations[$ip];
- }
- else
- {
- $result = self::$locations[$this->currentLocation];
- $this->currentLocation = ($this->currentLocation + 1) % count(self::$locations);
-
- $this->ipToLocations[$ip] = $result;
- }
- $this->completeLocationResult($result);
- return $result;
- }
-
- public function getInfo()
- {
- return array('id' => 'mock_provider', 'title' => 'mock provider', 'description' => 'mock provider');
- }
-
- public function isAvailable()
- {
- return true;
- }
-
- public function isWorking()
- {
- return true;
- }
-
- public function getSupportedLocationInfo()
- {
- return array(); // unimplemented
- }
+ public static $locations = array();
+ private $currentLocation = 0;
+ private $ipToLocations = array();
+
+ public function getLocation($info)
+ {
+ $ip = $info['ip'];
+
+ if (isset($this->ipToLocations[$ip])) {
+ $result = $this->ipToLocations[$ip];
+ } else {
+ $result = self::$locations[$this->currentLocation];
+ $this->currentLocation = ($this->currentLocation + 1) % count(self::$locations);
+
+ $this->ipToLocations[$ip] = $result;
+ }
+ $this->completeLocationResult($result);
+ return $result;
+ }
+
+ public function getInfo()
+ {
+ return array('id' => 'mock_provider', 'title' => 'mock provider', 'description' => 'mock provider');
+ }
+
+ public function isAvailable()
+ {
+ return true;
+ }
+
+ public function isWorking()
+ {
+ return true;
+ }
+
+ public function getSupportedLocationInfo()
+ {
+ return array(); // unimplemented
+ }
}