2
2
date_default_timezone_set ('UTC ' );
3
3
require_once __DIR__ .'/../libs/csrf/csrfprotector.php ' ;
4
4
5
- if (!class_exists ('\PHPUnit\Framework\TestCase ' , true )) {
6
- class_alias ('\PHPUnit_Framework_TestCase ' , '\PHPUnit\Framework\TestCase ' );
7
- } elseif (!class_exists ('\PHPUnit_Framework_TestCase ' , true )) {
5
+ if (intval (phpversion ('tidy ' )) >= 7 && !class_exists ('\PHPUnit_Framework_TestCase ' , true )) {
8
6
class_alias ('\PHPUnit\Framework\TestCase ' , '\PHPUnit_Framework_TestCase ' );
9
7
}
10
8
@@ -79,8 +77,11 @@ public function setUp()
79
77
$ _SERVER ['REQUEST_SCHEME ' ] = 'http ' ; // For authorizePost
80
78
$ _SERVER ['HTTP_HOST ' ] = 'test ' ; // For isUrlAllowed
81
79
$ _SERVER ['PHP_SELF ' ] = '/index.php ' ; // For authorizePost
82
- $ _POST [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = $ _GET [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = '123 ' ;
83
- $ _SESSION [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = array ('abc ' ); //token mismatch - leading to failed validation
80
+ $ _POST [csrfprotector::$ config ['CSRFP_TOKEN ' ]]
81
+ = $ _GET [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = '123 ' ;
82
+
83
+ //token mismatch - leading to failed validation
84
+ $ _SESSION [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = array ('abc ' );
84
85
$ _SERVER ['SERVER_PROTOCOL ' ] = 'HTTP/1.1 ' ;
85
86
$ _SERVER ['HTTPS ' ] = null ;
86
87
@@ -106,7 +107,6 @@ public function tearDown()
106
107
*/
107
108
public function testRefreshToken ()
108
109
{
109
-
110
110
$ val = $ _COOKIE [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = '123abcd ' ;
111
111
$ _SESSION [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = array ('123abcd ' );
112
112
csrfProtector::$ config ['tokenLength ' ] = 20 ;
0 commit comments