You are here

public function TextimageTestCase::setUp in Textimage 7.3

Set up.

Overrides DrupalWebTestCase::setUp

File

tests/textimage.test, line 16
Textimage - web test case script.

Class

TextimageTestCase
This class provides methods for testing Textimage.

Code

public function setUp() {

  // Enable required modules.
  $modules = array(
    'textimage',
  );
  parent::setUp($modules);

  // Create a user and log it in.
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'access content',
    'create article content',
    'edit any article content',
    'delete any article content',
    'administer image styles',
    'generate textimage url derivatives',
  ));
  $this
    ->drupalLogin($this->admin_user);

  // Change Textimage font directory.
  $this
    ->drupalGet($this->textimageAdmin . '/settings');
  $edit = array(
    'fonts_path' => drupal_get_path('module', 'textimage') . '/tests/fonts',
  );
  $this
    ->drupalPostAJAX(NULL, $edit, 'fonts_path');
  $edit = array(
    'default_font_name' => 'Old Standard TT Regular',
  );
  $this
    ->drupalPost(NULL, $edit, t('Save configuration'));

  // Create a test image style.
  $edit = array(
    'name' => 'textimage_test',
    'label' => 'Textimage Test',
  );
  $this
    ->drupalPost('admin/config/media/image-styles/add', $edit, t('Create new style'));

  // Create a test textimage_text effect.
  $this
    ->drupalPost('admin/config/media/image-styles/edit/textimage_test/add/textimage_text', array(), t('Add effect'));

  // Set image storage to 'public' wrapper.
  $edit = array(
    'textimage_options[uri_scheme]' => 'public',
  );
  $this
    ->drupalPost('admin/config/media/image-styles/edit/textimage_test', $edit, t('Update style'));
}