You are here

protected function FormatDateTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Common/FormatDateTest.php \Drupal\system\Tests\Common\FormatDateTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides WebTestBase::setUp

File

core/modules/system/src/Tests/Common/FormatDateTest.php, line 32
Contains \Drupal\system\Tests\Common\FormatDateTest.

Class

FormatDateTest
Tests the format_date() function.

Namespace

Drupal\system\Tests\Common

Code

protected function setUp() {
  parent::setUp('language');
  $this
    ->config('system.date')
    ->set('timezone.user.configurable', 1)
    ->save();
  $formats = $this->container
    ->get('entity.manager')
    ->getStorage('date_format')
    ->loadMultiple(array(
    'long',
    'medium',
    'short',
  ));
  $formats['long']
    ->setPattern('l, j. F Y - G:i')
    ->save();
  $formats['medium']
    ->setPattern('j. F Y - G:i')
    ->save();
  $formats['short']
    ->setPattern('Y M j - g:ia')
    ->save();
  $this
    ->refreshVariables();
  $this
    ->settingsSet('locale_custom_strings_' . self::LANGCODE, array(
    '' => array(
      'Sunday' => 'domingo',
    ),
    'Long month name' => array(
      'March' => 'marzo',
    ),
  ));
  ConfigurableLanguage::createFromLangcode(static::LANGCODE)
    ->save();
  $this
    ->resetAll();
}