class DummyStreamWrapper

Same name and namespace in other branches
  1. 10 core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php \Drupal\file_test\StreamWrapper\DummyStreamWrapper
  2. 11.x core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php \Drupal\file_test\StreamWrapper\DummyStreamWrapper
  3. 8.9.x core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php \Drupal\file_test\StreamWrapper\DummyStreamWrapper

Helper class for testing the stream wrapper registry.

Dummy stream wrapper implementation (dummy://).

Hierarchy

Expanded class hierarchy of DummyStreamWrapper

1 file declares its use of DummyStreamWrapper
ImageStyleCustomStreamWrappersTest.php in core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php
1 string reference to 'DummyStreamWrapper'
file_test.services.yml in core/modules/file/tests/file_test/file_test.services.yml
core/modules/file/tests/file_test/file_test.services.yml
1 service uses DummyStreamWrapper
stream_wrapper.dummy in core/modules/file/tests/file_test/file_test.services.yml
Drupal\file_test\StreamWrapper\DummyStreamWrapper

File

core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php, line 12

Namespace

Drupal\file_test\StreamWrapper
View source
class DummyStreamWrapper extends LocalStream {
  
  /**
   * {@inheritdoc}
   */
  public function getName() {
    return t('Dummy files');
  }
  
  /**
   * {@inheritdoc}
   */
  public function getDescription() {
    return t('Dummy wrapper for simpletest.');
  }
  public function getDirectoryPath() {
    return \Drupal::getContainer()->getParameter('site.path') . '/files';
  }
  
  /**
   * Override getInternalUri().
   *
   * Return a dummy path for testing.
   */
  public function getInternalUri() {
    return '/dummy/example.txt';
  }
  
  /**
   * Override getExternalUrl().
   *
   * Return the HTML URI of a public file.
   */
  public function getExternalUrl() {
    return '/dummy/example.txt';
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.