public function FileFieldFormatterAccessTest::testFileAccessHandler in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/FileFieldFormatterAccessTest.php \Drupal\file\Tests\FileFieldFormatterAccessTest::testFileAccessHandler()
Tests the custom access handler is invoked.
File
- core/
modules/ file/ src/ Tests/ FileFieldFormatterAccessTest.php, line 26 - Contains \Drupal\file\Tests\FileFieldFormatterAccessTest.
Class
- FileFieldFormatterAccessTest
- Tests file formatter access. @group file
Namespace
Drupal\file\TestsCode
public function testFileAccessHandler() {
$type_name = 'article';
$field_name = strtolower($this
->randomMachineName());
$this
->createFileField($field_name, 'node', $type_name);
\Drupal::state()
->set('file_test_alternate_access_handler', TRUE);
\Drupal::entityManager()
->clearCachedDefinitions();
$test_file = $this
->getTestFile('text');
$nid = $this
->uploadNodeFile($test_file, $field_name, $type_name);
$this
->drupalGet('node/' . $nid);
$this
->assertTrue(\Drupal::state()
->get('file_access_formatter_check', FALSE));
}