You are here

function sweaverAdministration::setUp in Sweaver 6

Same name and namespace in other branches
  1. 7 tests/sweaver.admin.test \sweaverAdministration::setUp()

Implementation of setUp().

Overrides DrupalWebTestCase::setUp

File

tests/sweaver.admin.test, line 25
Tests for sweaver backend Note: run this patch on D6 to allow posts to hidden fields: http://drupal.org/node/488810#comment-1693662.

Class

sweaverAdministration
@file Tests for sweaver backend Note: run this patch on D6 to allow posts to hidden fields: http://drupal.org/node/488810#comment-1693662.

Code

function setUp() {
  $this->perms = '';
  $this->imagecache_tests = FALSE;
  $this->image_path = 'misc/druplicon.png';
  $modules = array(
    'sweaver',
    'ctools',
    'jquery_ui',
  );

  // Imagecache setups.
  $imagecache_tests = FALSE;
  $imagecache = drupal_get_filename('module', 'imagecache');
  $imageapi = drupal_get_filename('module', 'imageapi');
  $imageapi_gd = drupal_get_filename('module', 'imageapi_gd');
  if (!empty($imagecache) && !empty($imageapi_gd) && !empty($imageapi)) {
    $this->imagecache_tests = TRUE;
    $this->perms = 'administer imagecache';
    parent::setUp('sweaver', 'ctools', 'jquery_ui', 'imageapi', 'imageapi_gd', 'imagecache');
  }
  else {
    parent::setUp('sweaver', 'ctools', 'jquery_ui');
  }
  if ($this->imagecache_tests) {
    db_query("INSERT INTO {imagecache_preset} (presetname) VALUES ('%s')", 'sweavertest');
    $this->preset_id = db_last_insert_id('imagecache', 'presetid');
    $this->preset_name = 'sweavertest';
    $data = 'a:3:{s:5:"width";s:4:"100%";s:6:"height";s:4:"100%";s:7:"upscale";i:0;}';
    db_query("INSERT INTO {imagecache_action} (presetid, weight, module, action, data) VALUES (%d, 0, 'imagecache', 'imagecache_scale', '%s')", $this->preset_id, $data);
  }
}