/** * Tests for no canonical link templates. */ public function testNoCanonicalLinkTemplate() { $entity_type = EntityTestTranslatableUISkip::create(['name' => 'name english', 'language' => 'en']); $entity_type->save(); $entity_type->addTranslation('de', ['name' => 'name german']); $entity_type->save(); $this->assertEqual(count($entity_type->getTranslationLanguages()), 2); $entity_type->removeTranslation('de'); $entity_type->save(); $this->assertEqual(count($entity_type->getTranslationLanguages()), 1); }
/** * Tests for no canonical link templates. */ public function testNoCanonicalLinkTemplate() { // Create an entity that has no canonical link but is translatable. $entity = EntityTestTranslatableUISkip::create(['name' => 'name english', 'langcode' => 'en']); $entity->save(); // Go to the overview page and assert that the entity label appears. $this->drupalGet('admin/tmgmt/sources/content/entity_test_translatable_UI_skip'); $this->assertText($entity->label()); // Add a translation to the entity and submit it to the provider. $edit = ['items[' . $entity->id() . ']' => TRUE]; $this->drupalPostForm(NULL, $edit, 'Request translation'); $this->drupalPostForm(NULL, NULL, 'Submit to provider'); $this->assertText('The translation of ' . $entity->label() . ' to German is finished and can now be reviewed.'); // Review and save the entity translation. $this->clickLink('reviewed'); $this->drupalPostForm(NULL, NULL, 'Save as completed'); $this->assertTitle($entity->label() . ' (English to German, Finished) | Drupal'); $this->assertText('The translation for name english has been accepted as de(de-ch): name english.'); }