function FileResourceTestBase::makeCurrentUserFileOwner
Same name in other branches
- 9 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::makeCurrentUserFileOwner()
- 8.9.x core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::makeCurrentUserFileOwner()
- 11.x core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::makeCurrentUserFileOwner()
Makes the current user the file owner.
1 call to FileResourceTestBase::makeCurrentUserFileOwner()
- FileResourceTestBase::setUpAuthorization in core/
modules/ file/ tests/ src/ Functional/ Rest/ FileResourceTestBase.php - Sets up the necessary authorization.
File
-
core/
modules/ file/ tests/ src/ Functional/ Rest/ FileResourceTestBase.php, line 87
Class
Namespace
Drupal\Tests\file\Functional\RestCode
protected function makeCurrentUserFileOwner() {
$account = static::$auth ? User::load(2) : User::load(0);
$this->entity
->setOwnerId($account->id());
$this->entity
->setOwner($account);
$this->entity
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.