Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
linkGenerator example
'class' =>
[
'views-more-link',
]
,
]
,
]
;
if
(
UrlHelper::
isExternal
(
$more_link_path
)
)
{
$more_link_url
= CoreUrl::
fromUri
(
$more_link_path
,
$options
)
;
}
else
{
$more_link_url
= CoreUrl::
fromUserInput
(
'/' .
$more_link_path
,
$options
)
;
}
$more_link
= ' ' .
$this
->
linkGenerator
(
)
->
generate
(
$more_link_text
,
$more_link_url
)
;
}
}
if
(
!
empty
(
$alter
[
'nl2br'
]
)
)
{
$value
=
nl2br
(
$value
)
;
}
if
(
$value_is_safe
)
{
$value
= ViewsRenderPipelineMarkup::
create
(
$value
)
;
}
$this
->last_render_text =
$value
;
$this
->
setMockContainerService
(
'url_generator'
)
;
$this
->
assertNotNull
(
\Drupal::
urlGenerator
(
)
)
;
}
/** * Tests the linkGenerator() method. * * @covers ::linkGenerator */
public
function
testLinkGenerator
(
)
{
$this
->
setMockContainerService
(
'link_generator'
)
;
$this
->
assertNotNull
(
\Drupal::
linkGenerator
(
)
)
;
}
/** * Tests the translation() method. * * @covers ::translation */
public
function
testTranslation
(
)
{
$this
->
setMockContainerService
(
'string_translation'
)
;
$this
->
assertNotNull
(
\Drupal::
translation
(
)
)
;
}