Issue #3355604 by joachim, penyaskito, borisson_: ContentTranslationLanguageChangeTest should perform setup tasks using API calls not form submissions
parent
570fb09128
commit
4104aed9c1
|
@ -2,7 +2,10 @@
|
|||
|
||||
namespace Drupal\Tests\content_translation\Functional;
|
||||
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
use Drupal\language\Entity\ContentLanguageSettings;
|
||||
use Drupal\Tests\image\Kernel\ImageFieldCreationTrait;
|
||||
use Drupal\Tests\node\Functional\NodeTestBase;
|
||||
use Drupal\Tests\TestFileCreationTrait;
|
||||
|
||||
|
@ -13,6 +16,7 @@ use Drupal\Tests\TestFileCreationTrait;
|
|||
*/
|
||||
class ContentTranslationLanguageChangeTest extends NodeTestBase {
|
||||
|
||||
use ImageFieldCreationTrait;
|
||||
use TestFileCreationTrait {
|
||||
getTestFiles as drupalGetTestFiles;
|
||||
}
|
||||
|
@ -63,24 +67,20 @@ class ContentTranslationLanguageChangeTest extends NodeTestBase {
|
|||
$this->drupalLogin($user);
|
||||
|
||||
// Enable translation for article.
|
||||
$edit = [
|
||||
'entity_types[node]' => TRUE,
|
||||
'settings[node][article][translatable]' => TRUE,
|
||||
'settings[node][article][settings][language][language_alterable]' => TRUE,
|
||||
];
|
||||
$this->drupalGet('admin/config/regional/content-language');
|
||||
$this->submitForm($edit, 'Save configuration');
|
||||
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'article');
|
||||
$config->setDefaultLangcode(LanguageInterface::LANGCODE_SITE_DEFAULT);
|
||||
$config->setLanguageAlterable(TRUE);
|
||||
$config->save();
|
||||
|
||||
// Add an image field.
|
||||
$this->drupalGet('admin/structure/types/manage/article/fields/add-field');
|
||||
$edit = [
|
||||
'new_storage_type' => 'image',
|
||||
'field_name' => 'image_field',
|
||||
'label' => 'image_field',
|
||||
];
|
||||
$this->submitForm($edit, 'Save and continue');
|
||||
$this->submitForm([], 'Save field settings');
|
||||
$this->submitForm([], 'Save settings');
|
||||
$content_translation_manager = $this->container->get('content_translation.manager');
|
||||
$content_translation_manager->setEnabled('node', 'article', TRUE);
|
||||
$content_translation_manager->setBundleTranslationSettings('node', 'article', [
|
||||
'untranslatable_fields_hide' => FALSE,
|
||||
]);
|
||||
|
||||
$this->rebuildContainer();
|
||||
|
||||
$this->createImageField('field_image_field', 'article');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue