You are here

function PathautoFunctionalTestCase::testPatternsValidation in Pathauto 7

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

File

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

Class

PathautoFunctionalTestCase
Test basic pathauto functionality.

Code

function testPatternsValidation() {
  $edit = array();
  $edit['pathauto_node_pattern'] = '[node:title]/[user:name]/[term:name]';
  $edit['pathauto_node_page_pattern'] = 'page';
  $this
    ->drupalPost('admin/config/search/path/patterns', $edit, 'Save configuration');
  $this
    ->assertText('Default path pattern (applies to all content types with blank patterns below) is using the following invalid tokens: [user:name], [term:name].');
  $this
    ->assertText('The Pattern for all Basic page paths cannot contain fewer than one token.');
  $this
    ->assertNoText('The configuration options have been saved.');
  $edit['pathauto_node_pattern'] = '[node:title]';
  $edit['pathauto_node_page_pattern'] = 'page/[node:title]';
  $edit['pathauto_node_article_pattern'] = '';
  $this
    ->drupalPost('admin/config/search/path/patterns', $edit, 'Save configuration');
  $this
    ->assertText('The configuration options have been saved.');
}