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/Unit/Session/SessionFingerprintTest.php')
-rw-r--r--tests/PHPUnit/Unit/Session/SessionFingerprintTest.php56
1 files changed, 1 insertions, 55 deletions
diff --git a/tests/PHPUnit/Unit/Session/SessionFingerprintTest.php b/tests/PHPUnit/Unit/Session/SessionFingerprintTest.php
index 047fdd80df..e9bbdd9f38 100644
--- a/tests/PHPUnit/Unit/Session/SessionFingerprintTest.php
+++ b/tests/PHPUnit/Unit/Session/SessionFingerprintTest.php
@@ -43,7 +43,6 @@ class SessionFingerprintTest extends \PHPUnit_Framework_TestCase
{
$sessionVarValue = [
'ip' => 'someip',
- 'ua' => 'someua',
];
$_SESSION[SessionFingerprint::SESSION_INFO_SESSION_VAR_NAME] = $sessionVarValue;
@@ -57,68 +56,15 @@ class SessionFingerprintTest extends \PHPUnit_Framework_TestCase
public function test_initialize_SetsSessionVarsToCurrentRequest()
{
- $_SERVER['HTTP_USER_AGENT'] = 'test-user-agent';
$this->testInstance->initialize('testuser', self::TEST_TIME_VALUE);
$this->assertEquals('testuser', $_SESSION[SessionFingerprint::USER_NAME_SESSION_VAR_NAME]);
$this->assertEquals(
- ['ts' => self::TEST_TIME_VALUE, 'ua' => 'test-user-agent'],
+ ['ts' => self::TEST_TIME_VALUE],
$_SESSION[SessionFingerprint::SESSION_INFO_SESSION_VAR_NAME]
);
}
- public function test_initialize_DoesNotSetUserAgent_IfUserAgentIsNotInHttpRequest()
- {
- unset($_SERVER['HTTP_USER_AGENT']);
- $this->testInstance->initialize('testuser', self::TEST_TIME_VALUE);
-
- $this->assertEquals('testuser', $_SESSION[SessionFingerprint::USER_NAME_SESSION_VAR_NAME]);
- $this->assertEquals(
- ['ts' => self::TEST_TIME_VALUE, 'ua' => null],
- $_SESSION[SessionFingerprint::SESSION_INFO_SESSION_VAR_NAME]
- );
- }
-
- /**
- * @dataProvider getTestDataForIsMatchingCurrentRequest
- */
- public function test_isMatchingCurrentRequest_ChecksIfSessionVarsMatchRequest(
- $sessionUa, $requestUa, $expectedResult
- ) {
- $_SESSION[SessionFingerprint::SESSION_INFO_SESSION_VAR_NAME] = [
- 'ua' => $sessionUa,
- ];
-
- $_SERVER['HTTP_USER_AGENT'] = $requestUa;
-
- $this->assertEquals($expectedResult, $this->testInstance->isMatchingCurrentRequest());
- }
-
- public function getTestDataForIsMatchingCurrentRequest()
- {
- return [
- ['test ua', 'test ua', true],
- ['nontest ua', 'test ua', false],
- [null, 'test ua', false],
- ];
- }
-
- public function test_isMatchingCurrentRequest_ReturnsFalse_IfUserInfoSessionVarDoesNotExist()
- {
- $_SERVER['HTTP_USER_AGENT'] = 'test-ua';
-
- $this->assertEquals(false, $this->testInstance->isMatchingCurrentRequest());
- }
-
- public function test_isMatchingCurrentRequest_ReturnsFalse_IfRequestDetailsDoNotExist()
- {
- $_SESSION[SessionFingerprint::SESSION_INFO_SESSION_VAR_NAME] = [
- 'ua' => 'test-ua',
- ];
-
- $this->assertEquals(false, $this->testInstance->isMatchingCurrentRequest());
- }
-
public function test_getSessionStartTime_()
{
$_SESSION[SessionFingerprint::SESSION_INFO_SESSION_VAR_NAME] = [