Commit 54d12c13 authored by alexpott's avatar alexpott

Issue #3079330 by Berdir: LocaleConfigSubscriberTest has many assertions that don't run

parent 89bdd89a
......@@ -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);
}
/**
......@@ -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);
}
/**
......@@ -428,14 +424,11 @@ 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->assertIdentical($config->get($key), $value);
$this->assertEqual($config->get('langcode'), $langcode);
$this->assertIdentical($config->get($key), $value);
}
/**
......@@ -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([
......@@ -456,7 +446,7 @@ protected function assertNoTranslation($config_name, $langcode) {
'language' => $langcode,
'translated' => TRUE,
]);
return $this->assertIdentical([], $strings);
$this->assertIdentical([], $strings);
}
/**
......@@ -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.
......@@ -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)) {
/** @var \Drupal\locale\StringInterface $string */
$pass = $pass && $this->assertIdentical($translation, $string->getString());
$pass = $pass && $this->assertTrue($string->isTranslation());
if ($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->assertTrue($string instanceof StringInterface);
/** @var \Drupal\locale\StringInterface $string */
$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.
$this->assertEquals($customized, (bool) $string->customized);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment