function file_test_set_return

Same name in other branches
  1. 7.x modules/simpletest/tests/file_test.module \file_test_set_return()
  2. 8.9.x core/modules/file/tests/file_test/file_test.module \file_test_set_return()
  3. 10 core/modules/file/tests/file_test/file_test.module \file_test_set_return()
  4. 11.x core/modules/file/tests/file_test/file_test.module \file_test_set_return()

Assign a return value for a given operation.

Parameters

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

mixed $value: Value for the hook to return.

See also

_file_test_get_return()

file_test_reset()

3 calls to file_test_set_return()
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.
ValidateTest::testCallerValidation in core/modules/file/tests/src/Kernel/ValidateTest.php
Tests that the validators passed into are checked.

File

core/modules/file/tests/file_test/file_test.module, line 124

Code

function file_test_set_return($op, $value) {
    $return = \Drupal::state()->get('file_test.return', []);
    $return[$op] = $value;
    \Drupal::state()->set('file_test.return', $return);
}

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