You are here

protected function InlineBlockPrivateFilesTest::replaceFileInBlock in Drupal 10

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

Replaces the file in the block with another one.

Parameters

\Drupal\file\FileInterface $file: The file entity.

File

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

Class

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

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function replaceFileInBlock(FileInterface $file) {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->clickContextualLink(static::INLINE_BLOCK_LOCATOR, 'Configure');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $page
    ->pressButton('Remove');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $this
    ->attachFileToBlockForm($file);
  $page
    ->pressButton('Update');
  $this
    ->assertDialogClosedAndTextVisible($file
    ->label(), static::INLINE_BLOCK_LOCATOR);
}