You are here

function PathautoUnitTestCase::testNoExistingPathAliases in Pathauto 6.2

Same name and namespace in other branches
  1. 6 pathauto.test \PathautoUnitTestCase::testNoExistingPathAliases()
  2. 7 pathauto.test \PathautoUnitTestCase::testNoExistingPathAliases()

File

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

Class

PathautoUnitTestCase
Unit tests for Pathauto functions.

Code

function testNoExistingPathAliases() {
  variable_set('pathauto_node_page_pattern', '[title-raw]');
  variable_set('pathauto_punctuation_period', PATHAUTO_PUNCTUATION_DO_NOTHING);

  // Check that Pathauto does not create an alias of '/admin'.
  $node = $this
    ->drupalCreateNode(array(
    'title' => 'Admin',
    'type' => 'page',
  ));
  $this
    ->assertNoEntityAlias('node', $node);

  // Check that Pathauto does not create an alias of '/modules'.
  $node->title = 'Modules';
  node_save($node);
  $this
    ->assertNoEntityAlias('node', $node);

  // Check that Pathauto does not create an alias of '/index.php'.
  $node->title = 'index.php';
  node_save($node);
  $this
    ->assertNoEntityAlias('node', $node);

  // Check that a safe value gets an automatic alias. This is also a control
  // to ensure the above tests work properly.
  $node->title = 'Safe value';
  node_save($node);
  $this
    ->assertEntityAlias('node', $node, 'safe-value');
}