function FileTestHelper::setReturn

Assign a return value for a given operation.

Parameters

string $op: One of the hook_file_[validate,download] operations.

array|int $value: Value for the hook to return.

See also

Drupal\file_test\FileTestHelper::getReturn()

Drupal\file_test\FileTestHelper::reset()

2 calls to FileTestHelper::setReturn()
DownloadTest::checkUrl in core/modules/file/tests/src/Functional/DownloadTest.php
Download a file from the URL generated by generateString().
DownloadTest::doPrivateFileTransferTest in core/modules/file/tests/src/Functional/DownloadTest.php
Tests the private file transfer system.

File

core/modules/file/tests/file_test/src/FileTestHelper.php, line 107

Class

FileTestHelper
Helper for file tests.

Namespace

Drupal\file_test

Code

public static function setReturn($op, $value) : void {
    $return = \Drupal::keyValue('file_test')->get('return', []);
    $return[$op] = $value;
    \Drupal::keyValue('file_test')->set('return', $return);
}

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