/**
	 * Test...
	 *
	 * @covers  JFilesystemHelper::isJoomlaStream
	 *
	 * @return void
	 */
	public function testIsJoomlaStream()
	{
		$this->assertTrue(
			JFilesystemHelper::isJoomlaStream('string')
		);

		$this->assertFalse(
			JFilesystemHelper::isJoomlaStream('unknown')
		);
	}
 /**
  * Generic File Operations
  *
  * Open a stream with some lazy loading smarts
  *
  * @param   string    $filename              Filename
  * @param   string    $mode                  Mode string to use
  * @param   boolean   $use_include_path      Use the PHP include path
  * @param   resource  $context               Context to use when opening
  * @param   boolean   $use_prefix            Use a prefix to open the file
  * @param   boolean   $relative              Filename is a relative path (if false, strips JPATH_ROOT to make it relative)
  * @param   boolean   $detectprocessingmode  Detect the processing method for the file and use the appropriate function
  *                                           to handle output automatically
  *
  * @return  boolean
  *
  * @since   11.1
  */
 public function open($filename, $mode = 'r', $use_include_path = false, $context = null, $use_prefix = false, $relative = false, $detectprocessingmode = false)
 {
     $filename = $this->_getFilename($filename, $mode, $use_prefix, $relative);
     if (!$filename) {
         $this->setError(JText::_('JLIB_FILESYSTEM_ERROR_STREAMS_FILENAME'));
         return false;
     }
     $this->filename = $filename;
     $this->_openmode = $mode;
     $url = parse_url($filename);
     $retval = false;
     if (isset($url['scheme'])) {
         // If we're dealing with a Joomla! stream, load it
         if (JFilesystemHelper::isJoomlaStream($url['scheme'])) {
             require_once dirname(__FILE__) . '/streams/' . $url['scheme'] . '.php';
         }
         // We have a scheme! force the method to be f
         $this->processingmethod = 'f';
     } elseif ($detectprocessingmode) {
         $ext = strtolower(JFile::getExt($this->filename));
         switch ($ext) {
             case 'tgz':
             case 'gz':
             case 'gzip':
                 $this->processingmethod = 'gz';
                 break;
             case 'tbz2':
             case 'bz2':
             case 'bzip2':
                 $this->processingmethod = 'bz';
                 break;
             default:
                 $this->processingmethod = 'f';
                 break;
         }
     }
     // Capture PHP errors
     $php_errormsg = 'Error Unknown whilst opening a file';
     $track_errors = ini_get('track_errors');
     ini_set('track_errors', true);
     // Decide which context to use:
     switch ($this->processingmethod) {
         // gzip doesn't support contexts or streams
         case 'gz':
             $this->_fh = gzopen($filename, $mode, $use_include_path);
             break;
             // bzip2 is much like gzip except it doesn't use the include path
         // bzip2 is much like gzip except it doesn't use the include path
         case 'bz':
             $this->_fh = bzopen($filename, $mode);
             break;
             // fopen can handle streams
         // fopen can handle streams
         case 'f':
         default:
             // One supplied at open; overrides everything
             if ($context) {
                 $this->_fh = fopen($filename, $mode, $use_include_path, $context);
             } elseif ($this->_context) {
                 $this->_fh = fopen($filename, $mode, $use_include_path, $this->_context);
             } else {
                 $this->_fh = fopen($filename, $mode, $use_include_path);
             }
             break;
     }
     if (!$this->_fh) {
         $this->setError($php_errormsg);
     } else {
         $retval = true;
     }
     // Restore error tracking to what it was before
     ini_set('track_errors', $track_errors);
     // Return the result
     return $retval;
 }