Commit 8b0b496a authored by Dries's avatar Dries
Browse files

- Patch #560738 by sun, noahb, David_Rothstein | dropcube: trying to delete a...

- Patch #560738 by sun, noahb, David_Rothstein | dropcube: trying to delete a text format gives 'page not found'.
parent fdeb890b
...@@ -33,7 +33,7 @@ function filter_admin_overview($form) { ...@@ -33,7 +33,7 @@ function filter_admin_overview($form) {
} }
$form['formats'][$id]['roles'] = array('#markup' => $roles_markup); $form['formats'][$id]['roles'] = array('#markup' => $roles_markup);
$form['formats'][$id]['configure'] = array('#markup' => l(t('configure'), 'admin/config/content/formats/' . $id)); $form['formats'][$id]['configure'] = array('#markup' => l(t('configure'), 'admin/config/content/formats/' . $id));
$form['formats'][$id]['delete'] = array('#markup' => $form['formats'][$id]['#is_fallback'] ? '' : l(t('delete'), 'admin/config/content/formats/delete/' . $id)); $form['formats'][$id]['delete'] = array('#markup' => $form['formats'][$id]['#is_fallback'] ? '' : l(t('delete'), 'admin/config/content/formats/' . $id . '/delete'));
$form['formats'][$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight); $form['formats'][$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight);
} }
$form['submit'] = array('#type' => 'submit', '#value' => t('Save changes')); $form['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
......
...@@ -10,6 +10,42 @@ class FilterAdminTestCase extends DrupalWebTestCase { ...@@ -10,6 +10,42 @@ class FilterAdminTestCase extends DrupalWebTestCase {
); );
} }
function setUp() {
parent::setUp();
// Create users.
$this->admin_user = $this->drupalCreateUser(array('administer filters'));
$this->web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
$this->drupalLogin($this->admin_user);
}
function testFormatAdmin() {
// Add text format.
$this->drupalGet('admin/config/content/formats');
$this->clickLink('Add text format');
$edit = array(
'name' => $this->randomName(),
);
$this->drupalPost(NULL, $edit, t('Save configuration'));
// Edit text format.
$format = $this->getFilter($edit['name']);
$this->drupalGet('admin/config/content/formats');
$this->assertRaw('admin/config/content/formats/' . $format->format);
$this->drupalGet('admin/config/content/formats/' . $format->format);
$this->drupalPost(NULL, array(), t('Save configuration'));
// Delete text format.
$this->drupalGet('admin/config/content/formats');
$this->assertRaw('admin/config/content/formats/' . $format->format . '/delete');
$this->drupalGet('admin/config/content/formats/' . $format->format . '/delete');
$this->drupalPost(NULL, array(), t('Delete'));
// Verify that deleted text format no longer exists.
$this->drupalGet('admin/config/content/formats/' . $format->format);
$this->assertResponse(404, t('Deleted text format no longer exists.'));
}
/** /**
* Test filter administration functionality. * Test filter administration functionality.
*/ */
...@@ -19,11 +55,6 @@ class FilterAdminTestCase extends DrupalWebTestCase { ...@@ -19,11 +55,6 @@ class FilterAdminTestCase extends DrupalWebTestCase {
// Line filter. // Line filter.
$second_filter = 'filter_autop'; $second_filter = 'filter_autop';
// Create users.
$admin_user = $this->drupalCreateUser(array('administer filters'));
$web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
$this->drupalLogin($admin_user);
list($filtered, $full, $plain) = $this->checkFilterFormats(); list($filtered, $full, $plain) = $this->checkFilterFormats();
// Check that the fallback format exists and cannot be deleted. // Check that the fallback format exists and cannot be deleted.
...@@ -34,8 +65,8 @@ class FilterAdminTestCase extends DrupalWebTestCase { ...@@ -34,8 +65,8 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$this->assertResponse(403, t('The fallback format cannot be deleted.')); $this->assertResponse(403, t('The fallback format cannot be deleted.'));
// Verify access permissions to Full HTML format. // Verify access permissions to Full HTML format.
$this->assertTrue(filter_access(filter_format_load($full), $admin_user), t('Admin user may use Full HTML.')); $this->assertTrue(filter_access(filter_format_load($full), $this->admin_user), t('Admin user may use Full HTML.'));
$this->assertFalse(filter_access(filter_format_load($full), $web_user), t('Web user may not use Full HTML.')); $this->assertFalse(filter_access(filter_format_load($full), $this->web_user), t('Web user may not use Full HTML.'));
// Add an additional tag. // Add an additional tag.
$edit = array(); $edit = array();
...@@ -96,7 +127,7 @@ class FilterAdminTestCase extends DrupalWebTestCase { ...@@ -96,7 +127,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
// Switch user. // Switch user.
$this->drupalLogout(); $this->drupalLogout();
$this->drupalLogin($web_user); $this->drupalLogin($this->web_user);
$this->drupalGet('node/add/page'); $this->drupalGet('node/add/page');
$this->assertRaw('<option value="' . $full . '">Full HTML</option>', t('Full HTML filter accessible.')); $this->assertRaw('<option value="' . $full . '">Full HTML</option>', t('Full HTML filter accessible.'));
...@@ -129,7 +160,7 @@ class FilterAdminTestCase extends DrupalWebTestCase { ...@@ -129,7 +160,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
// Switch user. // Switch user.
$this->drupalLogout(); $this->drupalLogout();
$this->drupalLogin($admin_user); $this->drupalLogin($this->admin_user);
// Clean up. // Clean up.
// Allowed tags. // Allowed tags.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment