function ImageStyleDownloadAccessControlTest::setUp

Same name and namespace in other branches
  1. 11.x core/modules/image/tests/src/Functional/ImageStyleDownloadAccessControlTest.php \Drupal\Tests\image\Functional\ImageStyleDownloadAccessControlTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/image/tests/src/Functional/ImageStyleDownloadAccessControlTest.php, line 56

Class

ImageStyleDownloadAccessControlTest
Tests access control for downloading image styles.

Namespace

Drupal\Tests\image\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $this->fileSystem = $this->container
    ->get('file_system');
  $this->style = ImageStyle::create([
    'name' => 'style_foo',
    'label' => $this->randomString(),
  ]);
  $this->style
    ->save();
  // Access control must be respected even when this setting is TRUE.
  $this->config('image.settings')
    ->set('allow_insecure_derivatives', TRUE)
    ->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.