X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcontent_translation%2Ftests%2Fsrc%2FFunctional%2FContentTranslationTestBase.php;h=82715c28c293c003856607bdece19764dc9d478e;hb=9424afc6c1f518c301bf87a23c047d1873435d05;hp=ec7f87dd1bc32138306699b105b432fa58ac28c2;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php index ec7f87dd1..82715c28c 100644 --- a/web/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php +++ b/web/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\content_translation\Functional; +use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\field\Entity\FieldConfig; use Drupal\language\Entity\ConfigurableLanguage; @@ -138,7 +139,7 @@ abstract class ContentTranslationTestBase extends BrowserTestBase { * Returns an array of permissions needed for the administrator. */ protected function getAdministratorPermissions() { - return array_merge($this->getEditorPermissions(), $this->getTranslatorPermissions(), ['administer content translation']); + return array_merge($this->getEditorPermissions(), $this->getTranslatorPermissions(), ['administer languages', 'administer content translation']); } /** @@ -236,4 +237,24 @@ abstract class ContentTranslationTestBase extends BrowserTestBase { return $entity->id(); } + /** + * Returns the edit URL for the specified entity. + * + * @param \Drupal\Core\Entity\ContentEntityInterface $entity + * The entity being edited. + * + * @return \Drupal\Core\Url + * The edit URL. + */ + protected function getEditUrl(ContentEntityInterface $entity) { + if ($entity->access('update', $this->loggedInUser)) { + $url = $entity->toUrl('edit-form'); + } + else { + $url = $entity->toUrl('drupal:content-translation-edit'); + $url->setRouteParameter('language', $entity->language()->getId()); + } + return $url; + } + }