Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
attachFileToBlockForm example
protected
function
replaceFileInBlock
(
FileInterface
$file
)
{
$assert_session
=
$this
->
assertSession
(
)
;
$page
=
$this
->
getSession
(
)
->
getPage
(
)
;
$this
->
clickContextualLink
(
static
::INLINE_BLOCK_LOCATOR, 'Configure'
)
;
$assert_session
->
waitForElement
(
'css', "#drupal-off-canvas input[value='Remove']"
)
;
$assert_session
->
assertWaitOnAjaxRequest
(
)
;
$page
->
find
(
'css', '#drupal-off-canvas'
)
->
pressButton
(
'Remove'
)
;
$this
->
attachFileToBlockForm
(
$file
)
;
$page
->
pressButton
(
'Update'
)
;
$this
->
assertDialogClosedAndTextVisible
(
$file
->
label
(
)
,
static
::INLINE_BLOCK_LOCATOR
)
;
}
/** * Adds an entity block with a file. * * @param string $title * The title field value. * @param \Drupal\file\Entity\File $file * The file entity. */