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
path: root/tests
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2015-11-26 06:09:54 +0300
committermattab <matthieu.aubry@gmail.com>2015-11-26 06:09:54 +0300
commit92ef31deffbf4a9c44276370dc32df1419c796be (patch)
tree82eb94c03e32911e7dadb8e937fd792d6def503d /tests
parent926af9c74c67afc924e60fd6619ca499d1baab58 (diff)
Make sure local time has valid time format fixes #9052
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Unit/Tracker/RequestTest.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/PHPUnit/Unit/Tracker/RequestTest.php b/tests/PHPUnit/Unit/Tracker/RequestTest.php
index 3db5c22a4a..7eb38059a2 100644
--- a/tests/PHPUnit/Unit/Tracker/RequestTest.php
+++ b/tests/PHPUnit/Unit/Tracker/RequestTest.php
@@ -470,6 +470,25 @@ class RequestTest extends UnitTestCase
$this->assertContains($needle, $cookie . '');
}
+ public function test_getLocalTime()
+ {
+ $request = $this->buildRequest(array('h' => '12', 'm' => '34', 's' => '3'));
+ $this->assertSame('12:34:03', $request->getLocalTime());
+
+
+ $request = $this->buildRequest(array('h' => '23', 'm' => '59', 's' => '59'));
+ $this->assertSame('23:59:59', $request->getLocalTime());
+ }
+
+ public function test_getLocalTime_shouldReturnValidTime_whenTimeWasInvalid()
+ {
+ $request = $this->buildRequest(array('h' => '26', 'm' => '60', 's' => '333'));
+ $this->assertSame('00:00:00', $request->getLocalTime());
+
+ $request = $this->buildRequest(array('h' => '-26', 'm' => '-60', 's' => '-333'));
+ $this->assertSame('00:00:00', $request->getLocalTime());
+ }
+
public function test_getIdSite()
{
$request = $this->buildRequest(array('idsite' => '14'));