You are here

function ImageAllowInsecureDerivativesTestCase::testRequirements in Image Allow Insecure Derivatives 7

Tests the requirements page.

File

./image_allow_insecure_derivatives.test, line 83
Tests for the Image Allow Insecure Derivatives module.

Class

ImageAllowInsecureDerivativesTestCase
Provides tests for the Image Allow Insecure Derivatives module.

Code

function testRequirements() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer site configuration',
  ));
  $this
    ->drupalLogin($admin_user);

  // Retrieve the status report page when enabled.
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertText(t('Image Allow Insecure Derivatives'), 'Image Allow Insecure Derivatives is displayed on the status report page when enabled.');
  $this
    ->assertText(t('Allowing insecure image derivates can cause security instabilities. Only use this if you are experiencing image display issues, and understand the security risks.'), 'The correct status is shown when enabled.');

  // Disable the setting and re-check the page.
  variable_set('image_allow_insecure_derivatives', FALSE);
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertText(t('Image Allow Insecure Derivatives'), 'Image Allow Insecure Derivatives is displayed on the status report page when disabled.');
  $this
    ->assertNoText(t('Allowing insecure image derivates can cause security instabilities. Only use this if you are experiencing image display issues, and understand the security risks.'), 'The correct status is shown when disabled.');
}