You are here

DummyStreamWrapper.php in Zircon Profile 8.0

File

core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php
View source
<?php

/**
 * @file
 * Contains \Drupal\file_test\StreamWrapper\DummyStreamWrapper.
 */
namespace Drupal\file_test\StreamWrapper;

use Drupal\Core\StreamWrapper\LocalStream;

/**
 * Helper class for testing the stream wrapper registry.
 *
 * Dummy stream wrapper implementation (dummy://).
 */
class DummyStreamWrapper extends LocalStream {

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return t('Dummy files');
  }

  /**
   * {@inheritdoc}
   */
  public function getDescription() {
    return t('Dummy wrapper for simpletest.');
  }
  function getDirectoryPath() {
    return \Drupal::service('site.path') . '/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
DummyStreamWrapper Helper class for testing the stream wrapper registry.