DummyReadOnlyStreamWrapper.php

Same filename and directory in other branches
  1. 9 core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php
  2. 8.9.x core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php
  3. 10 core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php

Namespace

Drupal\file_test\StreamWrapper

File

core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php

View source
<?php

namespace Drupal\file_test\StreamWrapper;

use Drupal\Core\StreamWrapper\LocalReadOnlyStream;

/**
 * Helper class for testing the stream wrapper registry.
 *
 * Dummy stream wrapper implementation (dummy-readonly://).
 */
class DummyReadOnlyStreamWrapper extends LocalReadOnlyStream {
    
    /**
     * {@inheritdoc}
     */
    public function getName() {
        return t('Dummy files (readonly)');
    }
    
    /**
     * {@inheritdoc}
     */
    public function getDescription() {
        return t('Dummy wrapper for testing (readonly).');
    }
    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';
    }

}

Classes

Title Deprecated Summary
DummyReadOnlyStreamWrapper Helper class for testing the stream wrapper registry.

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