Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
LatestRevisionCheck example
/** @var \Drupal\content_moderation\ModerationInformation $mod_info */
$mod_info
=
$this
->
prophesize
(
ModerationInformation::
class
)
;
$mod_info
->
hasPendingRevision
(
$entity
->
reveal
(
)
)
->
willReturn
(
$has_pending_revision
)
;
$route
=
$this
->
prophesize
(
Route::
class
)
;
$route
->
getOption
(
'_content_moderation_entity_type'
)
->
willReturn
(
$entity_type
)
;
$route_match
=
$this
->
prophesize
(
RouteMatch::
class
)
;
$route_match
->
getParameter
(
$entity_type
)
->
willReturn
(
$entity
->
reveal
(
)
)
;
$lrc
=
new
LatestRevisionCheck
(
$mod_info
->
reveal
(
)
)
;
/** @var \Drupal\Core\Access\AccessResult $result */
$result
=
$lrc
->
access
(
$route
->
reveal
(
)
,
$route_match
->
reveal
(
)
,
$account
->
reveal
(
)
)
;
$this
->
assertInstanceOf
(
$result_class
,
$result
)
;
}
/** * Data provider for testLastAccessPermissions(). */