Loading core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php +17 −33 Original line number Diff line number Diff line Loading @@ -386,14 +386,12 @@ protected function deleteLocaleTranslationData($config_name, $key, $source_value * The configuration name. * @param string $langcode * The language code. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertNoConfigOverride($config_name, $langcode) { $config_langcode = $this->configFactory->getEditable($config_name)->get('langcode'); $override = $this->languageManager->getLanguageConfigOverride($langcode, $config_name); return $this->assertNotEqual($config_langcode, $langcode) && $this->assertEqual($override->isNew(), TRUE); $this->assertNotEqual($config_langcode, $langcode); $this->assertEqual($override->isNew(), TRUE); } /** Loading @@ -407,14 +405,12 @@ protected function assertNoConfigOverride($config_name, $langcode) { * The configuration value. * @param string $langcode * The language code. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertConfigOverride($config_name, $key, $value, $langcode) { $config_langcode = $this->configFactory->getEditable($config_name)->get('langcode'); $override = $this->languageManager->getLanguageConfigOverride($langcode, $config_name); return $this->assertNotEqual($config_langcode, $langcode) && $this->assertEqual($override->get($key), $value); $this->assertNotEqual($config_langcode, $langcode); $this->assertEqual($override->get($key), $value); } /** Loading @@ -428,13 +424,10 @@ protected function assertConfigOverride($config_name, $key, $value, $langcode) { * The configuration value. * @param string $langcode * The language code. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertActiveConfig($config_name, $key, $value, $langcode) { $config = $this->configFactory->getEditable($config_name); return $this->assertEqual($config->get('langcode'), $langcode) && $this->assertEqual($config->get('langcode'), $langcode); $this->assertIdentical($config->get($key), $value); } Loading @@ -445,9 +438,6 @@ protected function assertActiveConfig($config_name, $key, $value, $langcode) { * The configuration name. * @param string $langcode * The language code. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertNoTranslation($config_name, $langcode) { $strings = $this->stringStorage->getTranslations([ Loading @@ -456,7 +446,7 @@ protected function assertNoTranslation($config_name, $langcode) { 'language' => $langcode, 'translated' => TRUE, ]); return $this->assertIdentical([], $strings); $this->assertIdentical([], $strings); } /** Loading @@ -471,9 +461,6 @@ protected function assertNoTranslation($config_name, $langcode) { * @param bool $customized * Whether or not the string should be asserted to be customized or not * customized. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertTranslation($config_name, $translation, $langcode, $customized = TRUE) { // Make sure a string exists. Loading @@ -483,20 +470,17 @@ protected function assertTranslation($config_name, $translation, $langcode, $cus 'language' => $langcode, 'translated' => TRUE, ]); $pass = $this->assertIdentical(1, count($strings)); $this->assertIdentical(1, count($strings)); $string = reset($strings); if ($this->assertTrue($string instanceof StringInterface)) { $this->assertTrue($string instanceof StringInterface); /** @var \Drupal\locale\StringInterface $string */ $pass = $pass && $this->assertIdentical($translation, $string->getString()); $pass = $pass && $this->assertTrue($string->isTranslation()); if ($this->assertTrue($string instanceof TranslationString)) { $this->assertIdentical($translation, $string->getString()); $this->assertTrue($string->isTranslation()); $this->assertTrue($string instanceof TranslationString); /** @var \Drupal\locale\TranslationString $string */ // Make sure the string is marked as customized so that it does not get // overridden when the string translations are updated. return $pass && $this->assertEqual($customized, $string->customized); } } return FALSE; $this->assertEquals($customized, (bool) $string->customized); } } Loading
core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php +17 −33 Original line number Diff line number Diff line Loading @@ -386,14 +386,12 @@ protected function deleteLocaleTranslationData($config_name, $key, $source_value * The configuration name. * @param string $langcode * The language code. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertNoConfigOverride($config_name, $langcode) { $config_langcode = $this->configFactory->getEditable($config_name)->get('langcode'); $override = $this->languageManager->getLanguageConfigOverride($langcode, $config_name); return $this->assertNotEqual($config_langcode, $langcode) && $this->assertEqual($override->isNew(), TRUE); $this->assertNotEqual($config_langcode, $langcode); $this->assertEqual($override->isNew(), TRUE); } /** Loading @@ -407,14 +405,12 @@ protected function assertNoConfigOverride($config_name, $langcode) { * The configuration value. * @param string $langcode * The language code. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertConfigOverride($config_name, $key, $value, $langcode) { $config_langcode = $this->configFactory->getEditable($config_name)->get('langcode'); $override = $this->languageManager->getLanguageConfigOverride($langcode, $config_name); return $this->assertNotEqual($config_langcode, $langcode) && $this->assertEqual($override->get($key), $value); $this->assertNotEqual($config_langcode, $langcode); $this->assertEqual($override->get($key), $value); } /** Loading @@ -428,13 +424,10 @@ protected function assertConfigOverride($config_name, $key, $value, $langcode) { * The configuration value. * @param string $langcode * The language code. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertActiveConfig($config_name, $key, $value, $langcode) { $config = $this->configFactory->getEditable($config_name); return $this->assertEqual($config->get('langcode'), $langcode) && $this->assertEqual($config->get('langcode'), $langcode); $this->assertIdentical($config->get($key), $value); } Loading @@ -445,9 +438,6 @@ protected function assertActiveConfig($config_name, $key, $value, $langcode) { * The configuration name. * @param string $langcode * The language code. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertNoTranslation($config_name, $langcode) { $strings = $this->stringStorage->getTranslations([ Loading @@ -456,7 +446,7 @@ protected function assertNoTranslation($config_name, $langcode) { 'language' => $langcode, 'translated' => TRUE, ]); return $this->assertIdentical([], $strings); $this->assertIdentical([], $strings); } /** Loading @@ -471,9 +461,6 @@ protected function assertNoTranslation($config_name, $langcode) { * @param bool $customized * Whether or not the string should be asserted to be customized or not * customized. * * @return bool * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertTranslation($config_name, $translation, $langcode, $customized = TRUE) { // Make sure a string exists. Loading @@ -483,20 +470,17 @@ protected function assertTranslation($config_name, $translation, $langcode, $cus 'language' => $langcode, 'translated' => TRUE, ]); $pass = $this->assertIdentical(1, count($strings)); $this->assertIdentical(1, count($strings)); $string = reset($strings); if ($this->assertTrue($string instanceof StringInterface)) { $this->assertTrue($string instanceof StringInterface); /** @var \Drupal\locale\StringInterface $string */ $pass = $pass && $this->assertIdentical($translation, $string->getString()); $pass = $pass && $this->assertTrue($string->isTranslation()); if ($this->assertTrue($string instanceof TranslationString)) { $this->assertIdentical($translation, $string->getString()); $this->assertTrue($string->isTranslation()); $this->assertTrue($string instanceof TranslationString); /** @var \Drupal\locale\TranslationString $string */ // Make sure the string is marked as customized so that it does not get // overridden when the string translations are updated. return $pass && $this->assertEqual($customized, $string->customized); } } return FALSE; $this->assertEquals($customized, (bool) $string->customized); } }