You are here

protected function InlineBlockPrivateFilesTest::attachFileToBlockForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockPrivateFilesTest::attachFileToBlockForm()

Attaches a file to the block edit form.

Parameters

\Drupal\file\FileInterface $file: The file to be attached.

2 calls to InlineBlockPrivateFilesTest::attachFileToBlockForm()
InlineBlockPrivateFilesTest::addInlineFileBlockToLayout in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php
Adds an entity block with a file.
InlineBlockPrivateFilesTest::replaceFileInBlock in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php
Replaces the file in the block with another one.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php, line 280

Class

InlineBlockPrivateFilesTest
Test access to private files in block fields on the Layout Builder.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function attachFileToBlockForm(FileInterface $file) {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->attachFileToField("files[settings_block_form_field_file_0]", $this->fileSystem
    ->realpath($file
    ->getFileUri()));
  $assert_session
    ->assertWaitOnAjaxRequest();
  $this
    ->assertNotEmpty($assert_session
    ->waitForLink($file
    ->label()));
}