Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
enableTranslation example
protected
$manager
;
/** * {@inheritdoc} */
protected
function
setUp
(
)
: void
{
parent::
setUp
(
)
;
$this
->
setupLanguages
(
)
;
$this
->
setupBundle
(
)
;
$this
->
enableTranslation
(
)
;
$this
->
setupUsers
(
)
;
$this
->
setupTestFields
(
)
;
$this
->manager =
$this
->container->
get
(
'content_translation.manager'
)
;
$this
->controller =
$this
->manager->
getTranslationHandler
(
$this
->entityTypeId
)
;
// Rebuild the container so that the new languages are picked up by services // that hold a list of languages.
$this
->
rebuildContainer
(
)
;
}
$this
->labelOfNotTranslatedReference =
$this
->
randomMachineName
(
)
;
$this
->originalLabel =
$this
->
randomMachineName
(
)
;
$this
->translatedLabel =
$this
->
randomMachineName
(
)
;
$this
->
setUpLanguages
(
)
;
// We setup languages, so we need to ensure that the language manager // and language path processor is updated.
$this
->
rebuildContainer
(
)
;
$this
->
setUpContentTypes
(
)
;
$this
->
enableTranslation
(
)
;
$this
->
setUpEntityReferenceField
(
)
;
$this
->
createContent
(
)
;
$this
->webUser =
$this
->
drupalCreateUser
(
[
'edit any ' .
$this
->referrerType->
id
(
)
. ' content',
]
)
;
}
/** * Tests if the entity is displayed in an entity reference field. */
protected
$defaultTheme
= 'stark';
/** * {@inheritdoc} */
protected
function
setUp
(
)
: void
{
parent::
setUp
(
)
;
$this
->
setupLanguages
(
)
;
$this
->vocabulary =
$this
->
createVocabulary
(
)
;
$this
->
enableTranslation
(
)
;
$this
->
setUpTerms
(
)
;
$this
->
setUpTermReferenceField
(
)
;
}
/** * Tests translated breadcrumbs. */
public
function
testTranslatedBreadcrumbs
(
)
{
// Ensure non-translated breadcrumb is correct.
$breadcrumb
=
[
Url::
fromRoute
(
'<front>'
)
->
toString
(
)
=> 'Home'
]
;
foreach
(
$this
->terms
as
$term
)
{
protected
$defaultTheme
= 'stark';
/** * {@inheritdoc} */
protected
function
setUp
(
)
: void
{
parent::
setUp
(
)
;
$this
->
setupLanguages
(
)
;
$this
->vocabulary =
$this
->
createVocabulary
(
)
;
$this
->
enableTranslation
(
)
;
$this
->
setUpTerm
(
)
;
$this
->
setUpTermReferenceField
(
)
;
$this
->
setUpNode
(
)
;
}
/** * Tests if the translated taxonomy term is displayed. */
public
function
testTranslatedTaxonomyTermReferenceDisplay
(
)
{
$path
= 'node/' .
$this
->node->
id
(
)
;
$translation_path
=
$this
->translateToLangcode . '/' .
$path
;