23 import(
'lib.pkp.tests.PKPTestHelper');
25 use PHPUnit\Framework\TestCase;
54 protected function setUp() : void {
55 $this->setBackupGlobals(
true);
63 if(function_exists(
'_array_change_key_case')) {
64 global $ADODB_INCLUDED_LIB;
65 $ADODB_INCLUDED_LIB = 1;
76 $this->registryBackup[$mockedRegistryKey] =
Registry::get($mockedRegistryKey);
86 Registry::set($mockedRegistryKey, $this->registryBackup[$mockedRegistryKey]);
116 $configFile = $this->getConfigFile($config, $configPath);
143 protected function mockRequest($path =
'index/test-page/test-op', $userId =
null) {
145 if (!isset($this->registryBackup[
'request'])) {
146 $this->mockedRegistryKeys[] =
'request';
153 $_SERVER[
'REQUEST_METHOD'] =
'GET';
154 $_SERVER[
'PATH_INFO'] = $path;
156 import(
'classes.core.PageRouter');
161 import(
'lib.pkp.classes.core.Dispatcher');
164 $router->setDispatcher($dispatcher);
165 $request->setRouter($router);
168 $session = $request->getSession();
169 $session->setUserId($userId);
184 private function getConfigFile($config, $configPath =
'config') {
186 return './lib/pkp/tests/'.$configPath.
'/config.'.$config.
'.inc.php';