You are here

function sweaverAdministration::testAdvancedAdminSweaver in Sweaver 7

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

Advanced administration tests for Sweaver.

File

tests/sweaver.admin.test, line 95
Tests for sweaver backend

Class

sweaverAdministration
@file Tests for sweaver backend

Code

function testAdvancedAdminSweaver() {
  $editor_tests = t('Special admin testing');

  // Public path.
  $public_path = variable_get('file_public_path', conf_path() . '/files');

  // Upload image.
  $edit = array(
    'description' => 'Image test',
    'files[image]' => realpath($this->image_path),
  );
  $this
    ->drupalPost('admin/config/user-interface/sweaver/images/add', $edit, t('Save image'));
  $this
    ->assertText(t('Image Image test has been saved.'), t('Image uploaded'), $editor_tests);
  $this
    ->assertTrue(file_exists($public_path . '/sweaver/sweaver_image_1.png'), t('Image uploaded'), $editor_tests);
  $this
    ->drupalGet('user');
  $this
    ->assertRaw('value="' . $GLOBALS['base_url'] . '/' . $public_path . '/sweaver/sweaver_image_1.png"', t('Image found in editor'), $editor_tests);
  $this
    ->drupalGet('user');
  $style_url = image_style_url('medium', 'public://sweaver/sweaver_image_1.png');
  $raw_style = '<option value="' . $style_url . '">Image test (sweavertest)</option>';
  $this
    ->assertNoRaw($raw_style, t('Styled version of image not found'), $editor_tests);

  // Enable styles.
  $edit = array(
    'sweaver_plugin_images_styles' => 1,
  );
  $this
    ->drupalPost('admin/config/user-interface/sweaver/images', $edit, t('Save configuration'));
  $this
    ->drupalGet('user');
  $this
    ->assertRaw('styles/medium/public/sweaver/sweaver_image_1.png', t('Styled version of image found'), $editor_tests);
}