Example #1
0
 /**
  * @dataProvider update_web_root_path_data
  */
 public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction)
 {
     $symfony_request = $this->getMock('\\phpbb\\symfony_request', array(), array(new phpbb_mock_request()));
     $symfony_request->expects($this->any())->method('getPathInfo')->will($this->returnValue($getPathInfo));
     $symfony_request->expects($this->any())->method('getRequestUri')->will($this->returnValue($getRequestUri));
     $symfony_request->expects($this->any())->method('getScriptName')->will($this->returnValue($getScriptName));
     $path_helper = new \phpbb\path_helper($symfony_request, new \phpbb\filesystem\filesystem(), $this->getMock('\\phpbb\\request\\request'), $this->phpbb_root_path, 'php');
     $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input, $symfony_request));
 }
Example #2
0
/**
* Eliminates useless . and .. components from specified path.
*
* Deprecated, use filesystem class instead
*
* @param string $path Path to clean
* @return string Cleaned path
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
*/
function phpbb_clean_path($path)
{
    global $phpbb_path_helper, $phpbb_container;
    if (!$phpbb_path_helper && $phpbb_container) {
        /* @var $phpbb_path_helper \phpbb\path_helper */
        $phpbb_path_helper = $phpbb_container->get('path_helper');
    } else {
        if (!$phpbb_path_helper) {
            global $phpbb_root_path, $phpEx;
            // The container is not yet loaded, use a new instance
            if (!class_exists('\\phpbb\\path_helper')) {
                require $phpbb_root_path . 'phpbb/path_helper.' . $phpEx;
            }
            $request = new phpbb\request\request();
            $phpbb_path_helper = new phpbb\path_helper(new phpbb\symfony_request($request), new phpbb\filesystem\filesystem(), $request, $phpbb_root_path, $phpEx);
        }
    }
    return $phpbb_path_helper->clean_path($path);
}