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. 11.x 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()

23 calls to file_test_reset()
DeleteTest::testInUse in core/modules/file/tests/src/Kernel/DeleteTest.php
Tries deleting a file that is in use.
DownloadTest::doPrivateFileTransferTest in core/modules/file/tests/src/Functional/DownloadTest.php
Tests the private file transfer system.
DownloadTest::setUp in core/modules/file/tests/src/Functional/DownloadTest.php
FileManagedTestBase::setUp in core/modules/file/tests/src/Functional/FileManagedTestBase.php
FileManagedUnitTestBase::setUp in core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php

... See full list

File

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

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.