public function RedirectTermMergeWebTestCase::testDisabledAndPermissions in Term Merge 7
Test disabled Redirect module and access rights.
File
- ./
term_merge.test, line 1129 - Test the Term Merge module.
Class
- RedirectTermMergeWebTestCase
- Test the integration between Term Merge module and Path/Redirect modules.
Code
public function testDisabledAndPermissions() {
// Checking access rights required to set up redirection during term
// merging.
$this
->drupalLogin($this->admin);
$this
->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/merge');
$this
->assertNoPattern('#\\<select[^>]+name="redirect"[^>]*\\>#i', 'No redirection settings are available for a user that does not possess corresponding permissions.');
// Set a default value to make sure term merge form uses it.
variable_set('term_merge_default_redirect', 0);
$this
->drupalLogin($this->superAdmin);
$this
->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/merge');
$this
->assertPattern('#\\<select[^>]+name="redirect"[^>]*\\>#i', 'Redirection settings are available for a user that possesses corresponding permissions.');
$this
->assertFieldByXPath('//select[@name="redirect"]/option[@value="' . variable_get('term_merge_default_redirect', TERM_MERGE_NO_REDIRECT) . '"][@selected="selected"]', NULL, 'The default redirect action is properly set.');
// Making sure redirect settings are not available during merging when
// merging with disabled Redirect module.
module_disable(array(
'redirect',
));
$this
->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/merge');
$this
->assertNoPattern('#\\<select[^>]+name="redirect"[^>]*\\>#i', 'No redirection settings are available when the redirect module is disabled.');
}