Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
addressMatches example
foreach
(
$nodes
as
$node
)
{
$file
= File::
load
(
$node
->file->target_id
)
;
$this
->
assertSession
(
)
->
pageTextContains
(
$file
->
getFilename
(
)
)
;
$this
->
assertSession
(
)
->
linkByHrefExists
(
$file
->
createFileUrl
(
)
)
;
$this
->
assertSession
(
)
->
linkByHrefExists
(
'admin/content/files/usage/' .
$file
->
id
(
)
)
;
$this
->
assertSession
(
)
->
linkByHrefExists
(
$file
->
toUrl
(
'delete-form'
)
->
toString
(
)
)
;
}
// Load the page in a definite order.
$this
->
drupalGet
(
'admin/content/files',
[
'query' =>
[
'order' => 'filename', 'sort' => 'asc'
]
]
)
;
$this
->
clickLink
(
'Delete'
)
;
$file_uri
= File::
load
(
1
)
->
getFileUri
(
)
;
$this
->
assertSession
(
)
->
addressMatches
(
'#file/1/delete$#'
)
;
$this
->
assertSession
(
)
->
pageTextContains
(
'Are you sure you want to delete the file druplicon.txt?'
)
;
$this
->
assertFileExists
(
$file_uri
)
;
$this
->
assertSession
(
)
->
buttonExists
(
'Delete'
)
->
press
(
)
;
$this
->
assertSession
(
)
->
pageTextContains
(
'The file druplicon.txt has been deleted.'
)
;
$this
->
assertFileDoesNotExist
(
$file_uri
)
;
}
/** * Tests file listing usage page for entities with no canonical link template. */
public
function
testFileListingUsageNoLink
(
)
{