function AccessTest::testCreateAccess
Same name in other branches
- 8.9.x core/modules/file/tests/src/Kernel/AccessTest.php \Drupal\Tests\file\Kernel\AccessTest::testCreateAccess()
- 10 core/modules/file/tests/src/Kernel/AccessTest.php \Drupal\Tests\file\Kernel\AccessTest::testCreateAccess()
- 11.x core/modules/file/tests/src/Kernel/AccessTest.php \Drupal\Tests\file\Kernel\AccessTest::testCreateAccess()
Tests create access checks.
File
-
core/
modules/ file/ tests/ src/ Kernel/ AccessTest.php, line 117
Class
- AccessTest
- Tests for the File access control.
Namespace
Drupal\Tests\file\KernelCode
public function testCreateAccess() {
// Anonymous users can create a file by default.
$this->assertFalse($this->file
->access('create'));
// Authenticated users can create a file by default.
\Drupal::currentUser()->setAccount($this->user1);
$this->assertFalse($this->file
->access('create'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.