1.20.x path_pattern.test PathPatternFunctionalTestCase::testPatternsValidation()

File

modules/path/tests/path_pattern.test, line 770
Functionality tests for automatic path generation.

Class

PathPatternFunctionalTestCase
Test basic Path automatic URL alias functionality.

Code

function testPatternsValidation() {
  $edit = array();
  $edit['node_pattern'] = '[node:title]/[user:name]/[term:name]';
  $edit['node_page_pattern'] = 'page';
  $this->backdropPost('admin/config/urls/path/patterns', $edit, 'Save configuration');
  $this->assertText('The Default URL alias pattern (applies to all content types with blank URL alias patterns below) is using the following invalid tokens: [user:name], [term:name].');
  $this->assertText('The URL alias pattern for all Page URLs cannot contain fewer than one token.');
  $this->assertNoText('The configuration options have been saved.');

  $edit['node_pattern'] = '[node:title]';
  $edit['node_page_pattern'] = 'page/[node:title]';
  $edit['node_post_pattern'] = '';
  $this->backdropPost('admin/config/urls/path/patterns', $edit, 'Save configuration');
  $this->assertText('The configuration options have been saved.');
}