diff --git a/oe_multilingual.services.yml b/oe_multilingual.services.yml index 9076722..9696079 100644 --- a/oe_multilingual.services.yml +++ b/oe_multilingual.services.yml @@ -8,7 +8,3 @@ services: oe_multilingual.content_language_switcher_provider: class: Drupal\oe_multilingual\ContentLanguageSwitcherProvider arguments: ['@language_manager', '@path.matcher', '@oe_multilingual.helper'] - oe_multilingual.content_language_settings: - class: Drupal\oe_multilingual\MultilingualConfigOverride - tags: - - {name: config.factory.override, priority: 5} diff --git a/src/MultilingualConfigOverride.php b/src/MultilingualConfigOverride.php deleted file mode 100644 index d5289da..0000000 --- a/src/MultilingualConfigOverride.php +++ /dev/null @@ -1,57 +0,0 @@ - 'site_default', - 'language_alterable' => FALSE, - ]; - } - } - - return $overrides; - } - - /** - * {@inheritdoc} - */ - public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION): ?StorableConfigBase { - return NULL; - } - - /** - * {@inheritdoc} - */ - public function getCacheSuffix(): string { - return 'oe_multilingual.language_configs_override'; - } - - /** - * {@inheritdoc} - */ - public function getCacheableMetadata($name): CacheableMetadata { - return new CacheableMetadata(); - } - -} diff --git a/tests/Behat/DrupalContext.php b/tests/Behat/DrupalContext.php index a87f17e..89a2568 100644 --- a/tests/Behat/DrupalContext.php +++ b/tests/Behat/DrupalContext.php @@ -124,44 +124,19 @@ public function iAmVisitingTheCreationPage(string $content_type_name): void { } /** - * Check that the field is not present. + * Check that the field is present. * * @param string $field * Input id, name or label. * - * @Then I should not see the field :field + * @Then I should see the field :field */ - public function iShouldNotSeeTheField(string $field): void { + public function iShouldSeeTheField(string $field): void { $element = $this->getSession() ->getPage() ->findField($field); - if ($element) { - throw new \RuntimeException("Field '{$field}' is present."); - } - } - - /** - * Check that we have the correct language for initial translation. - * - * @param string $title - * Title of node. - * - * @Then The only available translation for :title is in the site's default language - */ - public function assertOnlyDefaultLanguageTranslationExist(string $title): void { - $node = $this->getEntityByLabel('node', $title); - if (!$node) { - throw new \RuntimeException("Node '{$title}' doesn't exist."); - } - - $node_translation_languages = $node->getTranslationLanguages(); - if (count($node_translation_languages) !== 1) { - throw new \RuntimeException("The node should have only one translation."); - } - - $node_language = key($node_translation_languages); - if ($node_language != \Drupal::languageManager()->getDefaultLanguage()->getId()) { - throw new \RuntimeException("Original translation language of the '{$title}' node is not the site's default language."); + if (empty($element)) { + throw new \RuntimeException("Field '{$field}' is not present."); } } diff --git a/tests/features/content-default-language.feature b/tests/features/content-default-language.feature index 2e93e94..4d4c7ab 100644 --- a/tests/features/content-default-language.feature +++ b/tests/features/content-default-language.feature @@ -1,17 +1,10 @@ @api Feature: Content initial language. In order to create content - As a editor - I want to make sure that it is not possible for a content editor to create a node's initial version in any language - other than the site's default language + As a content editor + I can create an initial version of a node in any language - Scenario: As an editor, when I create a node I can not select the initial node language + Scenario: As an editor, when I create a node I can select the initial node language Given I am logged in as a user with the "create oe_demo_translatable_page content" permission And I visit the "Demo translatable page" creation page - Then I should not see the field "Language" - - When I fill in "Title" with "Title Default value" - And I fill in "Body" with "Body Default value" - And I press "Save" - Then I should see the success message "Demo translatable page Title Default value has been created." - And The only available translation for "Title Default value" is in the site's default language + Then I should see the field "Language"