You are here

protected function LocaleConfigTranslationTest::assertNodeConfig in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/locale/src/Tests/LocaleConfigTranslationTest.php \Drupal\locale\Tests\LocaleConfigTranslationTest::assertNodeConfig()

Check that node configuration source strings are made available in locale.

Parameters

bool $required: Whether to assume a sample of the required default configuration is present.

bool $optional: Whether to assume a sample of the optional default configuration is present.

1 call to LocaleConfigTranslationTest::assertNodeConfig()
LocaleConfigTranslationTest::testOptionalConfiguration in core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
Test translatability of optional configuration in locale.

File

core/modules/locale/src/Tests/LocaleConfigTranslationTest.php, line 226
Contains \Drupal\locale\Tests\LocaleConfigTranslationTest.

Class

LocaleConfigTranslationTest
Tests translation of configuration strings.

Namespace

Drupal\locale\Tests

Code

protected function assertNodeConfig($required, $optional) {

  // Check the required default configuration in node module.
  $string = $this->storage
    ->findString([
    'source' => 'Make content sticky',
    'context' => '',
    'type' => 'configuration',
  ]);
  if ($required) {
    $this
      ->assertFalse($this
      ->config('system.action.node_make_sticky_action')
      ->isNew());
    $this
      ->assertTrue($string, 'Node action text can be found with node module.');
  }
  else {
    $this
      ->assertTrue($this
      ->config('system.action.node_make_sticky_action')
      ->isNew());
    $this
      ->assertFalse($string, 'Node action text can not be found without node module.');
  }

  // Check the optional default configuration in node module.
  $string = $this->storage
    ->findString([
    'source' => 'No front page content has been created yet.',
    'context' => '',
    'type' => 'configuration',
  ]);
  if ($optional) {
    $this
      ->assertFalse($this
      ->config('views.view.frontpage')
      ->isNew());
    $this
      ->assertTrue($string, 'Node view text can be found with node and views modules.');
  }
  else {
    $this
      ->assertTrue($this
      ->config('views.view.frontpage')
      ->isNew());
    $this
      ->assertFalse($string, 'Node view text can not be found without node and/or views modules.');
  }
}