function ImageAllowInsecureDerivativesTestCase::testSettings in Image Allow Insecure Derivatives 7
Tests the settings page.
File
- ./
image_allow_insecure_derivatives.test, line 51 - Tests for the Image Allow Insecure Derivatives module.
Class
- ImageAllowInsecureDerivativesTestCase
- Provides tests for the Image Allow Insecure Derivatives module.
Code
function testSettings() {
$admin_user = $this
->drupalCreateUser(array(
'administer site configuration',
));
$this
->drupalLogin($admin_user);
// Disable the setting.
$this
->drupalPost('admin/config/media/image-toolkit', array(
'image_allow_insecure_derivatives' => FALSE,
), t('Save configuration'));
$this
->assertText(t('The configuration options have been saved.'));
$this
->drupalGet('admin/config/media/image-toolkit');
if ($this
->parse()) {
$field = $this
->xpath('//input[@name=:name]', array(
':name' => 'image_allow_insecure_derivatives',
));
$this
->assertFalse(isset($field[0]['checked']), 'Image Allow Insecure Derivatives can be disabled.');
}
// Enable the setting.
$this
->drupalPost('admin/config/media/image-toolkit', array(
'image_allow_insecure_derivatives' => TRUE,
), t('Save configuration'));
$this
->assertText(t('The configuration options have been saved.'));
$this
->drupalGet('admin/config/media/image-toolkit');
if ($this
->parse()) {
$field = $this
->xpath('//input[@name=:name]', array(
':name' => 'image_allow_insecure_derivatives',
));
$this
->assertTrue(isset($field[0]['checked']), 'Image Allow Insecure Derivatives can be enabled.');
}
}