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

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIsaac Bennetch <bennetch@gmail.com>2019-05-10 20:03:23 +0300
committerGitHub <noreply@github.com>2019-05-10 20:03:23 +0300
commit191d0485b6f76073f58aa74d7dc762d6a3cdba6f (patch)
tree2e9d1261d5d2078aa21a2c7ed3f12158645def6c /test
parent3500da154f43b45b4220dc9d407ce5cd4532f887 (diff)
parentb5245272db3ae66a4aca3b7ee7105bb857424d22 (diff)
Merge pull request #15246 from williamdes/bugfix/issue-14412-auth-signon
Fix #14412 - AuthenticationSignon.php's showFailure function does not consider SignonCookieParams
Diffstat (limited to 'test')
-rw-r--r--test/classes/Plugins/Auth/AuthenticationSignonTest.php43
1 files changed, 38 insertions, 5 deletions
diff --git a/test/classes/Plugins/Auth/AuthenticationSignonTest.php b/test/classes/Plugins/Auth/AuthenticationSignonTest.php
index 262dd2301e..b7c6a4d7cd 100644
--- a/test/classes/Plugins/Auth/AuthenticationSignonTest.php
+++ b/test/classes/Plugins/Auth/AuthenticationSignonTest.php
@@ -278,7 +278,7 @@ class AuthenticationSignonTest extends PmaTestCase
$GLOBALS['cfg']['Server']['SignonSession'] = 'newSession';
$_COOKIE['newSession'] = '42';
- $this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationSignon')
+ $this->object = $this->getMockBuilder(AuthenticationSignon::class)
->disableOriginalConstructor()
->setMethods(array('showLoginForm'))
->getMock();
@@ -305,7 +305,7 @@ class AuthenticationSignonTest extends PmaTestCase
$GLOBALS['cfg']['Server']['SignonSession'] = 'newSession';
$_COOKIE['newSession'] = '42';
- $this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationSignon')
+ $this->object = $this->getMockBuilder(AuthenticationSignon::class)
->disableOriginalConstructor()
->setMethods(array('showLoginForm'))
->getMock();
@@ -331,7 +331,7 @@ class AuthenticationSignonTest extends PmaTestCase
$GLOBALS['cfg']['Server']['SignonSession'] = 'newSession';
$_COOKIE['newSession'] = '42';
- $this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationSignon')
+ $this->object = $this->getMockBuilder(AuthenticationSignon::class)
->disableOriginalConstructor()
->setMethods(array('showLoginForm'))
->getMock();
@@ -359,7 +359,7 @@ class AuthenticationSignonTest extends PmaTestCase
$GLOBALS['cfg']['Server']['SignonSession'] = 'newSession';
$_COOKIE['newSession'] = '42';
- $this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationSignon')
+ $this->object = $this->getMockBuilder(AuthenticationSignon::class)
->disableOriginalConstructor()
->setMethods(array('showLoginForm'))
->getMock();
@@ -395,7 +395,7 @@ class AuthenticationSignonTest extends PmaTestCase
$GLOBALS['cfg']['Server']['SignonSession'] = 'newSession';
$_COOKIE['newSession'] = '42';
- $this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Auth\AuthenticationSignon')
+ $this->object = $this->getMockBuilder(AuthenticationSignon::class)
->disableOriginalConstructor()
->setMethods(array('showLoginForm'))
->getMock();
@@ -420,4 +420,37 @@ class AuthenticationSignonTest extends PmaTestCase
$_SESSION['PMA_single_signon_error_message']
);
}
+
+ /**
+ * Test for PhpMyAdmin\Plugins\Auth\AuthenticationSignon::setCookieParams
+ *
+ * @return void
+ */
+ public function testSetCookieParamsDefaults()
+ {
+ $this->object = $this->getMockBuilder(AuthenticationSignon::class)
+ ->disableOriginalConstructor()
+ ->setMethods(array('setCookieParams'))
+ ->getMock();
+
+ $this->object->setCookieParams(array());
+
+ $defaultOptions = array(
+ 'lifetime' => 0,
+ 'path' => '/',
+ 'domain' => '',
+ 'secure' => false,
+ 'httponly' => false,
+ 'samesite' => ''
+ );
+ // php did not set 'samesite' attribute in session_get_cookie_params since not yet implemented
+ if (version_compare(phpversion(), '7.3.0', '<')) {
+ unset($defaultOptions['samesite']);
+ }
+
+ $this->assertSame(
+ $defaultOptions,
+ session_get_cookie_params()
+ );
+ }
}