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 )) {
8
+ class_alias ('\PHPUnit\Framework\TestCase ' , '\PHPUnit_Framework_TestCase ' );
9
+ }
10
+
5
11
/**
6
12
* Wrapper class for testing purpose
7
13
*/
@@ -79,12 +85,12 @@ public function setUp()
79
85
$ _SERVER ['HTTPS ' ] = null ;
80
86
81
87
$ this ->config = include (__DIR__ .'/../libs/config.sample.php ' );
82
-
88
+
83
89
// Create an instance of config file -- for testing
84
90
$ data = file_get_contents (__DIR__ .'/../libs/config.sample.php ' );
85
- file_put_contents (__DIR__ .'/../libs/config.php ' , $ data );
91
+ file_put_contents (__DIR__ .'/../libs/config.php ' , $ data );
86
92
87
- if (!defined ('__TESTING_CSRFP__ ' )) define ('__TESTING_CSRFP__ ' , true );
93
+ if (!defined ('__TESTING_CSRFP__ ' )) define ('__TESTING_CSRFP__ ' , true );
88
94
}
89
95
90
96
/**
@@ -100,7 +106,7 @@ public function tearDown()
100
106
*/
101
107
public function testRefreshToken ()
102
108
{
103
-
109
+
104
110
$ val = $ _COOKIE [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = '123abcd ' ;
105
111
$ _SESSION [csrfprotector::$ config ['CSRFP_TOKEN ' ]] = array ('123abcd ' );
106
112
csrfProtector::$ config ['tokenLength ' ] = 20 ;
@@ -439,4 +445,4 @@ public function testModCSRFPEnabledException()
439
445
$ this ->assertTrue ($ temp == $ _SESSION [csrfprotector::$ config ['CSRFP_TOKEN ' ]][0 ]);
440
446
$ this ->assertTrue ($ temp == $ _COOKIE [csrfprotector::$ config ['CSRFP_TOKEN ' ]]);
441
447
}
442
- }
448
+ }
0 commit comments