You are here

function PathautoFunctionalTestCase::testSettingsValidation in Pathauto 6

Same name and namespace in other branches
  1. 6.2 pathauto.test \PathautoFunctionalTestCase::testSettingsValidation()
  2. 7 pathauto.test \PathautoFunctionalTestCase::testSettingsValidation()

File

./pathauto.test, line 552
Functionality tests for Pathauto.

Class

PathautoFunctionalTestCase
Test basic pathauto functionality.

Code

function testSettingsValidation() {
  $edit = array();
  $edit['pathauto_max_length'] = 'abc';
  $edit['pathauto_max_component_length'] = 'abc';
  $this
    ->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
  $this
    ->assertText('The field Maximum alias length is not a valid number.');
  $this
    ->assertText('The field Maximum component length is not a valid number.');
  $this
    ->assertNoText('The configuration options have been saved.');
  $edit['pathauto_max_length'] = '0';
  $edit['pathauto_max_component_length'] = '0';
  $this
    ->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
  $this
    ->assertText('The field Maximum alias length cannot be less than 1.');
  $this
    ->assertText('The field Maximum component length cannot be less than 1.');
  $this
    ->assertNoText('The configuration options have been saved.');
  $edit['pathauto_max_length'] = '999';
  $edit['pathauto_max_component_length'] = '999';
  $this
    ->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
  $this
    ->assertText('The field Maximum alias length cannot be greater than 128.');
  $this
    ->assertText('The field Maximum component length cannot be greater than 128.');
  $this
    ->assertNoText('The configuration options have been saved.');
  $edit['pathauto_max_length'] = '50';
  $edit['pathauto_max_component_length'] = '50';
  $this
    ->drupalPost('admin/build/path/pathauto', $edit, 'Save configuration');
  $this
    ->assertText('The configuration options have been saved.');
}