1 path_pattern.test PathPatternFunctionalTestCase::testPatternsValidation()

File

core/modules/path/tests/path_pattern.test, line 803
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 for content is using the following invalid tokens: [user:name], [term:name].');
  $this->assertText('The Content of type Page 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.');
}