X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fshortcut%2Fsrc%2FTests%2FShortcutTranslationUITest.php;fp=web%2Fcore%2Fmodules%2Fshortcut%2Fsrc%2FTests%2FShortcutTranslationUITest.php;h=0000000000000000000000000000000000000000;hp=300ca3b7220872b525748df31b3598affd25f929;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php b/web/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php deleted file mode 100644 index 300ca3b72..000000000 --- a/web/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php +++ /dev/null @@ -1,127 +0,0 @@ -entityTypeId = 'shortcut'; - $this->bundle = 'default'; - parent::setUp(); - } - - /** - * {@inheritdoc} - */ - protected function getTranslatorPermissions() { - return array_merge(parent::getTranslatorPermissions(), ['access shortcuts', 'administer shortcuts', 'access toolbar']); - } - - /** - * {@inheritdoc} - */ - protected function createEntity($values, $langcode, $bundle_name = NULL) { - $values['link']['uri'] = 'internal:/user'; - return parent::createEntity($values, $langcode, $bundle_name); - } - - /** - * {@inheritdoc} - */ - protected function getNewEntityValues($langcode) { - return ['title' => [['value' => $this->randomMachineName()]]] + parent::getNewEntityValues($langcode); - } - - protected function doTestBasicTranslation() { - parent::doTestBasicTranslation(); - - $storage = $this->container->get('entity_type.manager') - ->getStorage($this->entityTypeId); - $storage->resetCache([$this->entityId]); - $entity = $storage->load($this->entityId); - foreach ($this->langcodes as $langcode) { - if ($entity->hasTranslation($langcode)) { - $language = new Language(['id' => $langcode]); - // Request the front page in this language and assert that the right - // translation shows up in the shortcut list with the right path. - $this->drupalGet('', ['language' => $language]); - $expected_path = \Drupal::urlGenerator()->generateFromRoute('user.page', [], ['language' => $language]); - $label = $entity->getTranslation($langcode)->label(); - $elements = $this->xpath('//nav[contains(@class, "toolbar-lining")]/ul[@class="toolbar-menu"]/li/a[contains(@href, :href) and normalize-space(text())=:label]', [':href' => $expected_path, ':label' => $label]); - $this->assertTrue(!empty($elements), format_string('Translated @language shortcut link @label found.', ['@label' => $label, '@language' => $language->getName()])); - } - } - } - - /** - * {@inheritdoc} - */ - protected function doTestTranslationEdit() { - $storage = $this->container->get('entity_type.manager') - ->getStorage($this->entityTypeId); - $storage->resetCache([$this->entityId]); - $entity = $storage->load($this->entityId); - $languages = $this->container->get('language_manager')->getLanguages(); - - foreach ($this->langcodes as $langcode) { - // We only want to test the title for non-english translations. - if ($langcode != 'en') { - $options = ['language' => $languages[$langcode]]; - $url = $entity->urlInfo('edit-form', $options); - $this->drupalGet($url); - - $title = t('@title [%language translation]', [ - '@title' => $entity->getTranslation($langcode)->label(), - '%language' => $languages[$langcode]->getName(), - ]); - $this->assertRaw($title); - } - } - } - - /** - * Tests the basic translation workflow. - */ - protected function doTestTranslationChanged() { - $storage = $this->container->get('entity_type.manager') - ->getStorage($this->entityTypeId); - $storage->resetCache([$this->entityId]); - $entity = $storage->load($this->entityId); - - $this->assertFalse( - $entity instanceof EntityChangedInterface, - format_string('%entity is not implementing EntityChangedInterface.', ['%entity' => $this->entityTypeId]) - ); - } - -}