function file_test_reset

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

Reset/initialize the history of calls to the file_* hooks.

See also

file_test_get_calls()

file_test_reset()

2 calls to file_test_reset()
LegacyValidateTest::testCallerValidation in core/modules/file/tests/src/Kernel/LegacyValidateTest.php
Tests that the validators passed into are checked.
LegacyValidateTest::testInsecureExtensions in core/modules/file/tests/src/Kernel/LegacyValidateTest.php
Tests hard-coded security check in file_validate().

File

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

Code

function file_test_reset() {
    // Keep track of calls to these hooks
    $results = [
        'load' => [],
        'validate' => [],
        'download' => [],
        'insert' => [],
        'update' => [],
        'copy' => [],
        'move' => [],
        'delete' => [],
    ];
    \Drupal::state()->set('file_test.results', $results);
    // These hooks will return these values, see file_test_set_return().
    $return = [
        'validate' => [],
        'download' => NULL,
    ];
    \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.