DummyReadOnlyStreamWrapper.php

Definition of Drupal\file_test\DummyReadOnlyStreamWrapper.

Namespace

Drupal\file_test

File

drupal/core/modules/file/tests/file_test/lib/Drupal/file_test/DummyReadOnlyStreamWrapper.php
View source
<?php

/**
 * @file
 * Definition of Drupal\file_test\DummyReadOnlyStreamWrapper.
 */
namespace Drupal\file_test;

use Drupal\Core\StreamWrapper\LocalReadOnlyStream;

/**
 * Helper class for testing the stream wrapper registry.
 *
 * Dummy stream wrapper implementation (dummy-readonly://).
 */
class DummyReadOnlyStreamWrapper extends LocalReadOnlyStream {
  function getDirectoryPath() {
    return variable_get('stream_public_path', 'sites/default/files');
  }

  /**
   * Override getInternalUri().
   *
   * Return a dummy path for testing.
   */
  function getInternalUri() {
    return '/dummy/example.txt';
  }

  /**
   * Override getExternalUrl().
   *
   * Return the HTML URI of a public file.
   */
  function getExternalUrl() {
    return '/dummy/example.txt';
  }

}

Classes

Namesort descending Description
DummyReadOnlyStreamWrapper Helper class for testing the stream wrapper registry.