function sweaverAdministration::testAdvancedAdminSweaver in Sweaver 6
Same name and namespace in other branches
- 7 tests/sweaver.admin.test \sweaverAdministration::testAdvancedAdminSweaver()
Advanced administration tests for Sweaver.
File
- tests/
sweaver.admin.test, line 118 - 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 testAdvancedAdminSweaver() {
$editor_tests = t('Special admin testing');
if ($this->imagecache_tests) {
$perms = array(
'use editor',
'configure sweaver',
'administer imagecache',
);
}
else {
$perms = array(
'use editor',
'configure sweaver',
);
}
// User login.
$admin_user = $this
->drupalCreateUser($perms);
$this
->drupalLogin($admin_user);
// Upload image.
$edit = array(
'description' => 'Image test',
'files[image]' => realpath($this->image_path),
);
$this
->drupalPost('admin/settings/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(file_directory_path() . '/sweaver/sweaver_image_1.png'), t('Image uploaded'), $editor_tests);
$this
->drupalGet('user');
$this
->assertRaw('value="' . $GLOBALS['base_url'] . '/' . file_directory_path() . '/sweaver/sweaver_image_1.png"', t('Image found in editor'), $editor_tests);
// Test imagecache if available.
if ($this->imagecache_tests) {
imagecache_presets(TRUE);
$this
->drupalGet('user');
$imagecache_url = imagecache_create_url($this->preset_name, 'sites/default/files/sweaver/sweaver_image_1.png');
$raw_imagecache = '<option value="' . $imagecache_url . '">Image test (sweavertest)</option>';
$this
->assertNoRaw($raw_imagecache, t('Imagecache version of image not found'), $editor_tests);
// Enable imagecache.
$edit = array(
'sweaver_plugin_images_imagecache' => 1,
);
$this
->drupalPost('admin/settings/sweaver/images', $edit, t('Save configuration'));
$this
->drupalGet('user');
$this
->assertRaw('imagecache/sweavertest/sweaver/sweaver_image_1.png', t('Imagecache version of image found'), $editor_tests);
}
}