protected function FileManagedUnitTestBase::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php \Drupal\Tests\file\Kernel\FileManagedUnitTestBase::setUp()
- 9 core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php \Drupal\Tests\file\Kernel\FileManagedUnitTestBase::setUp()
File
- core/
modules/ file/ tests/ src/ Kernel/ FileManagedUnitTestBase.php, line 24
Class
- FileManagedUnitTestBase
- Base class for file unit tests that use the file_test module to test uploads and hooks.
Namespace
Drupal\Tests\file\KernelCode
protected function setUp() : void {
parent::setUp();
// Clear out any hook calls.
file_test_reset();
$this
->installConfig([
'system',
]);
$this
->installEntitySchema('file');
$this
->installEntitySchema('user');
$this
->installSchema('file', [
'file_usage',
]);
// Make sure that a user with uid 1 exists, self::createFile() relies on
// it.
$user = User::create([
'uid' => 1,
'name' => $this
->randomMachineName(),
]);
$user
->enforceIsNew();
$user
->save();
\Drupal::currentUser()
->setAccount($user);
}