1 text.test TextTranslationTestCase::setUp()

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

Generates a random database prefix and installs Backdrop with the specified installation profile in BackdropWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

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.


...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Return value

bool: TRUE if set up completes, FALSE if an error occurred.

Overrides BackdropWebTestCase::setUp

See also





core/modules/field/modules/text/tests/text.test, line 392
Tests for text.module.




function setUp() {
  parent::setUp('locale', 'translation');

  $full_html_format = filter_format_load('full_html');
  $this->format = $full_html_format->format;
  $this->admin = $this->backdropCreateUser(array(
    'administer languages',
    'administer content types',
    'access administration pages',
    'bypass node access',
    'administer fields',
  $this->translator = $this->backdropCreateUser(array('create post content', 'edit own post content', 'translate content'));

  // Enable an additional language.
  $edit = array('langcode' => 'fr');
  $this->backdropPost('admin/config/regional/language/add', $edit, t('Add language'));

  // Set "Post" content type to use multilingual support with translation.
  $edit = array('language' => TRANSLATION_ENABLED);
  $this->backdropPost('admin/structure/types/manage/post', $edit, t('Save content type'));
  $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Post')), 'Post content type has been updated.');