Issue #3079330 by Berdir: LocaleConfigSubscriberTest has many assertions that don't run
parent
89bdd89a11
commit
54d12c1346
|
@ -386,14 +386,12 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
|
|||
* 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 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
|
|||
* 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 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
|
|||
* 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 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
|
|||
* 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 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
|
|||
'language' => $langcode,
|
||||
'translated' => TRUE,
|
||||
]);
|
||||
return $this->assertIdentical([], $strings);
|
||||
$this->assertIdentical([], $strings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -471,9 +461,6 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
|
|||
* @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 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
|
|||
'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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue